aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
Commit message (Collapse)AuthorAgeFilesLines
...
* nir/samplers: don't zero samplers_used/txf.Dave Airlie2019-12-021-3/+0
| | | | | | | | | | | This allows this pass to be run multiple times and the results are just or'ed together. It fixes on test on llvmpipe nir, and regresses none. Suggested by Kenneth Reviewed-by: Marek Olšák <[email protected]>
* glsl: handle max uniform limits with lower_const_arrays_to_uniformsTapani Pälli2019-11-283-5/+40
| | | | | | | Fixes arb_tessellation_shader-large-uniforms Piglit test. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* driconf, glsl: Add a vs_position_always_invariant optionKenneth Graunke2019-11-271-0/+6
| | | | | | | | | | | | | | | | | | | | Many applications use multi-pass rendering and require their vertex shader position to be computed the same way each time. Optimizations may consider, say, fusing a multiply-add based on global usage of an expression in a shader. But a second shader with the same expression may have different code, causing that optimization to make the other choice the second time around. The correct solution is for applications to mark their VS outputs 'invariant', indicating they need multiple shaders to compute that output in the same manner. However, most applications fail to do so. So, we add a new driconf option - vs_position_always_invariant - which forces the gl_Position output in vertex shaders to be marked invariant. Fixes: 7025dbe794b ("nir: Skip emitting no-op movs from the builder.") Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add varyings to "zero-init of uninitialized vars" workaroundDanylo Piliaiev2019-11-221-1/+2
| | | | | | | | | | Varyings are similar to already handled cases. And "glsl_zero_init" name of the workaround already looks like it should include varyings. The issue was observed in GiMark subtest from GpuTest. Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: add missing initialization of the location path fieldIago Toral Quiroga2019-11-211-0/+2
| | | | | | | | | | | | | | This was apparently missed in 67b32190f3c95, which added support for ARB_shading_language_include to #line, including the 'path' field for the location. Fixes crashes in CTS with all drivers as they attempt to access an uninitialized path string during parsing. Fixes: 67b32190f3c95 ("glsl: add ARB_shading_language_include support to #line") Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2132 Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Jose Maria Casanova <[email protected]>
* mesa: add support cursor support for relative path shader includesTimothy Arceri2019-11-203-1/+36
| | | | | | | | | | | | | This will allow us to continue searching the current path for relative shader includes. From the ARB_shading_language_include spec: "If it is quoted with double quotes in a previously included string, then the first search point will be the tree location where the previously included string had been found." Reviewed-by: Witold Baryluk <[email protected]>
* glsl: delay compilation skip if shader contains an includeTimothy Arceri2019-11-201-6/+40
| | | | | | | | If the shader contains an include when need to first run the preprocessor before deciding if we can skip compilation based on the shader cache. Reviewed-by: Witold Baryluk <[email protected]>
* glsl: add can_skip_compile() helperTimothy Arceri2019-11-201-10/+20
| | | | | | We will reuse this in the following commit. Reviewed-by: Witold Baryluk <[email protected]>
* glsl: error if #include used while extension is disabledTimothy Arceri2019-11-202-0/+15
| | | | | | In other words make sure the shader does this: Reviewed-by: Witold Baryluk <[email protected]>
* glsl: add preprocessor #include supportTimothy Arceri2019-11-206-3/+192
| | | | Reviewed-by: Witold Baryluk <[email protected]>
* glsl: pass gl_context to glcpp_parser_create()Timothy Arceri2019-11-203-7/+7
| | | | | | This is a small tidy up and will be useful in the following commit. Reviewed-by: Witold Baryluk <[email protected]>
* glsl: add ARB_shading_language_include support to #lineTimothy Arceri2019-11-207-8/+80
| | | | | | | | | | | | | | | | | | | | | | From the ARB_shading_language_include spec: "#line must have, after macro substitution, one of the following forms: #line <line> #line <line> <source-string-number> #line <line> "<path>" where <line> and <source-string-number> are constant integer expressions and <path> is a valid string for a path supplied in the #include directive. After processing this directive (including its new-line), the implementation will behave as if it is compiling at line number <line> and source string number <source-string-number> or <path> path. Subsequent source strings will be numbered sequentially, until another #line directive overrides that numbering." Reviewed-by: Witold Baryluk <[email protected]>
* glsl: add infrastructure for ARB_shading_language_includeTimothy Arceri2019-11-202-0/+3
| | | | | Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Reviewed-by: Witold Baryluk <[email protected]>
* glsl_to_nir: rename image_access to mem_accessMarek Olšák2019-11-191-12/+12
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: move data.image.access to data.accessMarek Olšák2019-11-192-4/+4
| | | | | | The size of the data structure doesn't change. Reviewed-by: Connor Abbott <[email protected]>
* glsl: Check earlier for MaxTextureImageUnits and MaxImageUniformsCaio Marcelo de Oliveira Filho2019-11-112-12/+24
| | | | | | | | | | | | | | Currently the linker do all the work then check for the limits, which means num_textures and num_images in shader_info may have to store more than the limit. This breaks down now since shader_info was packed and doesn't expect to store larger invalid values. To fix this, pull the check before we set the counts in shader_info. Add necessary plumbing to make sure we bail once those errors are found. Fixes: 84a1a2578da ("compiler: pack shader_info from 160 bytes to 96 bytes") Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Check earlier for MaxShaderStorageBlocks and MaxUniformBlocksCaio Marcelo de Oliveira Filho2019-11-111-16/+16
| | | | | | | | | | | | | | | Currently the linker do all the work then check for the limits, which means num_ssbos and num_ubos in shader_info may have to store more than the limit. This breaks down now since shader_info was packed and doesn't expect to store larger invalid values. To fix this, pull the check before we set the counts in shader_info. One drawback of this approach is that for some cases we might not see the collected errors from various stages, but bail as soon as a stage breaks the limits. Fixes: 84a1a2578da ("compiler: pack shader_info from 160 bytes to 96 bytes") Reviewed-by: Timothy Arceri <[email protected]>
* glsl/linker: pass shader_info to analyze_clip_cull_usage directlyMarek Olšák2019-11-081-16/+9
| | | | | | This will be needed by the next commit. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* nir: fix unused variable warning in find_and_update_previous_uniform_storageKai Wasserbäch2019-11-071-1/+1
| | | | | | | | | | | This commit fixes the following warning: ../src/compiler/glsl/gl_nir_link_uniforms.c: In function ‘find_and_update_previous_uniform_storage’: ../src/compiler/glsl/gl_nir_link_uniforms.c:166:16: warning: unused variable ‘num_blks’ [-Wunused-variable] 166 | unsigned num_blks = nir_variable_is_in_ubo(var) ? | ^~~~~~~~ Signed-off-by: Kai Wasserbäch <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Handle image arrays when setting variable dataKenneth Graunke2019-11-041-1/+1
| | | | | | | Fixes a ton of regressions in image load store tests. Fixes: 4319cc8c0f5 ("nir: pack nir_variable::data::xfb_*") Acked-by: Alyssa Rosenzweig <[email protected]>
* nir: pack nir_variable::data::xfb_*Marek Olšák2019-11-041-4/+7
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: pack nir_variable::data::streamMarek Olšák2019-11-041-0/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* compiler: make variable::data::binding unsignedMarek Olšák2019-11-041-1/+1
| | | | | | Nothing seems to set a negative value. Reviewed-by: Connor Abbott <[email protected]>
* glsl: disable lower_fragdata_array() for NIR driversTimothy Arceri2019-11-011-1/+2
| | | | | | | | | | | | | | This function was added in 7e414b58640a to work around a defect in lower_output_reads(). As of the previous commit no NIR driver calls lower_output_reads(). This change means we don't need the special GLSL IR style gl_FragData handling for building the resource list in a NIR based linker. No shader-db change on SKL i965. Reviewed-by: Marek Olšák <[email protected]>
* glsl: Enable textureSize for samplerExternalOESYevhenii Kolesnikov2019-10-311-0/+2
| | | | | | | | | From OES_EGL_image_external_essl3 Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1901 Signed-off-by: Yevhenii Kolesnikov <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* glsl: Initialize all fields of ir_variable in constructorDanylo Piliaiev2019-10-281-0/+23
| | | | | | | | | | | Better be safe, even if we could technically avoid this for some fields. Cc: <[email protected]> Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1999 Signed-off-by: Danylo Piliaiev <[email protected]> Tested-by: Witold Baryluk <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* glsl/serialize: optimize for equal offsets in uniform remap tablesMarek Olšák2019-10-251-2/+28
| | | | | | | | Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1416 This decreases the shader cache size in the ticket from 1.6 MB to 40 KB. Reviewed-by: Timothy Arceri <[email protected]>
* glsl/serialize: restructure remap table codeMarek Olšák2019-10-251-63/+56
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* glsl: remove propagate_invariance() call from the linkerTimothy Arceri2019-10-241-2/+0
| | | | | | This was added in 586f4a42e78f and became redundant with 34ab9b0947cd Reviewed-by: Marek Olšák <[email protected]>
* nir: add amul instructionRob Clark2019-10-181-1/+1
| | | | | | | | | | | | Used for address/offset calculation (ie. array derefs), where we can potentially use less than 32b for the multiply of array idx by element size. For backends that support `imul24`, this gives a lowering pass an easy way to find multiplies that potentially can be converted to `imul24`. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* glsl: fix crash compiling bindless samplers inside unnamed UBOsTimothy Arceri2019-10-121-5/+5
| | | | | | | | | | The check to see if we were dealing with a buffer block was too late and only worked for named UBOs. Fixes: f32b01ca435c "glsl/linker: remove ubo explicit binding handling" Reviewed-by: Marek Olšák <[email protected]> Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1900
* glsl/builtin: Add alternate versions of atan using new opsNeil Roberts2019-10-121-2/+31
| | | | | | | | | | Adds alternate versions of the atan builtin functions that use ir_unop_atan and ir_binop_atan2 instead of inlining to the IR implementation of the function. These alternatives are selected if the IR is going to be consumed by NIR. In that case the IR ops will be translated to the appropriate NIR op. Reviewed-by: Kristian H. Kristensen <[email protected]>
* glsl: Add opcodes for atan and atan2Neil Roberts2019-10-124-0/+27
| | | | | | | | Adds ir_binop_atan2 and ir_unop_atan. When converting to NIR these are expanded out using the appropriate builtin generator. If they are used with anything else then it will just hit an assert. Reviewed-by: Kristian H. Kristensen <[email protected]>
* glsl/tests: Handle no-exec errorsDylan Baker2019-10-102-4/+42
| | | | | | | | | | Currently meson doesn't correctly handle passing compiled binaries to scripts in tests. This patch looks to the future (0.53) when meson will have this functionality, but also immediately it fixes these tests in cross compiles by causing them to return 77, which meson interprets as skip. Acked-by: Kristian H. Kristensen <[email protected]>
* meson: glcpp tests are expected to fail on windowsDylan Baker2019-10-101-1/+2
| | | | | | v2: - Exclude the tests rather than xfail them Acked-by: Kristian H. Kristensen <[email protected]>
* meson: Add idep_getopt for testsDylan Baker2019-10-102-4/+4
| | | | | | | There are quite a few tests that require getopt, when using MSVC we need to use the bundled version of getopt since there isn't a system version. Acked-by: Kristian H. Kristensen <[email protected]>
* meson: force inclusion of inttypes.h for glcpp with msvcDylan Baker2019-10-101-2/+12
| | | | | | | Because we provide a copy if MSVC doesn't, and we need it to make flex do what we want. Acked-by: Kristian H. Kristensen <[email protected]>
* nir: move gl_nir_opt_access from glsl directoryMarek Olšák2019-10-103-340/+0
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meson: drop duplicate inc_nir from libglslEric Engestrom2019-10-071-1/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* glsl: Add helperInvocationEXT() builtinCaio Marcelo de Oliveira Filho2019-09-303-0/+47
| | | | | | | | | | | From EXT_demote_to_helper_invocation, implemented with the existing nir_intrinsic_is_helper_invocation. Such builtin is necessary when using `demote` because we can't redefine the value of gl_HelperInvocation (since it is an input variable). Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Parse `demote` statementCaio Marcelo de Oliveira Filho2019-09-305-1/+49
| | | | | | | When the EXT_demote_to_helper_invocation extension is enabled, `demote` is treated as a keyword, and produces an ir_demote. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add ir_demoteCaio Marcelo de Oliveira Filho2019-09-309-0/+81
| | | | | | | | | | | | | | | To represent the new `demote` keyword when using EXT_demote_to_helper_invocation extension. Most of the changes are to include it in the visitors. Demote is not considered a control flow, so also include an empty visit member function in ir_control_flow_visitor. Only NIR actually supports `demote`, so assert the translations for TGSI and Mesa's gl_program -- since the demote is not expected to appear for those. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Extension boilerplate for EXT_demote_to_helper_invocationCaio Marcelo de Oliveira Filho2019-09-302-0/+3
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: turn runtime asserts of compile-time value into compile-time assertsEric Engestrom2019-09-251-6/+12
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Erik Faye-Lund <[email protected]>
* glsl: correct bitcast-helpersErik Faye-Lund2019-09-251-2/+2
| | | | | | | | | | | | Without this, we'll incorrectly round off huge values to the nearest representable double instead of keeping it at the exact value as we're supposed to. Found by inspecting compiler-warnings. Signed-off-by: Erik Faye-Lund <[email protected]> Fixes: 85faf5082f ("glsl: Add 64-bit integer support for constant expressions") Reviewed-by: Eric Engestrom <[email protected]>
* Move blob from compiler/ to util/Jason Ekstrand2019-09-192-340/+0
| | | | | | | | There's nothing whatsoever compiler-specific about it other than that's currently where it's used. Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* glsl/nir: Add and use a gl_nir_link() functionCaio Marcelo de Oliveira Filho2019-09-102-0/+24
| | | | | | | | | Perform all the NIR linking steps in order. Change iris and i965 to use it. Suggested by Alejandro. v2: Add gl_nir_linker_options struct. Reviewed-by: Alejandro Piñeiro <[email protected]> [v1]
* glsl/nir: Fill in the Parameters in NIR linkerCaio Marcelo de Oliveira Filho2019-09-103-2/+76
| | | | | | | | | | | | | | | | | | | | | The parameter lists were not being created nor filled since i965 doesn't use them. In Gallium they are used for uniform handling, so add a way to fill them. The gl_uniform_storage struct got two new fields that let us go - from a Parameter to the matching UniformStorage and, - from the variable to the *first* UniformStorage without relying on names -- since they are optional for ARB_gl_spirv. Later patches will make use of them. v2: Do not fill parameters for i965. (Timothy) Use uint32_t for the new attributes. (Marek) v3: Serialize the new fields. (Timothy) Reviewed-by: Timothy Arceri <[email protected]>
* glsl/nir: Avoid overflow when setting max_uniform_locationCaio Marcelo de Oliveira Filho2019-09-101-1/+2
| | | | | | | | | Don't use the UNMAPPED_UNIFORM_LOC (-1) to set the unsigned max_uniform_location. Those unmapped uniforms don't have to be accounted at this point. Fixes: 7a9e5cdfbb9 ("nir/linker: Add gl_nir_link_uniforms()") Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl/tests: Handle windows \r\n new linesDylan Baker2019-09-101-1/+1
| | | | | | | | | Currently the praser for s expressions assumes that newlines will be \n, resulting in incorrect parsing on windows, where the newline is \r\n. This patch just adds \r? to the regular expression used to parse the s expressions, which fixes at 1 test on windows. Reviewed-by: Eric Engestrom <[email protected]>