summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
* glsl: use set rather than old hash table for ir_validateTimothy Arceri2015-07-111-12/+12
| | | | | | | | | | When the new hash table implementation was added to Mesa it claimed to be much faster, see commits 35fd61bd99c1 and 72e55bb6888ff. The set implementation follows the same implementation strategy so this should be faster and there was no need to store a data field. Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir: Fix comment above nir_convert_from_ssa() prototype.Kenneth Graunke2015-07-081-3/+3
| | | | | | | | Connor renamed the parameter, inverting the sense. Update the comment accordingly. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* mesa: use implementation specified MAX_VERTEX_ATTRIBS rather than hardcoded ↵Timothy Arceri2015-07-081-6/+2
| | | | | | value Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Make sure not to dereference NULLNeil Roberts2015-07-061-1/+1
| | | | | | | | | | In this bit of code point_five can be NULL if the expression is not a constant. This fixes it to match the pattern of the rest of the chunk of code so that it checks for NULLs. Cc: Matt Turner <[email protected]> Cc: "10.6" <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Add missing check for whether an expression is an add operationNeil Roberts2015-07-061-1/+1
| | | | | | | | | | | | | | | There is a piece of code that is trying to match expressions of the form (mul (floor (add (abs x) 0.5) (sign x))). However the check for the add expression wasn't checking whether it had the expected operation. It looks like this was just an oversight because it doesn't match the pattern for the rest of the code snippet. The existing line to check whether add_expr!=NULL was added as part of a coverity fix in 3384179f. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91226 Cc: Matt Turner <[email protected]> Cc: "10.6" <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: update types for unsized arrays of membersTimothy Arceri2015-07-041-2/+16
| | | | | | | Assigns a new array type based on the max access of unsized array members. This is to support arrays of arrays. Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: update assert to support arrays of arraysTimothy Arceri2015-07-041-1/+2
| | | | Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: allow precision qualifiers for AoATimothy Arceri2015-07-041-3/+1
| | | | Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: add a missing call to _mesa_locale_initErik Faye-Lund2015-07-032-3/+3
| | | | | | | | | | After c61bc6e ("util: port _mesa_strto[df] to C"), "make check" fails due to a missing _mesa_locale_init. Fixup this oversight, by moving the stand-alone compiler initializer inside initialize_context_to_defaults(). Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Erik Faye-Lund <[email protected]>
* nir/lower_phis_to_scalar: undef is trivially scalarizableRob Clark2015-07-031-0/+1
| | | | | Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: Don't allow copying SSA destinationsJason Ekstrand2015-07-021-11/+11
| | | | Reviewed-by: Connor Abbott <[email protected]>
* glsl: create program resource list after LinkShaderTapani Pälli2015-07-011-4/+0
| | | | | | | | | Resource list can be created properly only after LinkShader hook has been called to make sure all dead variables have been removed. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Martin Peres <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90925
* glsl: expose build_program_resource_list functionTapani Pälli2015-07-012-1/+5
| | | | | | | | This is required so that we can move resource list creation to happen later. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Martin Peres <[email protected]>
* glsl: build stageref mask using IR, not symbol tableTapani Pälli2015-07-011-3/+11
| | | | | | | | | Instead of using symbol table, build mask by inspecting IR. This change is required by further patches to move resource list creation to happen later when symbol table does not exist anymore. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Martin Peres <[email protected]>
* glsl: use consistent version string formatTimothy Arceri2015-07-011-7/+7
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* nir: remove parent_instr from nir_registerConnor Abbott2015-06-303-17/+0
| | | | | | It's no longer used. Reviewed-by: Jason Ekstrand <[email protected]>
* nir: remove nir_src_get_parent_instr()Connor Abbott2015-06-301-10/+0
| | | | | | It's now unused. Reviewed-by: Jason Ekstrand <[email protected]>
* nir/from_ssa: add a flag to not convert everything from SSAConnor Abbott2015-06-302-8/+24
| | | | | | | | | | | | | We already don't convert constants out of SSA, and in our backend we'd like to have only one way of saying something is still in SSA. The one tricky part about this is that we may now leave some undef instructions around if they aren't part of a phi-web, so we have to be more careful about deleting them. v2: rename and flip meaning of flag (Jason) Reviewed-by: Jason Ekstrand <[email protected]>
* nir: cleanup open-coded instruction castsRob Clark2015-06-303-3/+3
| | | | | Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: validate sampler array indexing for 'constant-index-expression'Tapani Pälli2015-06-301-0/+77
| | | | | | | | | | | | | | Desktop GLSL < 130 and GLSL ES < 300 allow sampler array indexing where index can contain a loop induction variable. This extra check will warn during linking if some of the indexes could not be turned in to constant expressions. v2: warning instead of error for backends that did not enable EmitNoIndirectSampler option (have dynamic indexing) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Francisco Jerez <[email protected]> Cc: "10.5" and "10.6" <[email protected]>
* mesa/glsl: new compiler option EmitNoIndirectSamplerTapani Pälli2015-06-301-0/+12
| | | | | | | | | | | | | | | | Patch provides new compiler option for backend to force unroll loops that have non-constant expression indexing on sampler arrays. This makes sure that we can never end up with a shader that uses loop induction variable as sampler array index but does not unroll because of having too much instructions. This would not work without dynamic indexing support. v2: change option name as EmitNoIndirectSampler Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Francisco Jerez <[email protected]> Cc: "10.5" and "10.6" <[email protected]>
* glsl: Allow dynamic sampler array indexing with GLSL ES < 3.00Tapani Pälli2015-06-301-18/+18
| | | | | | | | | | | | | | | | | | | | Dynamic indexing of sampler arrays is prohibited by GLSL ES 3.00. Earlier versions allow 'constant-index-expression' indexing, where index can contain a loop induction variable. Patch allows dynamic indexing for sampler arrays when GLSL ES < 3.00. This change makes 'sampler-array-index.frag' parser test in Piglit pass + fishgl.com works when running Chrome on OpenGL ES 2.0 backend v2: small change and some more commit message (Tapani) v3: refactor checks to make it more readable (Ian Romanick) v4: change warning comment in GLSL ES case (Curro) Signed-off-by: Tapani Pälli <[email protected]> Signed-off-by: Kalyan Kondapally <[email protected]> Reviewed-by: Francisco Jerez <[email protected]> Cc: "10.5" and "10.6" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84225
* util: port _mesa_strto[df] to CErik Faye-Lund2015-06-292-0/+6
| | | | | | | | | | | | | _mesa_strtod and _mesa_strtof are only used from the GLSL compiler and the ARB_[vertex|fragment]_program code, meaning that the locale doesn't need to be initialized before the first OpenGL context gets initialized. So let's use explicit initialization from the one-time init code instead of depending on a C++ compiler to initialize at image-load time. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glsl: No need to lock in _mesa_glsl_release_typesErik Faye-Lund2015-06-291-4/+4
| | | | | | | | | | This function only gets called while mesa is unloading, so there's no potential of racing or multiple calls at the same time. So let's just get rid of the locking. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* Revert "glsl: clone inputs and outputs during linking"Kenneth Graunke2015-06-281-3/+1
| | | | | | | | | | | This reverts commit c2ff3485b3d48749ea9dcad07bc1a691627dc3e5. Ilia and I noticed a memory leak caused by this patch: at least with fixed-function programs, we clone things using ProgramResourceList as the context before reralloc makes it non-NULL. I believe Tapani found other bugs with these patches, so I'm just going to revert them for now and let him pursue them further.
* mesa: Enable subdir-objects globally.Matt Turner2015-06-261-2/+0
| | | | Reviewed-by: Emil Velikov <[email protected]>
* nir: Recognize max(min(a, 1.0), 0.0) as fsat(a).Kenneth Graunke2015-06-251-0/+1
| | | | | | | | | | | | | | We already recognize min(max(a, 0.0), 1.0) as a saturate, but neglected this variant (which is also handled by the GLSL IR pass). shader-db results on Broadwell: total instructions in shared programs: 7363046 -> 7362788 (-0.00%) instructions in affected programs: 11928 -> 11670 (-2.16%) helped: 64 HURT: 0 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl: clone inputs and outputs during linkingTapani Pälli2015-06-241-1/+3
| | | | | | | | | | | This increases memory pressure during linking but makes it easier for backend to free IR after it is not needed anymore. v2: use resource list as ralloc context in case of relink (Kenneth) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected]
* nir: Use a switch statement for detecting move-like operations.Kenneth Graunke2015-06-241-6/+14
| | | | | | | Suggested by Jason Ekstrand. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: remove cross validation of interpolation qualifier with GLSL 4.40Tapani Pälli2015-06-241-1/+11
| | | | | Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>