summaryrefslogtreecommitdiff
path: root/src/compiler
AgeCommit message (Collapse)AuthorFilesLines
2017-04-16nir: Add GLSL_TYPE_[U]INT64 to some switch statementsJason Ekstrand2-0/+4
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2017-04-15glsl: don't run the GLSL pre-processor when we are skipping compilationTimothy Arceri2-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 <notasas@gmail.com> Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-04-15glsl: delay optimisations on individual shaders when cache is availableTimothy Arceri3-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 <notasas@gmail.com> Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-04-14nir: Destination component count of shader_clock intrinsic is 2Boyan Ding2-2/+3
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 <boyan.j.ding@gmail.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Cc: mesa-stable@lists.freedesktop.org
2017-04-14nir/print: add compute shader infoRob Clark1-0/+13
Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
2017-04-13glsl: simplify apply_image_qualifier_to_variable()Samuel Pitoiset1-59/+58
This removes one level of indentation and will improve readability for bindless images. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-04-13glsl: add validate_fragment_flat_interpolation_input()Samuel Pitoiset1-63/+72
Requested by Timothy Arceri. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-04-11glsl: use the BA1 macro for textureQueryLevels()Samuel Pitoiset1-32/+33
For both consistency and new bindless sampler types. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-04-11glsl: use the BA1 macro for textureSamples()Samuel Pitoiset1-9/+10
For both consistency and new bindless sampler types. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-04-11glsl: use the BA1 macro for textureCubeArrayShadow()Samuel Pitoiset1-5/+6
For both consistency and new bindless sampler types. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-04-08glsl: fix lower jumps for nested non-void returnsTimothy Arceri2-1/+10
Fixes the case were a loop contains a return and the loop is nested inside an if. Reviewed-by: Roland Scheidegger <sroland@vmware.com> https://bugs.freedesktop.org/show_bug.cgi?id=100303
2017-04-05glsl: add gl_SubGroup*ARB builtinsNicolai Hähnle3-0/+88
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-04-05glsl: add ARB_shader_ballot builtin functionsNicolai Hähnle1-0/+77
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-04-05glsl: add ARB_shader_ballot operationsNicolai Hähnle3-0/+35
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-04-05glsl: add ARB_shader_ballot enableNicolai Hähnle2-0/+3
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-04-05mesa: Replace program locks with atomic inc/dec.Matt Turner1-2/+0
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-04-04glsl: remove unused fileElie TOURNIER1-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 <elie.tournier@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-04-04glsl: Fix blob memory leakBartosz Tomczyk3-5/+16
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-03-31glsl: use -O1 optimization for builtin_functions.cpp with MinGWBrian Paul1-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 <jfonseca@vmware.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-03-31glsl: fix clockARB builtin functionNicolai Hähnle1-1/+1
The underlying intrinsic is defined to always have a uvec2 return type. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-30nir: Add support for 8 and 16-bit typesJason Ekstrand3-2/+24
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
2017-03-30nir/constant_expressions: Don't switch on bit size when not neededJason Ekstrand1-14/+23
For opcodes such as the nir_op_pack_64_2x32 for which all sources and destinations have explicit sizes, the bit_size parameter to the evaluate function is pointless and *should* do nothing. Previously, we were always switching on the bit_size and asserting if it isn't one of the sizes in the list. This generates way more code than needed and is a bit cruel because it doesn't let us have a bit_size of zero on an ALU op which shouldn't need a bit_size. Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
2017-03-30nir/constant_expressions: Pull the guts out into a helper blockJason Ekstrand1-98/+101
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
2017-03-30glsl: allow glsl_type::sampler_index() with imagesSamuel Pitoiset1-1/+1
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-03-29mesa: update lower_jumps tests after bug fixTimothy Arceri1-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 <michel.daenzer@amd.com> Bugzilla: https://bugs.freedesktop.org/100441
2017-03-28tests/cache_test: allow crossing mount pointsJuan A. Suarez Romero1-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 <nicolai.haehnle@amd.com>
2017-03-28glcpp/tests/glcpp-test-cr-lf: error out if we cannot find any testsEmil Velikov1-0/+5
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glcpp/tests/glcpp-test-cr-lf: correctly set/use srcdir/abs_builddirEmil Velikov1-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 <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glcpp/tests: update testname in help stringEmil Velikov2-2/+2
Rather than hardcoding glcpp/other use `basename "$0"` which expands appropriatelly. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glcpp/tests/glcpp-test: error out if we cannot find any testsEmil Velikov1-0/+5
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glcpp/tests/glcpp-test: print only the test basenameEmil Velikov1-2/+2
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glcpp/tests/glcpp-test: set srcdir/abs_builddir variablesEmil Velikov1-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 <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/optimization-test: 'echo' only folders which has generatorsEmil Velikov1-1/+1
The current "let's print any folder which exists" is simply confusing. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/optimization-test: print only the test basedir/nameEmil Velikov1-1/+1
The relative/absolute path brings little to no benefit in being printed as testname. Trim it out. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/optimization-test: error if zero tests were executedEmil Velikov1-0/+5
We don't want to lie ourselves that 'everything is fine' when no tests were found/ran. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/optimization-test: pass glsl_test as argumentEmil Velikov2-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 <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/optimization-test: error out if we fail to generate any testsEmil Velikov1-1/+12
v2: use -eq over a string comparison (Eric) Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/optimization-test: correctly manage srcdir/builddirEmil Velikov2-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 <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/optimisation-test: ensure that compare_ir is availableEmil Velikov1-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 <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/optimization-test: correctly set compare_irEmil Velikov1-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 <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/optimization-test: add fallback srcdir/abs_builddir definesEmil Velikov1-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 <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/optimisation-test: make sure that $PYTHON2 is set/availableEmil Velikov1-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 <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/warnings-test: print only the test basenameEmil Velikov1-1/+1
Spamming the log with the (in some cases extremely long) test location is of limited use. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/warnings-test: error if zero tests were executedEmil Velikov1-0/+5
We don't want to lie ourselves that 'everything is fine' when no tests were found/ran. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/warnings-test: correctly manage srcdir/builddirEmil Velikov1-4/+8
Before this commit, we would effectively fail to run any of the test in a OOT builds. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/warnings-test: add fallback srcdir/abs_builddir definesEmil Velikov1-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 <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests/warnings-test: error out if glsl_compiler is missingEmil Velikov1-0/+5
... or non-executable, in particular. v2: use test -x (Eric) Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> (v1) Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl: automake: export abs_builddir for the testsEmil Velikov1-0/+1
We're going to use them with the next commits to determine where to put the generated tests and/or built binaries. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl/tests: automake: cleanup all artefacts during clean-localEmil Velikov1-0/+6
With later commits we'll fix the generators to produce the files in the correct location. That in itself will cause an issue since the files will be left dangling and make distcheck will fail. v2: Use -r only as needed (Eric) Cc: Matt Turner <mattst88@gmail.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> (v1) Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-28glsl: fix spelling of embedded in commentTimothy Arceri1-1/+1