summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderobj.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa/glsl/i965: remove Driver.NewShader()Timothy Arceri2016-12-301-17/+0
| | | | | | | | | After removing brw_shader in the previous commit this is no longer needed. V2: remove use in src/compiler/glsl/test_optpass.cpp Reviewed-by: Eric Anholt <[email protected]>
* mesa/shaderobj: Fix races on refcountsChad Versace2016-12-281-10/+4
| | | | | | | | | | | | | | | | | | | | | | Use atomic ops when updating gl_shader::RefCount. Fixes intermittent failures and crashes in 'dEQP-EGL.functional.sharing.gles2.multithread.*'. All tests in that group now pass except 'dEQP-EGL.functional.sharing.gles2.multithread.simple_egl_server_sync.textures.copyteximage2d_texsubimage2d_render'. Tested with: mesa: branch 'master' at d6545f2 deqp: branch 'nougat-cts-dev' at 4acf725 with additional local fixes DEQP_TARGET: x11_egl hw: Intel Broadwell 0x1616 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99085 Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Cc: [email protected] Cc: Mark Janes <[email protected]> Cc: Haixia Shi <[email protected]>
* mesa: reset linked_stages bitmask when re-linkingTimothy Arceri2016-12-011-0/+2
| | | | | | | | | | | | | | | 34953f8907fdd added this bitmask but it wasn't being reset when a program was relinked. If a stage was removed from the new program then it could case a crash as we expect the linked shader for that stage to not be null. Fixes crashes in: ESEXT-CTS.tessellation_shader.single.xfb_captures_data_from_correct_stage ES31-CTS.core.tessellation_shader.single.xfb_captures_data_from_correct_stage Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98917
* mesa: use special checksums for unset checksums and fixed-func shadersMarek Olšák2016-11-221-0/+3
| | | | | | for debugging Reviewed-by: Timothy Arceri <[email protected]>
* st/mesa/glsl/nir/i965: make use of new gl_shader_program_data in ↵Timothy Arceri2016-11-191-20/+26
| | | | | | gl_shader_program Reviewed-by: Emil Velikov <[email protected]>
* mesa: create new gl_shader_program_data structTimothy Arceri2016-11-191-0/+39
| | | | | | | | This will be used to share data between gl_program and gl_shader_program allowing for greater code simplification as we can remove a number of awkward uses of gl_shader_program. Reviewed-by: Emil Velikov <[email protected]>
* mesa/glsl: delete previously linked shaders earlier when linkingTimothy Arceri2016-11-031-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves the delete linked shaders call to _mesa_clear_shader_program_data() which makes sure we delete them before returning due to any validation problems. It also reduces some code duplication. From the OpenGL 4.5 Core spec: "If LinkProgram failed, any information about a previous link of that program object is lost. Thus, a failed link does not restore the old state of program. ... If one of these commands is called with a program for which LinkProgram failed, no error is generated unless otherwise noted. Implementations may return information on variables and interface blocks that would have been active had the program been linked successfully. In cases where the link failed because the program required too many resources, these commands may help applications determine why limits were exceeded." Therefore it's expected that we shouldn't be able to query the program that failed to link and retrieve information about a previously successful link. Before this change the linker was doing validation before freeing the previously linked shaders and therefore could exit on failure before they were freed. This change also fixes an issue in compat profile where a program with no shaders attached is expect to fall back to fixed function but was instead trying to relink IR from a previous link. Reviewed-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97715 Cc: "13.0" <[email protected]>
* mesa/main: add support for ARB_compute_variable_groups_sizeSamuel Pitoiset2016-10-071-0/+2
| | | | | | | | | | | | | v5: - replace fixed_local_size by !LocalSizeVariable (Nicolai) v4: - slightly indent spec quotes (Nicolai) - drop useless _mesa_has_compute_shaders() check (Nicolai) - move the fixed local size outside of the loop (Nicolai) - add missing check for invalid use of work group count v2: - update formatting spec quotations (Ian) - move the total_invocations check outside of the loop (Ian) Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/glsl: Move string_to_uint_map into the util folderThomas Helland2016-09-121-1/+1
| | | | | | | | | | This clears the last bits of the usecases of the hash table located in mesa/program, allowing us to remove it. V2: Rebase on top of changes to Makefile.sources Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl/mesa: move duplicate shader fields into new struct gl_shader_infoTimothy Arceri2016-06-301-3/+3
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl/main: remove unused params and make function staticTimothy Arceri2016-06-301-4/+4
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl/mesa: split gl_shader in twoTimothy Arceri2016-06-301-3/+29
| | | | | | | | | | | | | | | | | There are two distinctly different uses of this struct. The first is to store GL shader objects. The second is to store information about a shader stage thats been linked. The two uses actually share few fields and there is clearly confusion about their use. For example the linked shaders map one to one with a program so can simply be destroyed along with the program. However previously we were calling reference counting on the linked shaders. We were also creating linked shaders with a name even though it is always 0 and called the driver version of the _mesa_new_shader() function unnecessarily for GL shader objects. Acked-by: Iago Toral Quiroga <[email protected]>
* glsl/mesa: stop duplicating geom and tcs layout valuesTimothy Arceri2016-06-231-3/+3
| | | | | | | | | | | | We already store these in gl_shader and gl_program here we remove it from gl_shader_program and just use the values from gl_shader. This will allow us to keep the shader cache restore code as simple as it can be while making it somewhat clearer where these values originate from. Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa/glsl: stop using GL shader type internallyTimothy Arceri2016-06-161-4/+2
| | | | | | | | | | | | Instead use the internal gl_shader_stage enum everywhere. This makes things more consistent and gets rid of unnecessary conversions. Ideally it would be nice to remove the Type field from gl_shader altogether but currently it is used to differentiate between gl_shader and gl_shader_program in the ShaderObjects hash table. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Use Geom.VerticesOut == -1 to specify unsetIan Romanick2016-06-011-1/+1
| | | | | | | | | Because apparently layout(max_vertices=0) is a thing. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0" <[email protected]>
* glsl: fully split apart buffer block arraysTimothy Arceri2016-04-061-3/+7
| | | | | | | | | | | | With this change we create the UBO and SSBO arrays separately from the beginning rather than putting them into a combined array and splitting it apart later. A bug is with UBO and SSBO stage reference querying is also fixed as we now use the block index to lookup the references in the separate arrays not the combined buffer block array. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: store stage reference in gl_uniform_blockTimothy Arceri2016-04-021-4/+0
| | | | | | | | | This allows us to simplify the code and drop InterfaceBlockStageIndex which is a per stage array of integers the size of all blocks in the program combined including duplicates across stages. Adding a stage ref per block will use less memory. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Initialize gl_shader_program::EmptyUniformLocations.Matt Turner2016-03-011-0/+2
| | | | | | | | | Commit 65dfb30 added exec_list EmptyUniformLocations, but only initialized the list if ARB_explicit_uniform_location was enabled, leading to crashes if the extension was not available. Cc: "11.2" <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: rename UniformBlockStageIndex to InterfaceBlockStageIndexJordan Justen2015-11-031-2/+2
| | | | | | | | Signed-off-by: Jordan Justen <[email protected]> Cc: Samuel Iglesias Gonsálvez <[email protected]> Cc: Iago Toral <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Juha-Pekka Heikkila <[email protected]>
* mesa: Rename {Num}UniformBlocks to {Num}BufferInterfaceBlocksIago Toral Quiroga2015-10-141-2/+2
| | | | | | | | | | | | | | Currently, these arrays in gl_shader and gl_shader_program hold both UBOs and SSBOs, so this looks like a better name. We were already using NumBufferInterfaceBlocks in gl_shader_program, so this makes things more consistent as well. In a later patch we will add {Num}UniformBlocks and {Num}ShaderStorageBlocks which will contain only references to UBOs and SSBOs respectively that will provide backends with a separate index space for both types of objects. Reviewed-by: Kristian Høgsberg <[email protected]>
* mesa: remove Driver.DeleteShaderProgramMarek Olšák2015-10-031-5/+4
| | | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove Driver.NewShaderProgramMarek Olšák2015-10-031-3/+1
| | | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove Driver.DeleteShaderMarek Olšák2015-10-031-5/+3
| | | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: rename gl_shader_program's NumUniformBlocks to NumBufferInterfaceBlocksSamuel Iglesias Gonsalvez2015-09-291-1/+1
| | | | | | | | | | | Because it counts shader storage blocks too. v2: - Use NumBufferInterfaceBlocks instead (Jordan). Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* mesa: Remove debugging code from _mesa_reference_*.Matt Turner2015-09-251-12/+0
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: reference built-in uniforms into gl_uniform_storageMartin Peres2015-06-041-2/+2
| | | | | | | | | | | | | | | This change introduces a new field in gl_uniform_storage to explicitely say that a uniform is built-in. In the case where it is, no storage is defined to make it clear that it is read-only from the mesa side. I fixed all the places in the code that made use of the structure that I changed. Any place making a wrong assumption and using the storage straight away will just crash. This patch seems to implement the path of least resistance towards listing built-in uniforms in GL_ACTIVE_UNIFORM (and other APIs). Reviewed-by: Tapani Pälli <[email protected]> Signed-off-by: Martin Peres <[email protected]>
* mesa/glsl: build list of program resources during linkingTapani Pälli2015-04-161-0/+6
| | | | | | | | | | | | | | | | Patch adds ProgramResourceList to gl_shader_program structure. List contains references to active program resources and is constructed during linking phase. This list will be used by follow-up patches to implement hooks for GL_ARB_program_interface_query. It can be also used to implement any of the older shader program query APIs. v2: code cleanups + note for SSBO and subroutines (Ilia Mirkin) v3: code cleanups + assert(MESA_SHADER_STAGES < 8) (Martin Peres) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Martin Peres <[email protected]>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-2/+2
| | | | Acked-by: Eric Anholt <[email protected]>
* mesa: make _mesa_reference_shader_program() an inline functionBrian Paul2015-01-051-3/+3
| | | | | | | which wraps _mesa_reference_shader_program_(), similar to what we do for other reference-counted objects. Reviewed-by: Eric Anholt <[email protected]>
* mesa: Remove context parameter from dd_function_table::NewShaderProgramIan Romanick2014-10-241-1/+1
| | | | | | | | | | This fixes some unused parameter warnings introduced by the previous commit. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Make _mesa_init_shader_program staticIan Romanick2014-10-241-3/+3
| | | | | | | | | | Since a couple commits ago, there is only one caller, and that caller is in the same file. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Remove context parameter from _mesa_init_shader_programIan Romanick2014-10-241-2/+2
| | | | | | | | | | | | | | | Silences: ../../src/mesa/main/shaderobj.c: In function '_mesa_init_shader_program': ../../src/mesa/main/shaderobj.c:239:46: warning: unused parameter 'ctx' [-Wunused-parameter] For now, this adds a couple other unused parameter warnings, but future patches will clean those up. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Silence unused parameter warning in _mesa_clear_shader_program_dataIan Romanick2014-10-241-3/+2
| | | | | | | | | Just remove the parameter. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Add some missing clean-up to _mesa_clear_shader_program_dataIan Romanick2014-10-241-1/+14
| | | | | | | | | All of this is already done in link_shaders. More clean-ups coming. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* util: Move ralloc to a new src/util directory.Kenneth Graunke2014-08-041-1/+1
| | | | | | | | | | | | | | | | | | For a long time, we've wanted a place to put utility code which isn't directly tied to Mesa or Gallium internals. This patch creates a new src/util directory for exactly that purpose, and builds the contents as libmesautil.la. ralloc seemed like a good first candidate. These days, it's directly used by mesa/main, i965, i915, and r300g, so keeping it in src/glsl didn't make much sense. Signed-off-by: Kenneth Graunke <[email protected]> v2 (Jason Ekstrand): More realloc uses and some scons fixes Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* glsl: Store info about geometry shaders that emit vertices to non-zero streams.Iago Toral Quiroga2014-06-301-0/+1
| | | | | | | | | | | On Intel hardware when a geometry shader outputs GL_POINTS primitives we only need to emit vertex control bits if it emits vertices to non-zero streams, so use a flag to track this. This flag will be set to TRUE when a geometry shader calls EmitStreamVertex() or EndStreamPrimitive() with a non-zero stream parameter in a later patch. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Make Geom.UsesEndPrimitive a bool instead of a GLbooleanIago Toral Quiroga2014-06-231-1/+1
|
* mesa: Init Geom.UsesEndPrimitive in shader programs.Iago Toral Quiroga2014-06-201-0/+1
| | | | Reviewed-by: Ian Romanick <[email protected]>
* mesa/glsl: introduce a remap table for uniform locationsTapani Pälli2014-03-101-1/+6
| | | | | | | | | | | | | | | | | Patch adds a remap table for uniforms that is used to provide a mapping from application specified uniform location to actual location in the UniformStorage. Existing UniformLocationBaseScale usage is removed as table can be used to set sequential values for array uniform elements. This mapping helps to implement GL_ARB_explicit_uniform_location so that uniforms locations can be reorganized and handled in a more easy manner. v2: small fixes + rename parameters for merge and split functions (Ian) improve documentation, remove old check for location bounds (Eric) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* main: Avoid double-free of shader LabelCarl Worth2014-02-141-0/+1
| | | | | | | | | | | | | | | | | | | As documented, the _mesa_free_shader_program_data function: "Frees all the data that hangs off a shader program object, but not the object itself." This means that this function may be called multiple times on the same object, (and has been observed to). Meanwhile, the shProg->Label field was not being set to NULL after its free(). This led to a second call to free() of the same address on the second call to this function. Fix this by setting this field to NULL after free(), (just as with all other calls to free() in this function). Reviewed-by: Brian Paul <[email protected]> CC: [email protected]
* mesa: use _mesa_validate_shader_target() more frequently.Paul Berry2014-01-211-2/+2
| | | | | | | | | | | | | This patch replaces code in _mesa_new_shader() and delete_shader_cb() that checks the type of a shader with calls to _mesa_validate_shader_target(). This has two advantages: it allows for a more thorough check (since _mesa_validate_shader_target() doesn't permit shader targets that aren't supported by the back-end), and it reduces the amount of code that will need to be modified when adding new shader stages. Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Store gl_shader_stage enum in gl_shader objects.Paul Berry2014-01-081-0/+1
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Clean up nomenclature for pipeline stages.Paul Berry2014-01-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we had an enum called gl_shader_type which represented pipeline stages in the order they occur in the pipeline (i.e. MESA_SHADER_VERTEX=0, MESA_SHADER_GEOMETRY=1, etc), and several inconsistently named functions for converting between it and other representations: - _mesa_shader_type_to_string: gl_shader_type -> string - _mesa_shader_type_to_index: GLenum (GL_*_SHADER) -> gl_shader_type - _mesa_program_target_to_index: GLenum (GL_*_PROGRAM) -> gl_shader_type - _mesa_shader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string This patch tries to clean things up so that we use more consistent terminology: the enum is now called gl_shader_stage (to emphasize that it is in the order of pipeline stages), and the conversion functions are: - _mesa_shader_stage_to_string: gl_shader_stage -> string - _mesa_shader_enum_to_shader_stage: GLenum (GL_*_SHADER) -> gl_shader_stage - _mesa_program_enum_to_shader_stage: GLenum (GL_*_PROGRAM) -> gl_shader_stage - _mesa_progshader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string In addition, MESA_SHADER_TYPES has been renamed to MESA_SHADER_STAGES, for consistency with the new name for the enum. Reviewed-by: Kenneth Graunke <[email protected]> v2: Also rename the "target" field of _mesa_glsl_parse_state and the "target" parameter of _mesa_shader_stage_to_string to "stage". Reviewed-by: Brian Paul <[email protected]>
* mesa: free object labels when deletingTimothy Arceri2013-09-041-0/+3
| | | | | | Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glsl: Add gl_shader_program::UniformLocationBaseScaleIan Romanick2013-06-121-0/+1
| | | | | | | | | | | | | | | | This is used by _mesa_uniform_merge_location_offset and _mesa_uniform_split_location_offset to determine how the base and offset are packed. Previously, this value was hard coded as (1U<<16) in those functions via the shift and mask contained therein. The value is still (1U<<16), but it can be changed in the future. The next patch dynamically generates this value. NOTE: This is a candidate for stable release branches. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-and-tested-by: Chad Versace <[email protected]>
* mesa: Restore 78-column wrapping of license text in C-style comments.Kenneth Graunke2013-04-231-3/+4
| | | | | | | | | | | | | | The previous commit introduced extra words, breaking the formatting. This text transformation was done automatically via the following shell command: $ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript where 'vimscript' is a file containing: /THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/\*\// !fmt -w 78 -p ' * ' :wq Reviewed-by: Brian Paul <[email protected]>
* mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | This brings the license text in line with the MIT License as published on the Open Source Initiative website: http://opensource.org/licenses/mit-license.php Generated automatically be the following shell command: $ git grep 'THE AUTHORS BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/THE AUTHORS/THE AUTHORS OR COPYRIGHT HOLDERS/' {} This introduces some wrapping issues, to be fixed in the next commit. Reviewed-by: Brian Paul <[email protected]>
* mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | | Generated automatically be the following shell command: $ git grep 'BRIAN PAUL BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/BRIAN PAUL/THE AUTHORS/' {} The intention here is to protect all authors, not just Brian Paul. I believe that was already the sensible interpretation, but spelling it out is probably better. More practically, it also prevents people from accidentally copy & pasting the license into a new file which says Brian is not liable when he isn't even one of the authors. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove #include "mfeatures.h" from numerous source filesBrian Paul2013-04-171-1/+0
| | | | | | None of the remaining FEATURE_x symbols in mfeatures.h are used anymore. Reviewed-by: Jordan Justen <[email protected]>
* mesa: Set transform feedback's default buffer mode to INTERLEAVED_ATTRIBSMatt Turner2012-11-271-0/+2
| | | | | | | Fixes part of es3conform's transform_feedback_init_defaults test. NOTE: This is a candidate for the stable branch. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>