summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: fix locations of 2-dimensional varyings without varying packing (v2)Marek Olšák2015-07-231-9/+28
| | | | | | v2: renamed producer/consumer_type -> producer/consumer_stage Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: don't demote tess control shader outputsMarek Olšák2015-07-231-1/+5
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: disable varying packing between tessellation shadersMarek Olšák2015-07-231-8/+21
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: allow indexing of gl_out with a non-const if length isn't knownMarek Olšák2015-07-231-0/+10
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: allow redeclaration of TCS gl_out[]Chris Forbes2015-07-231-4/+16
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: validate restrictions on use of barrier()Chris Forbes2015-07-231-0/+99
| | | | | | | | | | With the exception of always-taken switch cases (which are indistinguishable from straight line code in our IR), this disallows use of the builtin barrier() function in all the places it may not appear. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: allow barrier() in tessellation control shadersMarek Olšák2015-07-231-2/+2
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: analyze TES usage of gl_ClipDistanceChris Forbes2015-07-231-0/+19
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: push vertex count determination down one levelChris Forbes2015-07-233-17/+11
| | | | | | | We have the prog here, so we don't need the caller to work this out for us. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: pass shader stage to lower_output_reads and handle tess controlIlia Mirkin2015-07-232-5/+10
| | | | | | | | | | | | | Tessellation control outputs can be read in directly without first having been written. Accessing these will require some special logic anyways, so just let them through. V2: Never lower tess control output reads, whether patch or not -- both can be read back by other threads. Signed-off-by: Ilia Mirkin <[email protected]> Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: properly size unsized arrays in tess stagesChris Forbes2015-07-231-2/+47
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: restrict indexing for writes to TCS outputs to gl_InvocationIDChris Forbes2015-07-231-11/+58
| | | | | | Marek: handle ir_swizzle Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add builtin constants for ARB_tessellation_shaderChris Forbes2015-07-233-4/+72
| | | | | | Limits from other extensions added by Marek. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: allow nonconst indexing of arrays where we can work out an implicit sizeChris Forbes2015-07-231-1/+36
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: relax unsized input/output block arrays for TCS/TESChris Forbes2015-07-231-7/+30
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: add the tessellation extension to the list for the "layout" qualifierMarek Olšák2015-07-231-1/+2
| | | | | | | | | | | | | | | | This is technically not needed, but it makes the compiler return a better error message if tessellation is used with GLSL < 1.50. Instead of: error: syntax error, unexpected NEW_IDENTIFIER, expecting $end It returns: error: #version 150 layout qualifier `triangles' used And the tessellation spec says: OpenGL 3.2 and GLSL 1.50 are required. So it makes perfect sense. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: don't lower variable indexing on non-patch tessellation inputs/outputsMarek Olšák2015-07-233-16/+50
| | | | | | | | | | | | There is no way to lower them, because the array sizes are unknown at compile time. Based on a patch from: Fabian Bieler <[email protected]> v2: add comments Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: make stand-alone compiler work with tessellation shaders.Fabian Bieler2015-07-233-1/+12
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add "in" or "out" prefix to name when flattening interface blocksFabian Bieler2015-07-231-2/+5
| | | | | | | | This is to prevent a name conflict in tessellation shaders built-in interface blocks. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: lower gl_TessLevel* from float[n] to vecn.Fabian Bieler2015-07-236-13/+516
| | | | | | | | | | Similar to gl_ClipDistance -> gl_ClipDistanceMESA v2: - renamed is_mesa_var to lowered_builtin_array_variable - moved LowerTessLevel into gl_constants - cosmetic changes in lower_tess_level.cpp Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: make lower_clip_distance work with tessellation shaders.Fabian Bieler2015-07-231-80/+105
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: allow linking of tessellation shaders.Chris Forbes2015-07-233-7/+294
| | | | | | | Marek: require a tess eval shader if a tess control shader is present Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: add the patch in/out qualifier (v2)Fabian Bieler2015-07-2317-18/+156
| | | | | | v2: Dropped some unrelated reordering in glsl_parser.yy as Ken suggested. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add tessellation shader defines and built-in variables.Fabian Bieler2015-07-233-2/+86
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add tessellation shader parsing support (v2)Fabian Bieler2015-07-236-48/+476
| | | | | | v2: Fixed things that Ken suggested. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add tessellation shader enumsFabian Bieler2015-07-231-3/+5
| | | | | | | Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: check for leading zeros in array index validationTimothy Arceri2015-07-221-0/+4
| | | | | Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* nir: add nir_foreach_instr_safe_reverse()Connor Abbott2015-07-171-0/+2
| | | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Connor Abbott <[email protected]>
* nir: add nir_instr_is_first() and nir_instr_is_last() helpersConnor Abbott2015-07-171-0/+12
| | | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Connor Abbott <[email protected]>
* glsl: avoid compiler's segfault when processing operators with void argumentsRenaud Gaubert2015-07-162-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done by returning an rvalue of type void in the ast_function_expression::hir function instead of a void expression. This produces (in the case of the ternary) an hir with a call to the void returning function and an assignment of a void variable which will be optimized out (the assignment) during the optimization pass. This fix results in having a valid subexpression in the many different cases where the subexpressions are functions whose return values are void. Thus preventing to dereference NULL in the following cases: * binary operator * unary operators * ternary operator * comparison operators (except equal and nequal operator) Equal and nequal had to be handled as a special case because instead of segfaulting on a forbidden syntax it was now accepting expressions with a void return value on either (or both) side of the expression. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85252 Signed-off-by: Renaud Gaubert <[email protected]> Reviewed-by: Gabriel Laskar <[email protected]> Reviewed-by: Samuel Iglesias Gonsalvez <[email protected]>
* glsl: Lower shader storage buffer object loads to GLSL IR instrinsicsSamuel Iglesias Gonsalvez2015-07-141-8/+65
| | | | | | | | Extend the existing lower_ubo_reference pass to also detect SSBO loads and lower them to __intrinsic_load_ssbo intrinsics. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: Lower shader storage buffer object writes to GLSL IR instrinsicsSamuel Iglesias Gonsalvez2015-07-141-130/+311
| | | | | | | | Extend the existing lower_ubo_reference pass to also detect SSBO writes and lower them to __intrinsic_store_ssbo intrinsics. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: Don't do copy propagation on buffer variablesIago Toral Quiroga2015-07-141-1/+1
| | | | | | | | | | | Since the backing storage for these is shared we cannot ensure that the value won't change by writes from other threads. Normally SSBO accesses are not guaranteed to be syncronized with other threads, except when memoryBarrier is used. So, we might be able to optimize some SSBO accesses, but for now we always take the safe path and emit the SSBO access. Reviewed-by: Jordan Justen <[email protected]>
* glsl: Don't do constant variable on buffer variablesIago Toral Quiroga2015-07-141-0/+7
| | | | | | | | | | | Since the backing storage for these is shared we cannot ensure that the value won't change by writes from other threads. Normally SSBO accesses are not guaranteed to be syncronized with other threads, except when memoryBarrier is used. So, we might be able to optimize some SSBO accesses, but for now we always take the safe path and emit the SSBO access. Reviewed-by: Jordan Justen <[email protected]>
* glsl: Don't do constant propagation on buffer variablesIago Toral Quiroga2015-07-141-0/+8
| | | | | | | | | | | Since the backing storage for these is shared we cannot ensure that the value won't change by writes from other threads. Normally SSBO accesses are not guaranteed to be syncronized with other threads, except when memoryBarrier is used. So, we might be able to optimize some SSBO accesses, but for now we always take the safe path and emit the SSBO access. Reviewed-by: Jordan Justen <[email protected]>
* glsl: Do not kill dead assignments to buffer variables or SSBO declarations.Iago Toral Quiroga2015-07-141-3/+6
| | | | | | | | | | | | | | | If we kill dead assignments we lose the buffer writes. Also, we never kill UBO declarations even if they are never referenced by the shader, they are always considered active. Although the spec does not seem say this specifically for SSBOs, it is probably implied since SSBOs are pretty much the same as UBOs, only that you can write to them. v2: - Fix the comment (Jordan) Reviewed-by: Jordan Justen <[email protected]>
* glsl: Don't do tree grafting on buffer variablesIago Toral Quiroga2015-07-141-4/+5
| | | | | | Otherwise we can lose writes into the buffers backing the variables. Reviewed-by: Jordan Justen <[email protected]>
* glsl: fix error messages in invalid declarations of shader storage blocksSamuel Iglesias Gonsalvez2015-07-141-7/+8
| | | | | | | | | | Due to GL_ARB_shader_storage_buffer_object extension, shader storage blocks have the same limitations as uniform blocks. This patch fixes the corresponding error messages. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: buffer variables cannot be defined outside interface blocksSamuel Iglesias Gonsalvez2015-07-141-0/+12
| | | | | | | | | | | | Section 4.3.7 "Buffer Variables", GLSL 4.30 spec: "Buffer variables may only be declared inside interface blocks (section 4.3.9 “Interface Blocks”), which are then referred to as shader storage blocks. It is a compile-time error to declare buffer variables at global scope (outside a block)." Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: shader buffer variables cannot have initializersSamuel Iglesias Gonsalvez2015-07-141-0/+9
| | | | | | | | | | | | Section 4.3.7 "Buffer Variables" of the GLSL 4.30 spec: "Buffer variables cannot have initializers." v2: - Rewrite error message (Jordan) Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: enable binding layout qualifier usage for shader storage buffer objectsSamuel Iglesias Gonsalvez2015-07-142-6/+26
| | | | | | | | | | | | See GLSL 4.30 spec, section 4.4.5 "Uniform and Shader Storage Block Layout Qualifiers". v2: - Add whitespace in an error message. Delete period '.' at the end of that error message (Jordan). Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: Identify active uniform blocks that are buffer blocks as such.Iago Toral Quiroga2015-07-143-0/+6
| | | | Reviewed-by: Jordan Justen <[email protected]>
* glsl: link buffer variables and shader storage buffer interface blocksKristian Høgsberg2015-07-144-9/+21
| | | | Reviewed-by: Jordan Justen <[email protected]>
* glsl: Implement parser support for 'buffer' qualifierKristian Høgsberg2015-07-146-9/+42
| | | | | | | This is used to identify shader storage buffer interface blocks where buffer variables are declared. Reviewed-by: Jordan Justen <[email protected]>
* nir: add nir_var_shader_storageIago Toral Quiroga2015-07-146-8/+20
| | | | Reviewed-by: Jordan Justen <[email protected]>
* mesa: rename is_in_uniform_block to is_in_buffer_blockIago Toral Quiroga2015-07-148-14/+15
| | | | | | | Since this now checks if a variable is inside a uniform or a shader storage block. Reviewed-by: Jordan Justen <[email protected]>
* glsl: Add ir_var_shader_storageKristian Høgsberg2015-07-1411-13/+34
| | | | | | | | | | | This will be used to identify buffer variables inside shader storage buffer objects, which are very similar to uniforms except for a few differences, most important of which is that they are writable. Since buffer variables are so similar to uniforms, we will almost always want them to go through the same paths as uniforms. Reviewed-by: Jordan Justen <[email protected]>
* mesa: define ARB_shader_storage_buffer_object extensionSamuel Iglesias Gonsalvez2015-07-143-31/+42
| | | | | Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: free interface_typesTimothy Arceri2015-07-141-0/+5
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl: replace some more old hash_table usesTimothy Arceri2015-07-142-41/+41
| | | | | | | | | The util/hash_table was intended to be a fast hash table replacement for the program/hash_table see 35fd61bd99c1 and 72e55bb6888ff. This change replaces some more uses of the old hash table. Reviewed-by: Iago Toral Quiroga <[email protected]>