aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texstate.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "mesa: do not trigger _NEW_TEXTURE_STATE in glActiveTexture()"Samuel Pitoiset2018-03-151-0/+13
| | | | | | | | | | | | | | | | This reverts commit f314a532fdc7af8381586144d2631d9968331f05. This appears to introduce some blinking textures in UT2004. Not sure exactly what's the root cause because we don't have much information about the issue. Anyway, this was just a micro optimization that actually breaks, at least, one app almost one year later. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105436 Cc: <[email protected]> Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: decrease the array size of ctx->Texture.FixedFuncUnit to 8Marek Olšák2018-02-131-1/+1
| | | | | | | | | | GL allows doing glTexEnv on 192 texture units, while in reality, only MaxTextureCoordUnits units are used by fixed-func shaders. There is a piglit patch that adjusts piglits/texunits to check only MaxTextureCoordUnits units. Reviewed-by: Brian Paul <[email protected]>
* mesa: separate legacy stuff from gl_texture_unit into gl_fixedfunc_texture_unitMarek Olšák2018-02-131-35/+48
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: inline init_texture_unitMarek Olšák2018-02-131-51/+39
| | | | | | because this is going to be changed Reviewed-by: Brian Paul <[email protected]>
* mesa: add fallback texture for SampleMapATI if there is nothingMiklós Máté2017-12-251-0/+30
| | | | | | | | | | | This fixes crash in the state tracker. Piglit: spec/ati_fragment_shader/render-notexture v2: fixed formatting, moved stuff inside the loop, moved the fallback later to fix more cases Signed-off-by: Miklós Máté <[email protected]>
* Revert "mesa: fix texture updates for ATI_fragment_shader"Marek Olšák2017-10-171-5/+3
| | | | | | | | This reverts commit 9d54025cd1eee3f42b80c062d1f644904bf2ba41. It breaks KOTOR. Cc: 17.1 17.2 <[email protected]>
* mesa: remove redundant NULL check in update_single_program_texture_stateMiklós Máté2017-10-171-2/+0
| | | | | | | | update_single_program_texture() never returns NULL. Signed-off-by: Miklós Máté <[email protected]> Signed-off-by: Marek Olšák <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: fix texture updates for ATI_fragment_shaderMarek Olšák2017-09-281-3/+5
| | | | | | Cc: 17.1 17.2 <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: don't flush vertices in glClientActiveTextureMarek Olšák2017-06-231-1/+1
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: do not trigger _NEW_TEXTURE_STATE in glActiveTexture()Samuel Pitoiset2017-06-231-2/+0
| | | | | | | | This looks like useless because gl_context::Texture::CurrentUnit is not used by _mesa_update_texture_state() and friends. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: simplify a loop in _mesa_update_texture_stateMarek Olšák2017-06-221-7/+1
| | | | | | Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: replace VP/FP/ATIfs _Enabled flags with helper functionsMarek Olšák2017-06-221-1/+3
| | | | | | | | These are only used in the GL compatibility profile. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: update textures for bindless samplers bound to texture unitsSamuel Pitoiset2017-06-141-1/+17
| | | | | | | | This is analogous to the existing SamplerUnits and SamplerTargets, but it loops over bindless samplers bound to texture units. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: add update_single_program_texture_state() helperSamuel Pitoiset2017-06-141-13/+23
| | | | | | | | This will also be used for looping over bindless samplers bound to texture units. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: add KHR_no_error support for glActiveTexture()Samuel Pitoiset2017-05-291-11/+25
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: use u_bit_scan() in update_program_texture_state()Samuel Pitoiset2017-05-101-9/+5
| | | | | | | | | | The check in update_single_program_texture() can also be removed. v2: - remove unused 's' variable Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/main: Maintain compressed TexEnv Combine state.Gustaw Smolarczyk2017-04-081-0/+103
| | | | | Signed-off-by: Gustaw Smolarczyk <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* mesa: small texstate tidy upTimothy Arceri2017-04-061-4/+5
| | | | | | | | Possibly more efficient, either way it makes the code easier to follow. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: don't use _NEW_TEXTURE mainly in mesa/mainMarek Olšák2017-03-291-5/+6
| | | | | | | | v2: add missing %s Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: split _NEW_TEXTURE into _NEW_TEXTURE_OBJECT & _NEW_TEXTURE_STATEMarek Olšák2017-03-291-1/+1
| | | | | | | | | | | | No performance testing has been done, because it makes sense to make this change regardless of that. Also, _NEW_TEXTURE is still used in many places, but the obvious occurences are replaced here. It's now possible to split _NEW_TEXTURE_OBJECT further. Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: inline _mesa_update_textureMarek Olšák2017-03-291-18/+4
| | | | | | Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: use gl_program for CurrentProgram rather than gl_shader_programTimothy Arceri2017-01-231-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes much more sense and should be more performant in some critical paths such as SSO validation which is called at draw time. Previously the CurrentProgram array could have contained multiple pointers to the same struct which was confusing and we would often need to fish out the information we were really after from the gl_program anyway. Also it was error prone to depend on the _LinkedShader array for programs in current use because a failed linking attempt will lose the infomation about the current program in use which is still valid. V2: fix validate_io() to compare linked_stages rather than the consumer and producer to decide if we are looking at inward facing shader interfaces which don't need validation. Acked-by: Edward O'Callaghan <[email protected]> To avoid build regressions the following 2 patches were squashed in to this commit: mesa/meta: rewrite _mesa_shader_program_use() and _mesa_program_use() These are rewritten to do what the function name suggests, that is _mesa_shader_program_use() sets the use of all stage and _mesa_program_use() sets the use of a single stage. Reviewed-by: Lionel Landwerlin <[email protected]> Acked-by: Edward O'Callaghan <[email protected]> mesa: update active relinked program This likely fixes a subroutine bug were _mesa_shader_program_init_subroutine_defaults() would never have been called for the relinked program as we previously just set _NEW_PROGRAM as dirty and never called the _mesa_use* functions when linking. Acked-by: Edward O'Callaghan <[email protected]>
* st/mesa/glsl/nir/i965: make use of new gl_shader_program_data in ↵Timothy Arceri2016-11-191-1/+1
| | | | | | gl_shader_program Reviewed-by: Emil Velikov <[email protected]>
* r200/i915/st/mesa/compiler: use common inputs read fieldTimothy Arceri2016-10-261-1/+1
| | | | | | | | | | | | And set set inputs_read directly in shader_info. To avoid regressions between changes this change is a squashed version of the following patches. st/mesa changes where: Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa/r200/i915/i965: eliminate gl_fragment_programTimothy Arceri2016-10-261-1/+1
| | | | | | | | | | Here we move OriginUpperLeft and PixelCenterInteger into gl_program all other fields have been replace by shader_info. V2: Don't use anonymous union/structs to hold vertex/fragment fields suggested by Ian. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Use bitmask/ffs to iterate the enabled textures.Mathias Fröhlich2016-06-161-15/+16
| | | | | | | | | | | Replaces an iterate and test bit in a bitmask loop by a loop only iterating over the bits set in the bitmask. v2: Use _mesa_bit_scan{,64} instead of open coding. v3: Use u_bit_scan{,64} instead of _mesa_bit_scan{,64}. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* mesa: Use designated bool value to check texture unit completeness.Mathias Fröhlich2016-06-161-1/+4
| | | | | | | The change helps to use the bitmask/ffs in the next change. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* mesa: remove _ARB suffix from cube map enumsBrian Paul2016-02-121-1/+1
| | | | | | | Just minor clean-up so we're consistent everywhere. Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: report enum name in glClientActiveTexture() error stringBrian Paul2015-11-051-1/+2
| | | | As we do for glActiveTexture(). Trivial.
* mesa: Get rid of texture-dependent image unit derived state.Francisco Jerez2015-10-091-3/+0
| | | | | | | | | | | | | | The point is to avoid having to re-validate all image units when _NEW_TEXTURE is flagged, which can be expensive if the driver exposes a large number of image units. This has been reported to fix a 36% performance regression in the Synmark2 Multithread benchmark on the i965 driver which exposes 192 image units. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91788 Reported-by: Wendy Wang <[email protected]> Tested-by: Ye Tian <[email protected]> CC: "11.0" <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: handle no-op cases sooner in _mesa_[Client]ActiveTexture()Brian Paul2015-08-061-10/+10
| | | | | | | If the new texture unit is the current texture unit, we can return before error checking. Reviewed-by: Eric Anholt <[email protected]>
* mesa: Rename _mesa_lookup_enum_by_nr() to _mesa_enum_to_string().Kenneth Graunke2015-07-201-18/+18
| | | | | | | Generated by sed; no manual changes. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove unneeded #include of colormac.hBrian Paul2015-04-011-2/+0
| | | | | Acked-by: Matt Turner <[email protected]> Reviewed-by: Mark Janes <[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/main: replace Elements() with ARRAY_SIZE()Brian Paul2015-03-021-8/+8
| | | | | | | | We've been using a mix of these two macros for a while now. Let's just use the later everywhere. It seems to be the convention used by other open-source projects. Acked-by: Ilia Mirkin <[email protected]>
* mesa: Fix ctx->Texture.CubeMapSeamlessIago Toral Quiroga2015-02-241-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The intel driver code, and apparently all other Mesa drivers, call _mesa_initialize_context early in the CreateContext hook. That function will end up calling _mesa_init_texture which will do: ctx->Texture.CubeMapSeamless = _mesa_is_gles3(ctx); But this won't work at this point, since _mesa_is_gles3 requires ctx->Version to be set and that will not happen until late in the CreateContext hook, when _mesa_compute_version is called. We can't just move the call to _mesa_compute_version before _mesa_initialize_context since it needs that available extensions have been computed, which again requires other things to be initialized, etc. Instead, we enable seamless cube maps since GLES2, which should work for most implementations, and expect drivers that don't support this to disable it manually as part of their context initialization setup. Fixes the following 192 dEQP tests: dEQP-GLES3.functional.texture.filtering.cube.formats.* dEQP-GLES3.functional.texture.filtering.cube.sizes.* dEQP-GLES3.functional.texture.filtering.cube.combinations.* dEQP-GLES3.functional.texture.mipmap.cube.* dEQP-GLES3.functional.texture.vertex.cube.filtering.* dEQP-GLES3.functional.texture.vertex.cube.wrap.* dEQP-GLES3.functional.shaders.texture_functions.texturelod.samplercube_fixed_* Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-5/+5
| | | | Acked-by: Eric Anholt <[email protected]>
* util: Move Mesa's bitset.h to util/.Eric Anholt2015-02-201-1/+1
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* main: Added entry point for BindTextureUnit.Laura Ekstrand2015-01-081-3/+1
| | | | | | | | | | | | | | | | | | | 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: Removed trailing whitespaces in texture code.Laura Ekstrand2015-01-081-9/+9
| | | | | | | | main: Removed trailing whitespace in texstate.c. main: Deleted trailing whitespaces in texobj.c. main: Fixed whitespace errors in teximage.h and teximage.c. Reviewed-by: Anuj Phogat <[email protected]>
* Remove the ATI_envmap_bumpmap extensionJason Ekstrand2014-06-301-15/+0
| | | | | | | | | | | As far as I can tell, the Intel mesa driver is the only driver in the world still supporting this legacy extension. If someone wants to do bump mapping, they can use shaders. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> [v1] Reviewed-by: Chris Forbes <[email protected]> [v2] Reviewed-by: Ian Romanick <[email protected]> [v3]
* mesa: Add a _BoundTextures field in gl_texture_unitFredrik Höglund2014-05-021-0/+3
| | | | | | | | 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: Move declaration to top of block.José Fonseca2014-05-011-1/+2
| | | | To fix MSVC build. Trivial.
* mesa: Track maximum CurrentTexUnit to reduce glDeleteTextures() overhead.Eric Anholt2014-04-301-0/+6
| | | | | | | | 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: Rewrite shader-based texture image state updates.Eric Anholt2014-04-301-49/+73
| | | | | | | | | | | Instead of walking 6 shader stages for each of the 96 combined texture image units, now we just walk the samplers used in each shader stage. With cairo-perf-trace on Xephyr with glamor, I'm seeing a -6.50518% +/- 2.55601% effect on runtime (n=22) since the "drop _EnabledUnits" change. No significant performance difference on an apitrace of minecraft (n=442). Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Split the shader texture update logic from fixed function.Eric Anholt2014-04-301-90/+160
| | | | | | | | | | | | I want to avoid walking the entire long array texture image units, but the obvious way to do so means walking program samplers, and thus hitting the units in a random order. This change replaces the previous behavior of only setting up the fallback texture for a fragment shader with setting up the fallback texture for any shader that's missing a complete texture of the right target in its unit. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Finish removing the _ReallyEnabled field.Eric Anholt2014-04-301-5/+1
| | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Replace use of _ReallyEnabled as a boolean with use of _Current.Eric Anholt2014-04-301-1/+1
| | | | | | | | | | | | | I'm probably not the only person that has tried to kill _ReallyEnabled. This does the mechanical part of the work, and cleans _ReallyEnabled from i965. I think that using _Current makes texture management clearer: You can't have multiple targets in use in the same texture image unit at the same time, because there's just that one pointer. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Ensure that (unit->_Current != 0) == (unit->_ReallyEnabled != 0).Eric Anholt2014-04-301-0/+2
| | | | | | | | I'm going to try to delete _ReallyEnabled, which is this weird bitfield with either 0 or 1 bits set with just the reference to _Current. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Drop _EnabledUnits.Eric Anholt2014-04-301-4/+0
| | | | | | | | | | | The field wasn't really valid, since we've got more than 32 units now. It turns out it was mostly just used for checking != 0, or checking for fixed function coordinates, though. v2: Fix mis-conversion in xm_line.c (caught by Ken). Reviewed-by: Matt Turner <[email protected]> (v1) Reviewed-by: Kenneth Graunke <[email protected]>