aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
Commit message (Collapse)AuthorAgeFilesLines
* Revert "glsl: reject image qualifiers with non-image types inside uniform ↵Matt Turner2017-04-281-2/+0
| | | | | | | | | | | | | | | | | | blocks" This reverts commit 24011ead71ea9980e6b34e40d9dbd64e6560f5a4. This causes lots of ES 3.1 CTS tests to fail to compile a bit of code like: layout(binding = 0) buffer InOut { highp uint inputValues[384]; highp uint outputValues[384]; coherent highp uint groupValues[64]; <----- } sb_inout; error: memory qualifiers may only be applied to images
* glsl: remove the shader_group_vote and shader_ballot expression opsNicolai Hähnle2017-04-283-53/+0
| | | | They are now no longer used.
* glsl: implement arb_shader_ballot builtins using intrinsicsNicolai Hähnle2017-04-281-3/+83
|
* glsl: implement arb_shader_group_vote builtins via intrinsicsNicolai Hähnle2017-04-281-6/+32
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* glsl: add intrinsics for ARB_shader_group_vote and ARB_shader_ballotNicolai Hähnle2017-04-281-0/+7
| | | | | | | | | | These operations are currently implemented as IR expressions. However, they cannot be transformed and moved in the way that other IR expressions can because they have non-trivial interactions with control-flow. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* glsl: reject image qualifiers with non-image types inside uniform blocksSamuel Pitoiset2017-04-281-0/+2
| | | | | | | | | | Fixes the following ARB_shader_image_load_store tests: format-layout-with-non-image-type.frag memory-qualifier-with-non-image-type.frag Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: introduce validate_image_qualifier_for_type() helperSamuel Pitoiset2017-04-281-9/+20
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: fix error when using format qualifiers with non-image typesSamuel Pitoiset2017-04-281-2/+6
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: remove duplicate validationTimothy Arceri2017-04-271-15/+0
| | | | | | | | Varying types have already been validated in apply_type_qualifier_to_variable() by this point. Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* glsl: use without_array() rather than get_scalar_type()Timothy Arceri2017-04-271-1/+1
| | | | | | | | Here get_scalar_type() was just being use to remove the array after that we converted it back to base_type anyway so just use the without_array() helper. Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl: Initialize current_varMatt Turner2017-04-251-1/+1
| | | | CID: 1324644 (Uninitialized pointer field)
* glsl: use ARB_enhahnced_layouts for packing where possibleTimothy Arceri2017-04-241-0/+70
| | | | | | | | | | | | | | | | | | | | | If packing doesn't cross locations we can easily make use of ARB_enhanced_layouts to do packing rather than using the GLSL IR lowering pass lower_packed_varyings(). Shader-db Broadwell results: total instructions in shared programs: 12977822 -> 12977819 (-0.00%) instructions in affected programs: 1871 -> 1868 (-0.16%) helped: 4 HURT: 3 total cycles in shared programs: 246567288 -> 246567668 (0.00%) cycles in affected programs: 1370386 -> 1370766 (0.03%) helped: 592 HURT: 733 Acked-by: Elie Tournier <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: disable varying packing for varying used by interpolateAt*Timothy Arceri2017-04-243-7/+19
| | | | | | | | | | | | | | | | | Currently the NIR backends depend on GLSL IR copy propagation to fix up the interpolateAt* function params after varying packing changes the shader input to a global. It's possible copy propagation might not always do what we need it too, and we also shouldn't depend on optimisations to do this type of thing for us. I'm not sure if the same is true for TGSI, but the following commit should re-enable packing for most cases in a safer way, so we just disable it everywhere. No change in shader-db for i965 (BDW) Acked-by: Elie Tournier <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl_to_nir: skip ir_var_shader_shared variablesTimothy Arceri2017-04-241-0/+7
| | | | | | | | | | | | | | These should be lowered away in GLSL IR but if we don't get dead code to clean them up it causes issues in glsl_to_nir. We wan't to drop as many GLSL IR opts in future as we can so this makes glsl_to_nir just ignore the vars if it sees them. In future we will want to just use the nir lowering pass that Vulkan currently uses. Acked-by: Elie Tournier <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: make use of glsl_type::is_float()Samuel Pitoiset2017-04-219-55/+47
| | | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: make use of glsl_type::is_double()Samuel Pitoiset2017-04-2111-44/+44
| | | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: make use of glsl_type::is_integer_64()Samuel Pitoiset2017-04-211-9/+2
| | | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: make use of glsl_type::is_boolean()Samuel Pitoiset2017-04-213-18/+17
| | | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: make use of glsl_type::is_record()Samuel Pitoiset2017-04-213-5/+3
| | | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: make use of glsl_type::is_interface()Samuel Pitoiset2017-04-212-2/+2
| | | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: make use of glsl_type::is_array()Samuel Pitoiset2017-04-214-4/+4
| | | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: make use glsl_type::is_atomic_uint()Samuel Pitoiset2017-04-212-5/+3
| | | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: get rid of values_for_type()Samuel Pitoiset2017-04-213-22/+4
| | | | | | | | | | | This function is actually a wrapper for component_slots() and it always returns 1 (or N) for samplers. Since component_slots() now return 1 for samplers, it can go. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Nicolai Hähnle <[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]>