summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: do not call link_xfb_stride_layout_qualifiers() for fragment shadersJuan A. Suarez Romero2017-07-121-2/+4
| | | | | | | | | | | | | | | | | | | | xfb only applies to the latest stage before the fragment shader, so there is no need to invoke it in the fragment shader. Fixes: KHR-GL45.enhanced_layouts.xfb_stride_of_empty_list KHR-GL45.enhanced_layouts.xfb_stride_of_empty_list_and_api v2: do reset only if shaders provide an explicit stride v3: do not call link_xfb_stride_layout_qualifiers() for fragment shaders (Timothy) Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Juan A. Suarez Romero <[email protected]> (cherry picked from commit 860919a3b237386cba5b2951ae520bf6734fd17e) [Andres Gomez: resolve trivial conflicts] Signed-off-by: Andres Gomez <[email protected]>
* glsl: gl_Max{Vertex,Fragment}UniformComponents exist in all desktop GL versionsIago Toral Quiroga2017-07-121-7/+9
| | | | | | | | | | | The current implementation assumed that these were replaced in GLSL >= 4.10 by gl_Max{Vertex,Fragment}UniformVectors, however this is not true: both built-ins should be produced from GLSL 4.10 onwards. This was raised by new CTS tests that are in development. Reviewed-by: Nicolai Hähnle <[email protected]> (cherry picked from commit b70d6a2de1c90409c7a2e0d6484f350558f5c2ac)
* glsl: check if any of the named builtins are available firstIlia Mirkin2017-07-123-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | _mesa_glsl_has_builtin_function is used to determine whether any variant of a builtin are available, for the purpose of enforcing the GLSL ES 3.00+ rule that overloads or overrides of builtins are disallowed. However the builtin_builder contains information on all builtins, irrespective of parse state, or versions, or extension enablement. As a result we would say that a builtin existed even if it was not actually available. To resolve this, first check if at least one signature is available for a builtin before returning true. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101666 Signed-off-by: Ilia Mirkin <[email protected]> Cc: [email protected] Reviewed-by: Timothy Arceri <[email protected]> Acked-by: Lionel Landwerlin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> (cherry picked from commit 880f21f55d579fe2183255d031c23343da30f69e) [Andres Gomez: resolve trivial conflicts] Signed-off-by: Andres Gomez <[email protected]>
* glsl/lower_distance: only set max_array_access for 1D clip dist arraysDave Airlie2017-06-141-1/+1
| | | | | | | | | | | | | | | The max_array_access field applies to the first dimension, which means we only want to set it for the 1D clip dist arrays. This fixes an ir_validate assert seen with KHR-GL44.cull_distance.functional on nouveau and radeon with debug builds. Fixes: a08c4ebbe (glsl: rewrite clip/cull distance lowering pass) Reviewed-by: Timothy Arceri <[email protected]> Tested-by: Tobias Klausmann <[email protected]> Signed-off-by: Dave Airlie <[email protected]> (cherry picked from commit 53587b7105aaf10ecf7e5dcb8ed63265af688738)
* st/mesa: don't mark the program as in cache_fallback when there is cache missTimothy Arceri2017-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | When we fallback currently the gl_program objects are re-allocated. This is likely to change when the i965 cache lands, but for now this fixes a crash when using MESA_GLSL=cache_fb. This env var simulates the fallback path taken when a tgsi cache item doesn't exist due to being evicted previously or some kind of error. Unlike i965 we are always falling back at link time so it's safe to just re-allocate everything. We will be unnecessarily freeing and re-allocate a bunch of things here but it's probably not a huge deal, and can be changed when the i965 code lands. Fixes: 0e9991f957e2 ("glsl: don't reference shader prog data during cache fallback") Reviewed-by: Nicolai Hähnle <[email protected]> (cherry picked from commit 80e643345ed0d8d3263b4ee23dd2998f0da170a8) Signed-off-by: Juan A. Suarez Romero <[email protected]>
* glsl: don't run the GLSL pre-processor when we are skipping compilationTimothy Arceri2017-04-152-9/+20
| | | | | | | | | | | | | | | | | | | | This moves the hashing of shader source for the cache lookup to before the preprocessor. In our experience, shaders are unlikely to hash the same after preprocessing if they didn't hash the same before, so we can skip preprocessing for cache hits. Improves Deus Ex start-up times with a warm cache from ~30 seconds to ~22 seconds. Also fixes the leaking of state. V2: fix indentation v3: add the value of MESA_EXTENSION_OVERRIDE to the hash of the shader. Tested-by (v2): Grazvydas Ignotas <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: delay optimisations on individual shaders when cache is availableTimothy Arceri2017-04-153-77/+94
| | | | | | | | | | | | | | | | | | | | | | Due to a max limit of 65,536 entries on the index table that we use to decide if we can skip compiling individual shaders, it is very likely we will have collisions. To avoid doing too much work when the linked program may be in the cache this patch delays calling the optimisations until link time. Improves cold cache start-up times on Deus Ex by ~20 seconds. When deleting the cache index to simulate a worst case scenario of collisions in the index, warm cache start-up time improves by ~45 seconds. V2: fix indentation, make sure to call optimisations on cache fallback, make sure optimisations get called for XFB. Tested-by: Grazvydas Ignotas <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* nir: Destination component count of shader_clock intrinsic is 2Boyan Ding2017-04-141-1/+2
| | | | | | | | | | | This fixes the following error when using ARB_shader_clock on i965: vec1 32 ssa_0 = intrinsic shader_clock () () () intrinsic store_var (ssa_0) (clock_retval) (3) /* wrmask=xy */ error: src->ssa->num_components == num_components (nir/nir_validate.c:204) Signed-off-by: Boyan Ding <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Cc: [email protected]
* glsl: simplify apply_image_qualifier_to_variable()Samuel Pitoiset2017-04-131-59/+58
| | | | | | | | This removes one level of indentation and will improve readability for bindless images. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: add validate_fragment_flat_interpolation_input()Samuel Pitoiset2017-04-131-63/+72
| | | | | | | Requested by Timothy Arceri. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: use the BA1 macro for textureQueryLevels()Samuel Pitoiset2017-04-111-32/+33
| | | | | | | For both consistency and new bindless sampler types. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: use the BA1 macro for textureSamples()Samuel Pitoiset2017-04-111-9/+10
| | | | | | | For both consistency and new bindless sampler types. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: use the BA1 macro for textureCubeArrayShadow()Samuel Pitoiset2017-04-111-5/+6
| | | | | | | For both consistency and new bindless sampler types. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: fix lower jumps for nested non-void returnsTimothy Arceri2017-04-082-1/+10
| | | | | | | | Fixes the case were a loop contains a return and the loop is nested inside an if. Reviewed-by: Roland Scheidegger <[email protected]> https://bugs.freedesktop.org/show_bug.cgi?id=100303
* glsl: add gl_SubGroup*ARB builtinsNicolai Hähnle2017-04-051-0/+22
| | | | Reviewed-by: Marek Olšák <[email protected]>
* glsl: add ARB_shader_ballot builtin functionsNicolai Hähnle2017-04-051-0/+77
| | | | Reviewed-by: Marek Olšák <[email protected]>
* glsl: add ARB_shader_ballot operationsNicolai Hähnle2017-04-053-0/+35
| | | | Reviewed-by: Marek Olšák <[email protected]>
* glsl: add ARB_shader_ballot enableNicolai Hähnle2017-04-052-0/+3
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa: Replace program locks with atomic inc/dec.Matt Turner2017-04-051-2/+0
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* glsl: remove unused fileElie TOURNIER2017-04-041-206/+0
| | | | | | | | | | | udivmod64 appears in src/compiler/glsl/builtin_int64.h and src/compiler/glsl/udivmod.h The second file seems unused. Fix commit 6b03b345eb64e15e577bc8b2cf04b314a4c70537 This change doesn't affect shader-db. Signed-off-by: Elie Tournier <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glsl: Fix blob memory leakBartosz Tomczyk2017-04-043-5/+16
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* glsl: use -O1 optimization for builtin_functions.cpp with MinGWBrian Paul2017-03-311-0/+20
| | | | | | | | | | | | | | | | Some versions of MinGW-w64 such as 5.3.1 and 6.2.0 produce bad code with -O2 or -O3 causing a random driver crash when running programs that use GLSL. Most Mesa demos in the glsl/ directory trigger the bug, but not the fragcoord.c test. Use a #pragma to force -O1 for this file for later MinGW versions. Luckily, this is basically one-time setup code. I suspect the bug is related to the sheer size of this file. This should let us move to newer versions of MinGW-w64 for Mesa. Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: fix clockARB builtin functionNicolai Hähnle2017-03-311-1/+1
| | | | | | | The underlying intrinsic is defined to always have a uvec2 return type. Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: update lower_jumps tests after bug fixTimothy Arceri2017-03-291-2/+15
| | | | | | | | | | | This change updates the tests to reflect the IR after the following bug fix. Fixes: c1096b7f1d49 ("glsl: fix lower jumps for returns when loop is inside an if") Tested-by: Michel Dänzer <[email protected]> Bugzilla: https://bugs.freedesktop.org/100441
* tests/cache_test: allow crossing mount pointsJuan A. Suarez Romero2017-03-281-1/+1
| | | | | | | | | | | When using an overlayfs system (like a Docker container), rmrf_local() fails because part of the files to be removed are in different mount points (layouts). And thus cache-test fails. Letting crossing mount points is not a big problem, specially because this is just for a test, not to be used in real code. Reviewed-by: Nicolai Hähnle <[email protected]>
* glcpp/tests/glcpp-test-cr-lf: error out if we cannot find any testsEmil Velikov2017-03-281-0/+5
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp/tests/glcpp-test-cr-lf: correctly set/use srcdir/abs_builddirEmil Velikov2017-03-281-14/+17
| | | | | | | | | | | | Otherwise manual invokation of the script from elsewhere than `dirname $0` will fail. With these all the artefacts should be created in the correct location, and thus we can remove the old (and slighly strange) clean-local line. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp/tests: update testname in help stringEmil Velikov2017-03-282-2/+2
| | | | | | | | | Rather than hardcoding glcpp/other use `basename "$0"` which expands appropriatelly. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp/tests/glcpp-test: error out if we cannot find any testsEmil Velikov2017-03-281-0/+5
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp/tests/glcpp-test: print only the test basenameEmil Velikov2017-03-281-2/+2
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp/tests/glcpp-test: set srcdir/abs_builddir variablesEmil Velikov2017-03-281-8/+15
| | | | | | | | | | | | Current definitions work fine for the manual invokation of the script, although the whole script does not consider that one can run it OOT. The latter will be handled with latter patches, although it will be extensively using the two variables. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/optimization-test: 'echo' only folders which has generatorsEmil Velikov2017-03-281-1/+1
| | | | | | | | The current "let's print any folder which exists" is simply confusing. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/optimization-test: print only the test basedir/nameEmil Velikov2017-03-281-1/+1
| | | | | | | | | The relative/absolute path brings little to no benefit in being printed as testname. Trim it out. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/optimization-test: error if zero tests were executedEmil Velikov2017-03-281-0/+5
| | | | | | | | | We don't want to lie ourselves that 'everything is fine' when no tests were found/ran. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/optimization-test: pass glsl_test as argumentEmil Velikov2017-03-282-3/+8
| | | | | | | | | | | | Rather than hardcoding the binary location (which ends up wrong in a number of occasions) in the python script, pass it as argument. This allows us to remove a couple of dirname/basename workarounds that aimed to keep this working, and succeeded in the odd occasion. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/optimization-test: error out if we fail to generate any testsEmil Velikov2017-03-281-1/+12
| | | | | | | | v2: use -eq over a string comparison (Eric) Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/optimization-test: correctly manage srcdir/builddirEmil Velikov2017-03-282-4/+19
| | | | | | | | | | | | | | | | | | At the moment we look for generator script(s) in builddir while they are in srcdir, and we proceed to generate the tests and expected output in srcdir, which is not allowed. To untangle: - look for the generator script in the correct place - generate the files in builddir, by extending create_test_cases.py to use --outdir With this in place the test passes `make check' for OOT builds - would that be as standalone or part of `make distcheck' Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/optimisation-test: ensure that compare_ir is availableEmil Velikov2017-03-281-0/+5
| | | | | | | | | | Bail out early if the script is not where we expect it to be. v2: use -f instead of -e. latter returns true on folder(s) Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/optimization-test: correctly set compare_irEmil Velikov2017-03-281-6/+2
| | | | | | | | | Now that we have srcdir we can use it to correctly manage/point to the script. Effectively fixing OOT invokation of `make check'. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/optimization-test: add fallback srcdir/abs_builddir definesEmil Velikov2017-03-281-0/+13
| | | | | | | | | There is no robust way to detect either one, so simply hope for the best and warn just in case. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/optimisation-test: make sure that $PYTHON2 is set/availableEmil Velikov2017-03-281-0/+10
| | | | | | | | | | Otherwise we'll fail when invoking the script outside of "make check" v2: use -ne over a string comparison (Eric) Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/warnings-test: print only the test basenameEmil Velikov2017-03-281-1/+1
| | | | | | | | | Spamming the log with the (in some cases extremely long) test location is of limited use. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/warnings-test: error if zero tests were executedEmil Velikov2017-03-281-0/+5
| | | | | | | | | We don't want to lie ourselves that 'everything is fine' when no tests were found/ran. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/warnings-test: correctly manage srcdir/builddirEmil Velikov2017-03-281-4/+8
| | | | | | | | | Before this commit, we would effectively fail to run any of the test in a OOT builds. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/warnings-test: add fallback srcdir/abs_builddir definesEmil Velikov2017-03-281-1/+14
| | | | | | | | | There is no robust way to detect either one, so simply hope for the best and warn just in case. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests/warnings-test: error out if glsl_compiler is missingEmil Velikov2017-03-281-0/+5
| | | | | | | | | | ... or non-executable, in particular. v2: use test -x (Eric) Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> (v1) Reviewed-by: Eric Engestrom <[email protected]>
* glsl: fix spelling of embedded in commentTimothy Arceri2017-03-281-1/+1
|
* glsl: fix lower jumps for returns when loop is inside an ifTimothy Arceri2017-03-281-5/+12
| | | | | | | | | | | | | | | | | Previously we would just escape the loop and move everything following the loop inside the if to the else branch of a new if with a return flag conditional. However everything outside the if the loop was nested in would still get executed. Adding a new return to the then branch of the new if fixes this and we just let a follow pass clean it up if needed. Fixes: tests/spec/glsl-1.10/execution/vs-nested-return-sibling-loop.shader_test tests/spec/glsl-1.10/execution/vs-nested-return-sibling-loop2.shader_test Cc: "13.0 17.0" <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* glsl: Interface Block instances don't need linking validationAndres Gomez2017-03-271-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From page 45 (page 52 of the PDF) of the GLSL ES 3.00 v.6 spec: " When instance names are present on matched block names, it is allowed for the instance names to differ; they need not match for the blocks to match. From page 51 (page 57 of the PDF) of the GLSL 4.30 v.8 spec: " When instance names are present on matched block names, it is allowed for the instance names to differ; they need not match for the blocks to match." Therefore, no cross linking validation is needed for the instance name of an Interface Block. This patch will make that no link error will be reported on a program like this: "# VS layout(binding = 1) Block1 { vec4 color; } uni_block; ... # FS layout(binding = 2) Block2 { vec4 color; } uni_block; ..." Fixes GL45-CTS.enhanced_layouts.ssb_layout_qualifier_conflict Signed-off-by: Andres Gomez <[email protected]> Cc: Timothy Arceri <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: UBOs and SSBOs must match the binding qualifier tooAndres Gomez2017-03-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From page 140 (page 147 of the PDF) of the GLSL ES 3.10 v.4 spec: " 9.2 Matching of Qualifiers The following tables summarize the requirements for matching of qualifiers. It applies whenever there are two or more matching variables in a shader interface. Notes: 1. Yes means the qualifiers must match. ... 9.2.1 Linked Shaders | Qualifier | Qualifier | in/out | Default | uniform | buffer| | Class | | | Uniforms | Block | Block | ... | Layout | binding | N/A | Yes | Yes | Yes |" From page 93 (page 110 of the PDF) of the GL 4.2 (Core Profile) spec: " 2.11.7 Uniform Variables ... Uniform Blocks ... When a named uniform block is declared by multiple shaders in a program, it must be declared identically in each shader. The uniforms within the block must be declared with the same names and types, and in the same order. If a program contains multiple shaders with different declarations for the same named uniform block differs between shader, the program will fail to link." From page 129 (page 150 of the PDF) of the GL 4.3 (Core Profile) spec: " 7.8 Shader Buffer Variables and Shader Storage Blocks ... When a named shader storage block is declared by multiple shaders in a program, it must be declared identically in each shader. The buffer variables within the block must be declared with the same names, types, qualification, and declaration order. If a program contains multiple shaders with different declarations for the same named shader storage block, the program will fail to link." Therefore, if the binding qualifier differs between two linked Uniform or Shader Storage Blocks of the same name, a link error should happen. This patch will make that a link error will be reported on a program like this: "# VS layout(binding = 1) Block { vec4 color; } uni_block1; ... # FS layout(binding = 2) Block { vec4 color; } uni_block2; ..." Signed-off-by: Andres Gomez <[email protected]> Cc: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>