summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texobj.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: add OES_texture_buffer and EXT_texture_buffer supportIlia Mirkin2016-03-281-4/+4
| | | | | | | | Allow ES 3.1 contexts to access the texture buffer functionality. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: simplify some code with new _mesa_cube_face_target() functionBrian Paul2016-02-121-6/+1
| | | | | Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: remove _ARB suffix from cube map enumsBrian Paul2016-02-121-13/+13
| | | | | | | Just minor clean-up so we're consistent everywhere. Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* texobj: Remove redundant checks that the texture cube faces match sizeNeil Roberts2016-01-211-10/+0
| | | | | | | | | | The texture mipmap completeness checking code was checking whether all of the faces have the same size. However this is pointless because the code just above it checks whether the face has the expected size calculated for the mipmap level anyway so the error condition could never be reached. This patch just removes it. Reviewed-by: Ian Romanick <[email protected]>
* texobj: Fix the completeness checks for cube texturesNeil Roberts2016-01-211-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | According to the GL 1.4 spec section 3.8.10, a cubemap texture is only complete if: • The level base arrays of each of the six texture images making up the cube map have identical, positive, and square dimensions. • The level base arrays were each specified with the same internal format. • The level base arrays each have the same border width. Previously the texture completeness code was only checking the first point. This patch makes it additionally check the other two. This fixes the following two dEQP tests: deqp-gles2.functional.texture.completeness.cube.format_mismatch_rgba_rgb_level_0_neg_z deqp-gles2.functional.texture.completeness.cube.format_mismatch_rgb_rgba_level_0_pos_z And also this Piglit test: spec/!opengl 2.0/incomplete-cubemap-format Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93792 Cc: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* texobj: Check completeness with InternalFormat rather than Mesa formatNeil Roberts2016-01-141-1/+1
| | | | | | | | | | | | | | The internal Mesa format used for a texture might not match the one requested in the internalFormat when the texture was created, for example if the driver is internally remapping RGB textures to RGBA. Otherwise it can cause false positives for completeness if one mipmap image is created as RGBA and the other as RGB because they would both have an RGBA Mesa format. If we check the InternalFormat instead then we are directly checking the API usage which I think better matches the intention of the check. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93700 Reviewed-by: Anuj Phogat <[email protected]>
* mesa: minor indentation fix in _mesa_BindTextureUnit()Brian Paul2015-10-141-1/+1
|
* mesa: remove unused texUnit local in _mesa_BindTextureUnit()Brian Paul2015-10-141-7/+0
| | | | | | | The texture unit is error-checked before this and the texUnit var is unused, so remove it. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: pass caller name to create_textures()Brian Paul2015-10-131-7/+6
| | | | Simpler than the dsa flag approach.
* mesa,meta: move gl_texture_object::TargetIndex initializationsBrian Paul2015-10-081-9/+18
| | | | | | | | | | | | | | | Before, we were unconditionally assigning the TargetIndex field in _mesa_BindTexture(), even if it was already set properly. Now we initialize TargetIndex wherever we initialize the Target field, in _mesa_initialize_texture_object(), finish_texture_init(), etc. v2: also update the meta_copy_image code. In make_view() the view_tex_obj->Target field was set, but not the TargetIndex field. Also, remove a second, redundant assignment to view_tex_obj->Target. Add sanity check assertions too. Reviewed-by: Anuj Phogat <[email protected]> Tested-by: Mark Janes <[email protected]>
* mesa: remove unused _mesa_create_nameless_texture()Brian Paul2015-10-081-20/+0
| | | | | Reviewed-by: Anuj Phogat <[email protected]> Tested-by: Mark Janes <[email protected]>
* mesa: remove unneeded error check in create_textures()Brian Paul2015-10-081-9/+2
| | | | | | | | | Callers of create_texture() will either pass target=0 or a validated GL texture target enum so no need to do another error check inside the loop. Reviewed-by: Anuj Phogat <[email protected]> Tested-by: Mark Janes <[email protected]>
* mesa: fix incorrect error in _mesa_BindTextureUnit()Brian Paul2015-10-011-1/+2
| | | | | | | | | | If the texture object exists, but the Name field is zero, it means the object was created but never bound to a target. Trying to bind it in _mesa_BindTextureUnit() should generate GL_INVALID_OPERATION. Fixes piglit's arb_direct_state_access-bind-texture-unit test. Reviewed-by: Tapani Pälli <[email protected]>
* mesa: remove _mesa_get_tex_unit_err() and fix error handlingBrian Paul2015-10-011-2/+7
| | | | | | | | | | | | | | This helper was only called from _mesa_BindTextureUnit(). It's simpler to just inline it. The error check / code / message in the helper was incorrect. It was written for glBindTextures(), not glBindTextureUnit(). The correct error for a bad texture unit number is GL_INVALID_VALUE. The error message now reports the unit number rather than a GL_TEXTUREi enum. Fixes a failure in piglit's arb_direct_state_access-bind-texture-unit test. Reviewed-by: Tapani Pälli <[email protected]>
* mesa: consolidate texture binding codeBrian Paul2015-10-011-121/+79
| | | | | | | | | Before, we were doing the actual _mesa_reference_texobj() call and ctx->Driver.BindTexture() and misc housekeeping in three different places. This consolidates the common code in a new bind_texture() function. Reviewed-by: Tapani Pälli <[email protected]>
* mesa: fix indentation in _mesa_create_nameless_texture()Brian Paul2015-10-011-9/+9
|
* mesa: enable enums for OES_texture_storage_multisample_2d_arrayTapani Pälli2015-08-271-1/+2
| | | | | | | | | v2: use _mesa_is_gles31(ctx) for verifying we are on ES 3.1, remove _es31 usage from get_hash_params.py Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Marta Lofstedt <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: make _mesa_bind_texture_unit() staticBrian Paul2015-08-241-5/+5
| | | | | | It's only called from the file it's defined in. Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Reset image unit state to the default values when a bound image is ↵Francisco Jerez2015-08-201-1/+4
| | | | | | | | | | | | | | | deleted. The ES31-CTS.shader_image_load_store.basic-api-bind conformance test expects the whole image unit state to be reset when the bound texture object is deleted. The ARB_shader_image_load_store extension is rather vague regarding what should happen with image unit state other than the texture object in that case, but the GL 4.2 and GLES 3.1 specifications (section "Automatic Unbinding of Deleted Objects") explicitly require it to be reset to the default values. Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa/es3.1: Allow textures with target GL_TEXTURE_2D_MULTISAMPLEMarta Lofstedt2015-08-031-2/+2
| | | | | | | | GLES 3.1 should be able to bind a texture with the target GL_TEXTURE_2D_MULTISAMPLE. Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: Rename _mesa_lookup_enum_by_nr() to _mesa_enum_to_string().Kenneth Graunke2015-07-201-3/+3
| | | | | | | Generated by sed; no manual changes. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* Revert "mesa: Add ARB_direct_state_access checks in texture functions"Ian Romanick2015-05-281-14/+0
| | | | | | | This reverts commit 8940957238e8584ce27295791cee4cc3d6f7cf1e. Acked-by: Fredrik Höglund <[email protected]> Cc: "10.6" <[email protected]>
* mesa: Add ARB_direct_state_access checks in texture functionsFredrik Höglund2015-05-141-0/+14
| | | | | Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* mesa: remove unneeded #include colortab.hBrian Paul2015-04-281-1/+0
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* Revert "main: _mesa_cube_level_complete checks NumLayers."Laura Ekstrand2015-03-171-4/+0
| | | | | | | | | | | | | | | | | This reverts commit 1ee000a0b6737d6c140d4f07b6044908b8ebfdc7. Failures with the GLES3 conformance suite and Synmark2 OGLHdrBloom revealed that this commit was in error. Extensive testing with Piglit prior to patch review and upstreaming did not reveal this problem because, in the few Piglit tests that test for cube completeness, NumLayers = 6. This is because all of the existing tests use TextureStorage to initialize the texture, which sets NumLayers. A new Piglit test has been sent to the mailing list that reproduces the bug related to this patch ("texturing: Testing glGenerateMipmap(GL_TEXTURE_CUBE_MAP) without glTexStorage2D"). Reviewed-by: Jason Ekstrand <[email protected]>
* main: _mesa_cube_level_complete checks NumLayers.Laura Ekstrand2015-03-091-0/+4
| | | | | | | _mesa_cube_level_complete now verifies that a cube map texture object actually has six texture images before proceeding. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: include stdio.h where neededBrian Paul2015-03-051-0/+1
| | | | | | | Instead of relying on glapi.h or some other header to provide it. Acked-by: Matt Turner <[email protected]> Reviewed-by: José Fonseca <[email protected]>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-7/+7
| | | | Acked-by: Eric Anholt <[email protected]>
* Mesa: Add support for GL_OES_texture_*float* extensions.Kalyan Kondapally2015-01-291-0/+58
| | | | | | | | | | | | | | | | | | | This patch series adds support for following GLES2 Texture Float extensions: 1)GL_OES_texture_float, 2)GL_OES_texture_half_float, 3)GL_OES_texture_float_linear, 4)GL_OES_texture_half_float_linear. This patch adds basic infrastructure and needed boolean flags to advertise support for these extensions, by default the support is disabled. Next patch in the series introduces support for HALF_FLOAT_OES token. v4: take assert away and make valid_filter_for_float conditional (Tapani), fix the alphabetical order (Emil) Signed-off-by: Kevin Rogovin <[email protected]> Signed-off-by: Kalyan Kondapally <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: Returns a GL_INVALID_VALUE error if num of texs in glDeleteTextures is ↵Eduardo Lima Mitev2015-01-131-0/+5
| | | | | | | | | | | | | negative Per GLES3 manual for glDeleteTextures <https://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteTextures.xhtml>, GL_INVALID_VALUE is generated if n is negative. Fixes 1 dEQP test: * dEQP-GLES3.functional.negative_api.texture.deletetextures Reviewed-by: Ian Romanick <[email protected]>
* main: Added _mesa_cube_level_complete to check for the completeness of an ↵Laura Ekstrand2015-01-081-9/+14
| | | | | | arbitrary cube map level. Reviewed-by: Chad Versace <[email protected]>
* main: glDeleteTextures now throws GL_INVALID_VALUE if n is negative.Laura Ekstrand2015-01-081-0/+5
| | | | | | This is in conformance with the OpenGL spec. Reviewed-by: Anuj Phogat <[email protected]>
* main: Nameless texture creation and deletion. Does not affect normal ↵Laura Ekstrand2015-01-081-0/+62
| | | | | | | | | | | | | | | | | | | | creation and deletion paths. In implementing ARB_DIRECT_STATE_ACCESS functions, it is often necessary to abstract the functionality of a traditional GL API function into a backend that both the traditional and dsa API functions can share. For instance, glTexParameteri and glTextureParameteri both call _mesa_texture_parameteri, which takes a context object and a texture object as arguments. The existance of such backend functions provides the opportunity for driver internals (such as meta) to pass around the actual texture object rather than its ID or target, saving on texture object storage and look-up overhead. This patch provides nameless texture creation and deletion for meta. This will be used in an upcoming refactor of meta. Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for BindTextureUnit.Laura Ekstrand2015-01-081-0/+104
| | | | | | | | | | | | | | | | | | | The following preparations were made in texstate.c and texstate.h to better facilitate the BindTextureUnit function: Dylan Noblesmith: mesa: add _mesa_get_tex_unit() mesa: factor out _mesa_max_tex_unit() This is about to appear in a lot more places, so reduce boilerplate copy paste. add _mesa_get_tex_unit_err() checking getter function Reduce boilerplate across files. Laura Ekstrand: Made note of why BindTextureUnit should throw GL_INVALID_OPERATION if the unit is out of range. Added assert(unit > 0) to _mesa_get_tex_unit. Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glCreateTextures.Laura Ekstrand2015-01-081-25/+84
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Moved _mesa_get_current_tex_object from teximage.c to texobj.c.Laura Ekstrand2015-01-081-0/+81
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added utility function _mesa_lookup_texture_err().Laura Ekstrand2015-01-081-0/+16
| | | | | | | | | Most ARB_DIRECT_STATE_ACCESS functions take an object's ID and use it to look up the object in its hash table. If the user passes a fake object ID (ie. a non-generated name), the implementation should throw INVALID_OPERATION. This is a convenience function for texture objects. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: create, use new _mesa_texture_base_format() functionBrian Paul2015-01-051-0/+14
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: whitespace fixes, 80-column wrapping in texobj.cBrian Paul2014-12-121-21/+33
|
* mesa: fix fallback texture for cube map arrayRoland Scheidegger2014-08-301-6/+10
| | | | | | | | | | | | mesa was creating a cube map array texture with just one layer, which is not legal. This caused an assertion failure when using that texture later in llvmpipe (when enabling cube map arrays) since it verifies the number of layers in the view is divisible by 6 (the sampling code might well crash randomly otherwise) with piglit glsl-resource-not-bound CubeArray -fbo -auto. v2: use appropriately sized texel array... Reviewed-by: Ian Romanick <[email protected]> (v1)
* mesa: Implement glBindTexturesFredrik Höglund2014-05-021-0/+120
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add a texUnit parameter to dd_function_table::BindTextureFredrik Höglund2014-05-021-1/+1
| | | | | | | | This is for glBindTextures(), since it doesn't change the active texture unit. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add helper functions for looking up multiple texturesFredrik Höglund2014-05-021-0/+21
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glapi: Add infrastructure for ARB_multi_bindFredrik Höglund2014-05-021-0/+6
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Optimize unbind_texobj_from_texunits()Fredrik Höglund2014-05-021-9/+11
| | | | | | | | | The texture can only be bound to the index that corresponds to its target, so there is no need to loop over all possible indices for every unit and checking if the texture is bound to it. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add a _BoundTextures field in gl_texture_unitFredrik Höglund2014-05-021-0/+6
| | | | | | | | This will be used by glBindTextures() when unbinding textures, to avoid having to loop over all the targets. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Store the target index in gl_texture_objectFredrik Höglund2014-05-021-0/+2
| | | | | | | | This will be used by glBindTextures() so we don't have to look it up for each texture. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Track maximum CurrentTexUnit to reduce glDeleteTextures() overhead.Eric Anholt2014-04-301-1/+3
| | | | | | | | No more walking 96*6 pointers looking to see if they're the current texture, when we only use the first 2 out of 96 units. -6.26002% +/- 1.87817% effect on cairo runtime on no-fbo-cache glamor (n=36). Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Adjust _MaxLevel computation to account for viewsChris Forbes2014-04-101-0/+7
| | | | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Eric Anholt <[email protected]>
* mesa: Add core API support for GL_ARB_stencil_texturing (from 4.3).Kenneth Graunke2014-03-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | While the GL_ARB_stencil_texturing extension does not allow the creation of stencil textures, it does allow shaders to sample stencil values stored in packed depth/stencil textures. Specifically, applications can call glTexParameter* with a pname of GL_DEPTH_STENCIL_TEXTURE_MODE and value of either GL_DEPTH_COMPONENT or GL_STENCIL_INDEX to select which component they wish to sample. The default value is GL_DEPTH_COMPONENT (for traditional depth sampling). Shaders should use an unsigned integer sampler (presumably usampler2D) to access stencil data. Otherwise, results are undefined. Using shadow samplers with GL_STENCIL_INDEX selected also is undefined behavior. This patch creates a new gl_texture_object field, StencilSampling, to indicate that stencil should be sampled rather than depth. (I chose to use a boolean since I figured it would be more convenient for drivers.) It also introduces the [Get]TexParameter code to get and set the value, and of course the extension plumbing. v2: Also consider textures incomplete when sampling stencil with non-NEAREST min/mag filters (caught by Eric Anholt). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>