summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: remove 'params' parameter from ctx->Driver.TexParameter()Brian Paul2016-10-131-4/+2
| | | | | | | | | | | None of the drivers which implement this hook do anything with the texture parameter value. Drivers just look at the pname and set a dirty flag if needed. We were doing some ugly casting and type conversion to setup the argument so that all goes away. Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* mesa: call ctx->Driver.TexParameter() in texture_buffer_range()Brian Paul2016-10-061-0/+13
| | | | | | | To inform drivers of texture buffer offset/size changes, as we do for other texture object parameters. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
* mesa: make _mesa_texture_buffer_range() staticBrian Paul2016-10-061-15/+19
| | | | | | Not called from any other file. Also, add a comment. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* mesa: add const qualifier, comment on can_avoid_reallocation()Brian Paul2016-10-061-1/+8
| | | | Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* mesa: Add and use _mesa_has_texture_cube_map_array helperIan Romanick2016-08-261-6/+6
| | | | | | Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* main: Add MESA_VERBOSE=api support for glTexImageJordan Justen2016-08-261-0/+5
| | | | | Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: Add the infrastructure for KHR_texture_compression_astc_sliced_3dAnuj Phogat2016-07-181-3/+4
| | | | | | | V2: Drop the changes to gl.xml. Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
* mesa: handle numSamples=0 in _mesa_test_proxy_teximage()Brian Paul2016-07-151-3/+1
| | | | | | | Should fix the regressions reported in bug 96949. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96949 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: handle numLevels, numSamples in _mesa_test_proxy_teximage()Brian Paul2016-07-151-3/+42
| | | | | | | | | If numSamples > 0, we can compute the size of the whole mipmapped texture. That's the case for glTexStorage(GL_PROXY_TEXTURE_x). Also, multiply the texture size by numSamples for MSAA textures. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* mesa: add numLevels, numSamples to Driver.TestProxyTexImage()Brian Paul2016-07-151-10/+12
| | | | | | | | | | | | | So that the function can work properly with glTexStorage(), where we know how many mipmap levels there are. And so we can compute storage for MSAA textures. Also, remove the obsolete texture border parameter. A subsequent patch will update _mesa_test_proxy_teximage() to use these new parameters. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* mesa: set _NEW_BUFFERS when updating texture bound to current buffersIlia Mirkin2016-07-111-1/+7
| | | | | | | | | | | | | | | | When a glTexImage call updates the parameters of a currently bound framebuffer, we might miss out on revalidating whether it is complete. Make sure to set _NEW_BUFFERS which will trigger the revalidation in that case. Also while we're at it, fix the fb parameter passed in to the eventual RenderTexture call. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94148 Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
* mesa: etc2 online compression is unsupported, don't attempt itIlia Mirkin2016-07-111-0/+1
| | | | | | Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
* mesa: Make TexSubImage check negative dimensions sooner.Kenneth Graunke2016-06-131-19/+43
| | | | | | | | | | | | | | | | | | | Two dEQP tests expect INVALID_VALUE errors for negative width/height parameters, but get INVALID_OPERATION because they haven't actually created a destination image. This is arguably not a bug in Mesa, as there's no specified ordering of error conditions. However, it's also really easy to make the tests pass, and there's no real harm in doing these checks earlier. Fixes: dEQP-GLES3.functional.negative_api.texture.texsubimage3d_neg_width_height dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texsubimage3d_neg_width_height v2: Drop redundant check (caught by Anuj Phogat). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* mesa/teximage: fix GL_FLOAT in commentIlia Mirkin2016-05-231-1/+1
| | | | | | Noticed by Brian. Trivial. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
* main: check driver float texture support before upgrading to 16F/32FIlia Mirkin2016-05-231-28/+33
| | | | | | | | | | When passing in GL_RGBA or other base formats, we will try to upgrade the format to whatever the passed in type was. However not all drivers (notably nv30) support 32F textures, and so this would lead to crashes down the line. Only upgrade when the relevant extensions are available. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
* mesa: Handle 3d block sizes in teximage error checksAnuj Phogat2016-05-031-6/+13
| | | | | Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Try to fix CopyTex[Sub]Image of stencil textures.Kenneth Graunke2016-04-261-2/+3
| | | | | | | | | | | | | ES prohibits this, but GL appears to allow it. We at least need this much, or else we'll crash as there's no source to read from. This fixed crashes in the ES tests before I realized I needed to prohibit stencil instead. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
* mesa: Disallow CopyTexSubImage on stencil formats in ES.Kenneth Graunke2016-04-261-0/+9
| | | | | | | | | | | Fixes - ES31-CTS.gtf.GL31Tests.texture_stencil8.texture_stencil8 - ES31-CTS.gtf.GL31Tests.texture_stencil8.texture_stencil8_multisample Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
* mesa: add OES_texture_buffer and EXT_texture_buffer supportIlia Mirkin2016-03-281-7/+13
| | | | | | | | Allow ES 3.1 contexts to access the texture buffer functionality. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: optimize out the realloc from glCopyTexImagexD()Miklós Máté2016-03-271-0/+36
| | | | | | | | | | | v2: comment about the purpose of the code v3: also compare texFormat, add a perf debug message, formatting fixes Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Miklós Máté <mtmkls@gmail.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
* mesa/teximage: add _mesa_is_cube_map_texture utility methodEduardo Lima Mitev2016-03-031-0/+18
| | | | Reviewed-by: Dave Airlie <airlied@redhat.com>
* mesa/main: not fill mesa_error on _mesa_legal_texture_base_format_for_targetAlejandro Piñeiro2016-03-031-13/+5
| | | | | | | This would allow to use this method if you are just querying if it is allowed, like for arb_internalformat_query2. Reviewed-by: Dave Airlie <airlied@redhat.com>
* mesa/teximage: Make _mesa_format_no_online_compression publicAntia Puentes2016-03-031-1/+1
| | | | | | | | It will be used by the ARB_internalformat_query2 implementation to check if a certain compressed 'internalformat' is supported by texture 'targets'. Reviewed-by: Dave Airlie <airlied@redhat.com>
* mesa/teximage: make public is_renderable_texture_formatAntia Puentes2016-03-031-3/+3
| | | | | | | | It will be used by the ARB_internalformat_query2 implementation to check if the 'internalformat' passed is supported by texture MULTISAMPLE 'targets'. Reviewed-by: Dave Airlie <airlied@redhat.com>
* mesa: add GL_OES_texture_stencil8 supportIlia Mirkin2016-02-191-0/+2
| | | | | | | | | It's basically the same thing as GL_ARB_texture_stencil8 except that glCopyTexImage isn't supported, so add STENCIL_INDEX to the list of invalid GLES formats for glCopyTexImage. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
* mesa: make _mesa_tex_target_to_face() an inline functionBrian Paul2016-02-121-14/+0
| | | | | Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: remove _ARB suffix from cube map enumsBrian Paul2016-02-121-17/+17
| | | | | | | Just minor clean-up so we're consistent everywhere. Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: check that internalformat of CopyTexImage*D is not 1, 2, 3, 4Nicolai Hähnle2016-01-081-0/+16
| | | | | | | | | The piglit copyteximage check has recently been augmented to test this, but apparently it hasn't been fixed in Mesa so far. This language also already appears in the OpenGL 2.1 spec (Ian). Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: Fix typos in print messagesAndreas Boll2015-12-091-1/+1
| | | | | | | | s/inconsistant/inconsistent/ s/occurences/occurrences/ Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: print enum names rather than hexadecimal values in error messagesBrian Paul2015-12-031-6/+6
| | | | Trivial.
* mesa: print enum string in compressed_subtexture_error_check() error msgBrian Paul2015-12-021-2/+2
| | | | Trivial.
* mesa: support GL_RED/GL_RG in ES2 contexts when driver support existsIlia Mirkin2015-11-281-1/+1
| | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93126 Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Eduardo Lima Mitev <elima@igalia.com> Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
* mesa/teximage: Fix S3TC regression due to ASTC interactionNanley Chery2015-11-221-28/+15
| | | | | | | | | | | | | | | | | | | | | A prior, literal reading of the ASTC spec led to the prohibition of some compressed formats being used against the targets: TEXTURE_CUBE_MAP_ARRAY and TEXTURE_3D. Since the spec does not specify interactions with other extensions for specific compressed textures, remove such interactions. Fixes the following Piglit tests on Gen9: piglit.spec.arb_direct_state_access.getcompressedtextureimage piglit.spec.arb_get_texture_sub_image.arb_get_texture_sub_image-getcompressed piglit.spec.arb_texture_cube_map_array.fbo-generatemipmap-cubemap array s3tc_dxt1 piglit.spec.ext_texture_compression_s3tc.getteximage-targets cube_array s3tc v2. Don't interact with other specific compressed formats (Ian). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91927 Suggested-by: Neil Roberts <neil@linux.intel.com> Signed-off-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
* mesa: Move _mesa_base_tex_format() from teximage to glformats filesEduardo Lima Mitev2015-09-281-374/+0
| | | | | | | | | | | | | | | | | This function will be needed as part of validating the combination of format, type and internal format of texture pixel operations, which happens in glformats files. Specifically, we want to be able to obtain the base format of a resolved effective internal format, to compare it with the original internal format passed. Also, since this function deals solely with GL formats, it fits better in glformats where the rest of similar format functionality rests. The function is moved as-is, without any modification. Cc: "11.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Tested-by: Mark Janes <mark.a.janes@intel.com>
* mesa: Fix order of format+type and internal format checks for glTexImageXD opsEduardo Lima Mitev2015-09-281-16/+25
| | | | | | | | | | | | | | | | | | | The more specific GLES constrains should be checked after the general validation performed by _mesa_error_check_format_and_type(). This is also for consistency with the error checks order of glTexSubImage ops. v3: The change of order uncovered a bug that regresses a couple of piglit tests written against OpenGL-ES 1.1 spec, which expects an INVALID_VALUE instead of the INVALID_ENUM returned by _mesa_error_check_format_and_type() when an invalid format is passed to glTexImage2D. This version of the patch accounts for those cases. Fixes 1 dEQP test: * dEQP-GLES3.functional.negative_api.texture.teximage2d Cc: "11.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Tested-by: Mark Janes <mark.a.janes@intel.com>
* mesa: const-qualify _mesa_base_tex_format() ctx paramBrian Paul2015-09-221-1/+1
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa/teximage: reuse compressed format utility functions for base_formatNanley Chery2015-09-191-145/+5
| | | | | | | | | | | | | | | Reuse utility functions instead of reimplementing the same logic. * _mesa_is_compressed_format() performs the required checking to determine format support in the current context. * _mesa_gl_compressed_format_base_format() returns the base format. As a side effect, we now check that we're in a desktop context when determining support for the FXT1 and RGTC formats. This is in agreement with our extension table and the glext headers. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
* mesa/teximage: restrict GL_ETC1_RGB8_OES support to GLESNanley Chery2015-09-151-1/+2
| | | | | | | | | | | According to the extensions table and our glext headers, OES_compressed_ETC1_RGB8_texture is only supported in GLES1 and GLES2. Since we may give users a GLES3 context when a GLES2 context is requested, we also allow this extension for GLES3 as well. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
* mesa/extensions: restrict luminance alpha formats to API_OPENGL_COMPATNanley Chery2015-09-151-2/+4
| | | | | | | According the GL 3.1 spec, luminance alpha formats are deprecated. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
* mesa: rename rowStride to imageStride in texturesubimage()Brian Paul2015-08-271-4/+4
| | | | Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
* mesa: only copy the requested teximage facesIlia Mirkin2015-08-271-2/+2
| | | | | | | | | | | | | | Cube maps are special in that they have separate teximages for each face. We handled that by copying the data to them separately, but in case zoffset != 0 or depth != 6 we would read off the end of the client array or modify the wrong images. zoffset/depth have already been verified by the time the code gets to this stage, so no need to double-check. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Brian Paul <brianp@vmware.com> Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
* mesa: return bool instead of GLboolean in compressedteximage_only_format()Nanley Chery2015-08-261-3/+3
| | | | | | | | | In agreement with the coding style, functions that aren't directly visible to the GL API should prefer the use of bool over GLboolean. Suggested-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
* mesa/teximage: return the base internal format of the ASTC formatsNanley Chery2015-08-261-0/+4
| | | | | | | | | | | | | | | | | This is necesary to initialize the gl_texture_image struct. From the KHR_texture_compression_astc_ldr spec: "Added to Section 3.8.6, Compressed Texture Images Add the tokens specified above to Table 3.16, Compressed Internal Formats. In all cases, the base internal format will be RGBA. The encoding allows images to be encoded with fewer channels, but this is always presented as RGBA to the sampler." v2. use _mesa_is_astc_format(). Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
* mesa/teximage: accept ASTC formats for 3D texture specificationNanley Chery2015-08-261-7/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | The ASTC spec was revised as follows: Revision 2, April 28, 2015 - added CompressedTex{Sub,}Image3D to commands accepting ASTC format tokens in the New Tokens section [...]. Support only exists in the HDR submode: Add a second new column "3D Tex." which is empty for all non-ASTC formats. If only the LDR profile is supported by the implementation, this column is also empty for all ASTC formats. If both the LDR and HDR profiles are supported only, this column is checked for all ASTC formats. LDR-only systems should generate an INVALID_OPERATION error when attempting to call CompressedTexImage3D with the TEXTURE_3D target. v2. return the proper error for LDR-only systems. v3. update is_astc_format(). v4. use _mesa_is_astc_format(). v5. place logic in _mesa_target_can_be_compressed. v6. fix issues handling ASTC formats. Reviewed-by: Chad Versace <chad.versace@intel.com> Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
* mesa: don't enable online compression for ASTC formatsNanley Chery2015-08-261-4/+13
| | | | | | | | | | | | | In agreement with the ASTC spec, this makes calls to TexImage*D unsuccessful. Implied by the spec, Generate[Texture]Mipmap and [Copy]Tex[Sub]Image*D calls must be unsuccessful as well. v2. actually force attempts to compress online to fail. v3. indentation (Matt). v4. update copytexture_error_check to account for CopyTexImage*D (Chad). Reviewed-by: Chad Versace <chad.versace@intel.com> Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
* mesa/teximage: Add GL error parameter to _mesa_target_can_be_compressedNanley Chery2015-08-251-29/+61
| | | | | | | | | | Enables _mesa_target_can_be_compressed to return the appropriate GL error depending on it's inputs. Use the parameter to return the appropriate GL error for ETC2 formats on GLES3. Suggested-by: Chad Versace <chad.versace@intel.com> Reviewed-by: Chad Versace <chad.versace@intel.com> Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
* mesa: enable texture stencil8 for multisampleDave Airlie2015-08-251-2/+5
| | | | | | | | | This fixes GL45-CTS.gtf44.GL31Tests.texture_stencil8.texture_stencil8_gl44 from the ogl conform suite. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Cc: 10.6 11.0 <mesa-stable@lists.freedesktop.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
* mesa: validate size parameters for glTexStorage*MultisampleTapani Pälli2015-08-191-0/+26
| | | | | | | | v2: code cleanup v3: check only dimensions, samples is checked separately later Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
* mesa: check samples > 0 for glTex*MultisampleTimothy Arceri2015-08-181-0/+5
| | | | | | | | | | | | | The GL 4.5 spec says its an GL_INVALID_VALUE error if samples equals 0 for glTexImage*Multisample and an GL_INVALID_VALUE error if samples < 1 for glTexStorage*Multisample. The spec says its undefined what happens if glTexImage*Multisample is passed a samples value < 0 but we currently already produced a GL_INVALID_VALUE error in this case, this is also consistent with the Nvidia binary. Cc: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* mesa: rename texture function now that its staticTimothy Arceri2015-08-171-31/+31
| | | | Reviewed-by: Brian Paul <brianp@vmware.com>