summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: fix duplicated layout qualifier detection for GSSamuel Iglesias Gonsalvez2014-07-031-6/+16
| | | | | | | | | | | | This patch fixes the duplicated layout qualifier detection for geometry shader's layout qualifiers. Also it makes the detection code more legible by defining allowed_duplicates_mask variable. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80778 Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: add support for AMD_vertex_shader_viewport_indexIlia Mirkin2014-07-024-0/+8
| | | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Tested-by: Tobias Droste <[email protected]>
* mesa: Make unreachable macro take a string argument.Matt Turner2014-07-011-2/+1
| | | | | | To aid in debugging. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Remove now unused foreach_list* macros.Matt Turner2014-07-011-24/+0
| | | | | | foreach_list_typed_const was never used as far as I can tell. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add and use foreach_list_typed_safe.Matt Turner2014-07-011-0/+9
| | | | Acked-by: Ian Romanick <[email protected]>
* mesa: Add and use foreach_in_list_use_after.Matt Turner2014-07-011-0/+5
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Replace uses of foreach_list_const.Matt Turner2014-07-012-17/+6
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Replace another couple uses of foreach_list.Matt Turner2014-07-011-6/+4
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use foreach_list_typed when possible.Matt Turner2014-07-013-31/+18
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use typed foreach_in_list_safe instead of foreach_list_safe.Matt Turner2014-07-0120-87/+41
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use typed foreach_in_list instead of foreach_list.Matt Turner2014-07-0139-291/+184
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add typed foreach_in_list_safe macro.Matt Turner2014-07-011-0/+9
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add typed foreach_in_list/_reverse macros.Matt Turner2014-07-011-0/+10
| | | | Reviewed-by: Ian Romanick <[email protected]>
* Remove the ATI_envmap_bumpmap extensionJason Ekstrand2014-06-301-12/+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]
* glsl: include streamId when reading/printing ir_variable IR.Samuel Iglesias Gonsalvez2014-06-302-2/+11
| | | | | | Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: include streamId when reading/printing emit-vertex and end-primitive IR.Iago Toral Quiroga2014-06-302-8/+27
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Validate vertex emission in geometry shaders.Iago Toral Quiroga2014-06-301-14/+134
| | | | | | | Check if non-zero streams are used. Fail to link if emitting to unsupported streams or emitting to non-zero streams with output type other than GL_POINTS. Reviewed-by: Chris Forbes <[email protected]>
* glsl: Add support for EmitStreamVertex() and EndStreamPrimitive().Iago Toral Quiroga2014-06-301-0/+58
| | | | Reviewed-by: Chris Forbes <[email protected]>
* glsl: Modify ir_end_primitive to have a stream.Iago Toral Quiroga2014-06-307-16/+64
| | | | | | | This will be necessary to implement EndStreamPrimitive(). EndPrimitive() will produce an ir_end_primitive with the default stream 0. Reviewed-by: Chris Forbes <[email protected]>
* glsl: Modify ir_emit_vertex to have a stream.Iago Toral Quiroga2014-06-3010-21/+68
| | | | | | | This will be necessary to implement EmitStreamVertex(). EmitVertex() will produce an ir_emit_vertex with the default stream 0. Reviewed-by: Chris Forbes <[email protected]>
* glsl: Only geometry shader outputs can be associated with non-zero streams.Iago Toral Quiroga2014-06-301-0/+5
| | | | | | | This should be ensured by the parser, so assert on that. Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Two varyings can't write to the same buffer from different streams.Iago Toral Quiroga2014-06-301-0/+17
| | | | | | | If this is detected, fail to link. Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add methods to retrive a varying's name and streamId.Iago Toral Quiroga2014-06-301-0/+10
| | | | | Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Fail to link if inter-stage input/outputs are not assigned to stream 0Iago Toral Quiroga2014-06-301-0/+8
| | | | | | | Outputs that are linked to inputs in the next stage must be output to stream 0, otherwise we should fail to link. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Assign GLSL StreamIds to transform feedback outputs.Iago Toral Quiroga2014-06-302-3/+16
| | | | | | Inter-shader outputs must be on stream 0, which is the default. Reviewed-by: Chris Forbes <[email protected]>
* mesa: add StreamId information to transform feedback outputs.Iago Toral Quiroga2014-06-301-0/+1
| | | | | | | For now initialized to the default stream 0. Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add parsing support for multi-stream output in geometry shaders.Samuel Iglesias Gonsalvez2014-06-307-1/+144
| | | | | | | | This implements parsing requirements for multi-stream support in geometry shaders as defined in ARB_gpu_shader5. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add missing null check in push_back()Juha-Pekka Heikkila2014-06-261-2/+11
| | | | | | | Report memory error on realloc failure and don't leak any memory. Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: check _mesa_hash_table_create return value in link_uniform_blocksJuha-Pekka Heikkila2014-06-262-0/+8
| | | | | Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Treat an interface block specifier as a level of struct nestingChris Forbes2014-06-261-0/+8
| | | | | | | | | Fixes the piglit test: spec/glsl-1.50/compiler/interface-blocks-structs-defined-within-block-instanced.vert Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Disallow primitive type layout qualifier on variables.Chris Forbes2014-06-261-0/+7
| | | | | | | | | | | | | | | | This only makes any sense on the GS input or output layout declaration, nowhere else. Fixes the piglit tests: * spec/glsl-1.50/compiler/incorrect-in-layout-qualifiers-with-variable-declarations.geom * spec/glsl-1.50/compiler/incorrect-out-layout-qualifiers-with-variable-declarations.geom * spec/glsl-1.50/compiler/layout-fs-no-output.frag * spec/glsl-1.50/compiler/layout-vs-no-input.vert * spec/glsl-1.50/compiler/layout-vs-no-output.vert Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Relax combinations of layout qualifiers with other qualifiers.Chris Forbes2014-06-261-28/+8
| | | | | | | | | | | | | | | | | | | Previously we disallowed any combination of layout with interpolation, invariant, or precise qualifiers. There is very little spec guidance on exactly which combinations should be allowed, but with ARB_sso it's useful to allow these qualifiers with rendezvous-by-location. Since it's unclear exactly where the layout qualifier should appear when combined with other qualifiers, we will allow it anywhere before the auxiliary storage qualifier. This allows enough flexibility for all examples I've seen, while keeping the auxiliary-storage-qualifier / storage-qualifier pair together (as they are a single qualifier in the spec prior to ARB_shading_language_420pack) Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Don't convert reductions of ivec to a dot-productIan Romanick2014-06-251-1/+3
| | | | | | | | | | | | | | | | | | Mesa has an optimization that converts expressions like "v.x + v.y + v.z + v.w" into dot(v, 1.0). And therein lies the rub: the other operand to the dot-product is always a float... even if the vector is an ivec or uvec. This results in an assertion failure in ir_builder. If the base type of the operand is not float, don't try the optimization. Dot-product is not valid on integer data. Fixes piglit vs-integer-reduction.shader_test and OpenGL ES conformance test ES2-CTS.gtf.GL2Tests.glGetUniform.glGetUniform. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Christoph Brill <[email protected]>
* glsl: Silence many unused parameter warningsIan Romanick2014-06-231-1/+1
| | | | | | | | In file included from ../../src/glsl/builtin_functions.cpp:61:0: ../../src/glsl/glsl_parser_extras.h:154:9: warning: unused parameter 'var' [-Wunused-parameter] Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* Partially revert "glsl: Add builtin define for ARB_fragment_layer_viewport"Chris Forbes2014-06-221-0/+6
| | | | | This partially reverts commit cc18b1ec2161c846109e921d7821dfeef7a06f3a, which dropped some unrelated code due to a fumbled rebase.
* glsl: Add gl_Layer and gl_ViewportIndex builtins to fragment shaderChris Forbes2014-06-221-0/+5
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add builtin define for ARB_fragment_layer_viewportChris Forbes2014-06-221-6/+3
| | | | | | | | The spec doesn't actually mention adding this, but this is the usual pattern so I'm assuming it's a spec bug. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add extension plumbing for ARB_fragment_layer_viewportChris Forbes2014-06-223-0/+4
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Optimize (v.x + v.y) + (v.z + v.w) into dot(v, 1.0).Matt Turner2014-06-191-0/+46
| | | | Cuts five instructions out of SynMark's Gl32VSInstancing benchmark.
* glsl: Pass in options to do_algebraic().Matt Turner2014-06-194-6/+12
| | | | | | Will be used in the next commit. Reviewed-by: Eric Anholt <[email protected]>
* glsl: Rebalance expression trees that are reduction operations.Matt Turner2014-06-194-0/+303
| | | | | | | | | | The intention of this pass was to give us better instruction scheduling opportunities, but it unexpectedly reduced some instruction counts as well: total instructions in shared programs: 1666639 -> 1666073 (-0.03%) instructions in affected programs: 54612 -> 54046 (-1.04%) (and trades 4 SIMD16 programs in SS3)
* glsl: Remove 'struct' from ir_variable declaration.Matt Turner2014-06-171-1/+1
| | | | | Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: type check between switch init-expression and caseTapani Pälli2014-06-171-3/+45
| | | | | | | | | | | Patch adds a type check between switch init-expression and case label and performs a implicit signed->unsigned type conversion when possible. v2: add GLSL spec reference, do implicit conversion if possible (Matt) Signed-off-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79724 Reviewed-by: Matt Turner <[email protected]>
* glsl/cs: Fix local_size_y and local_size_zJordan Justen2014-06-161-1/+1
| | | | | | | | | | | | | | | flags.q.local_size has 3 bits. One each for x, y and z. Fixes piglit's: * spec/ARB_compute_shader/linker/mismatched_local_work_sizes * spec/ARB_compute_shader/compiler/default_local_size.comp * spec/ARB_compute_shader/compiler/work_group_size_too_large * spec/ARB_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp This was regressed in 738c9c3c. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* glsl: parser changes for GL_ARB_explicit_uniform_locationTapani Pälli2014-06-164-0/+54
| | | | | | | | | | | | Patch adds a preprocessor define for the extension and stores explicit location data for uniforms during AST->HIR conversion. It also sets layout token to be available when having the extension in place. v2: change parser check to require GLSL 330 or enabling GL_ARB_explicit_attrib_location (Ian) v3: fix the check and comment in AST->HIR (Petri) Signed-off-by: Tapani Pälli <[email protected]>
* glsl: add enable bit for ARB_explicit_uniform_locationTapani Pälli2014-06-162-0/+3
| | | | | Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl/linker: assign explicit uniform locationsTapani Pälli2014-06-161-5/+56
| | | | | | | | | | | | | | | | | | | Patch refactors the existing uniform processing so explicit locations are taken in to account during variable processing. These locations are temporarily stored in gl_uniform_storage before actual locations are set. UNMAPPED_UNIFORM_LOC marks unset location so that we can use 0 as a valid explicit location. When locations are set, UniformRemapTable is first populated with uniforms that have explicit location set (inactive and active ones), rest are put after explicit location slots. v2: introduce define for locations that have not been set yet (Ian) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl/linker: initialize explicit uniform locationsTapani Pälli2014-06-162-0/+119
| | | | | | | | | | | Patch initializes the UniformRemapTable for explicit locations. This needs to happen before optimizations to make sure all inactive uniforms get their explicit locations correctly. v2: fix initialization bug, introduce define for inactive uniforms (Ian) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: add glsl_type::uniform_locations() helper functionTapani Pälli2014-06-162-0/+32
| | | | | | | | This function calculates the number of unique values from glGetUniformLocation for the elements of the type. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Fix clang mismatched-tags warnings with glsl_type.Vinson Lee2014-06-151-1/+1
| | | | | | | | | | | | | | | | | | Fix clang mismatched-tags warnings introduced with commit 4f5445a45d3ed02e00a061b10c943c0b079c6020. ./glsl_symbol_table.h:37:1: warning: class 'glsl_type' was previously declared as a struct [-Wmismatched-tags] class glsl_type; ^ ./glsl_types.h:86:8: note: previous use is here struct glsl_type { ^ ./glsl_symbol_table.h:37:1: note: did you mean struct here? class glsl_type; ^~~~~ Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Matt Turner <[email protected]>