summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl/linker: add check for compute shared memory sizeNicolai Hähnle2017-10-103-6/+23
| | | | | | | | | | Unlike uniforms, the limit on shared memory size is not called out explicitly in the list of things that cause linker errors, but presumably that's just an oversight in the spec. Fixes dEQP-GLES31.functional.debug.negative_coverage.{callbacks,get_error,log}.compute.exceed_shared_memory_size_limit Reviewed-by: Timothy Arceri <[email protected]>
* glsl: tidy up IR after loop unrollingTimothy Arceri2017-10-101-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c7affbf6875622a enabled GLSLOptimizeConservatively on some drivers. The idea was to speed up compile times by running the GLSL IR passes only once each time do_common_optimization() is called. However loop unrolling can create a big mess and with large loops can actually case compile times to increase significantly due to a bunch of redundant if statements being propagated to other IRs. Here we make sure to clean things up before moving on. There was no measureable difference in shader-db compile times, but it makes compile times of some piglit tests go from a couple of seconds to basically instant. The shader-db results seemed positive also: Totals: SGPRS: 2829456 -> 2828376 (-0.04 %) VGPRS: 1720793 -> 1721457 (0.04 %) Spilled SGPRs: 7707 -> 7707 (0.00 %) Spilled VGPRs: 33 -> 33 (0.00 %) Private memory VGPRs: 3140 -> 2060 (-34.39 %) Scratch size: 3308 -> 2180 (-34.10 %) dwords per thread Code Size: 79441464 -> 79214616 (-0.29 %) bytes LDS: 436 -> 436 (0.00 %) blocks Max Waves: 558670 -> 558571 (-0.02 %) Wait states: 0 -> 0 (0.00 %) Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* glsl: make loop unrolling more like the nir unrolling pathTimothy Arceri2017-10-103-67/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code assumed that loop terminators will always be at the start of the loop, resulting in otherwise unrollable loops not being unrolled at all. For example the current code would unroll: int j = 0; do { if (j > 5) break; ... do stuff ... j++; } while (j < 4); But would fail to unroll the following as no iteration limit was calculated because it failed to find the terminator: int j = 0; do { ... do stuff ... j++; } while (j < 4); Also we would fail to unroll the following as we ended up calculating the iteration limit as 6 rather than 4. The unroll code then assumed we had 3 terminators rather the 2 as it wasn't able to determine that "if (j > 5)" was redundant. int j = 0; do { if (j > 5) break; ... do stuff ... if (bool(i)) break; j++; } while (j < 4); This patch changes this pass to be more like the NIR unrolling pass. With this change we handle loop terminators correctly and also handle cases where the terminators have instructions in their branches other than a break. V2: - fixed regression where loops with a break in else were never unrolled in v1. - fixed confusing/wrong naming of bools in complex unrolling. Reviewed-by: Nicolai Hähnle <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* glsl: check if induction var incremented before use in terminatorTimothy Arceri2017-10-101-0/+38
| | | | | | | | | | | | | | | | | | do-while loops can increment the starting value before the condition is checked. e.g. do { ndx++; } while (ndx < 3); This commit changes the code to detect this and reduces the iteration count by 1 if found. V2: fix terminator spelling Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Elie Tournier <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* glsl: don't drop instructions from unreachable terminators continue branchTimothy Arceri2017-10-102-8/+27
| | | | | | | | | | | | | These instructions will be executed on every iteration of the loop we cannot drop them. V2: - move removal of unreachable terminators from the terminator list to the same place they are removed from the IR as suggested by Nicolai. Reviewed-by: Nicolai Hähnle <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* meson: Build i965 and dri stackDylan Baker2017-10-093-5/+356
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This gets pretty much the entire classic tree building, as well as i965, including the various glapis. There are some workarounds for bugs that are fixed in meson 0.43.0, which is due out on October 8th. I have tested this with piglit using glx. v2: - fix typo "vaule" -> "value" - use gtest dep instead of linking to libgtest (rebase error) - use gtest dep instead of linking against libgtest (rebase error) - copy the megadriver, then create hard links from that, then delete the megadriver. This matches the behavior of the autotools build. (Eric A) - Use host_machine instead of target_machine (Eric A) - Put a comment in the right place (Eric A) - Don't have two variables for the same information (Eric A) - Put pre_args at top of file in this patch (Eric A) - Fix glx generators in this patch instead of next (Eric A) - Remove -DMESON hack (Eric A) - add sha1_h to mesa in this patch (Eric A) - Put generators in loops when possible to reduce code in mapi/glapi/gen (Eric A) v3: - put HAVE_X11_PLATFORM in this patch Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Remove spurious assertionsIan Romanick2017-10-021-2/+0
| | | | | | | | It's inside an if-statement that already checks that the variables are not NULL. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl: Move 'foo = foo;' optimization to opt_dead_code_localIan Romanick2017-10-022-12/+18
| | | | | | | | | | | | The optimization as done in opt_copy_propagation would have to be removed in the next patch. If we just eliminate that optimization altogether, shader-db results, even on platforms that use NIR, are hurt quite substantially. I have not investigated why NIR isn't picking up the slack here. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Cc: Jason Ekstrand <[email protected]>
* glsl/ast: Use logical-or instead of conditional assignment to set fallthru_varIan Romanick2017-10-021-4/+4
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl/ast: Generate a more compact expression to disable execution of default ↵Ian Romanick2017-10-021-21/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | case Instead of generating a sequence like: run_default = true; if (i == 3) // some label that appears after default run_default = false; if (i == 4) // some label that appears after default run_default = false; ... if (run_default) { ... } generate something like: run_default = !((i == 3) || (i == 4) || ...); if (run_default) { ... } This eliminates one use of conditional assignment, and it enables the elimination of another. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl/ast: Explicitly track the set of case labels that occur after defaultIan Romanick2017-10-021-22/+49
| | | | | | | | | | | | Previously the instruction stream was walked looking for comparisons with case-label values. This should generate nearly identical code. For at least fs-default-notlast-fallthrough.shader_test, the code is identical. This change will make later changes possible. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl/ast: Convert ast_case_label::hir to ir_builderIan Romanick2017-10-021-24/+11
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl/ast: Use ir_binop_equal instead of ir_binop_all_equalIan Romanick2017-10-021-15/+24
| | | | | | | | | | | | | | | The values being compared are scalars, so these are the same. While I'm here, simplify the run_default condition to just deref the flag (instead of comparing a scalar bool with true). There is a bit of extra change in this patch. When constructing an ir_binop_equal ir_expression, there is an assertion that the types are the same. There is no such assertion for ir_binop_all_equal, so passing glsl_type::uint_type with glsl_type::int_type was previously fine. A bunch of the code motion is to deal with that. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl/ast: Stop processing a switch-statement after an error in the ↵Ian Romanick2017-10-021-0/+1
| | | | | | | | | | | | | | | init-expression This happens to work now because ir_binop_all_equal is used. This causes vector typed init-expressions to produce scalar Boolean values after comparison. The next commit changes ir_binop_all_equal to ir_binop_equal. Vector typed init-expressions will then produce vector Boolean values, and, in debug builds, the ir_assignment constructor will fail an assertion. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl: Don't pass NULL to ir_assignment constructor when not necessaryIan Romanick2017-10-028-35/+27
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl: Convert lower_variable_index_to_cond_assign to ir_builderIan Romanick2017-10-023-105/+65
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl: Fix coding standards issues in lower_variable_index_to_cond_assignIan Romanick2017-10-021-78/+76
| | | | | | | | Mostly tabs-before-spaces, but there was some other trivium too. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* glsl: Convert lower_vec_index_to_cond_assign to using ir_builderIan Romanick2017-10-021-39/+17
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* glsl: Return ir_variable from compare_index_blockIan Romanick2017-10-023-16/+20
| | | | | | | | | This is basically a wash now, but it simplifies later patches that convert to using ir_builder. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* glsl: Fix coding standards issues in lower_vec_index_to_cond_assignIan Romanick2017-10-021-16/+12
| | | | | | | | Mostly tabs-before-spaces, but there was some other trivium too. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* glsl: Fix coding standards issues in lower_if_to_cond_assignIan Romanick2017-10-021-48/+47
| | | | | | | | Mostly tabs-before-spaces issues. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* glsl: do not set the 'smooth' qualifier by default on ES shadersNicolai Hähnle2017-10-022-12/+16
| | | | | | | | | | | | It leads to surprising states with integer inputs and outputs on vertex processing stages (e.g. geometry stages). Instead, rely on the driver to choose smooth interpolation by default. We still allow varyings to match when one stage declares it as smooth and the other declares it without interpolation qualifiers. Reviewed-by: Marek Olšák <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* glsl/lower_instruction: handle denorms and overflow in ldexp correctlyNicolai Hähnle2017-09-291-64/+107
| | | | | | | | | | | | | GLSL ES requires both, and while GLSL explicitly doesn't require correct overflow handling, it does appear to require handling input inf/denorms correctly. Fixes dEQP-GLES31.functional.shaders.builtin_functions.precision.ldexp.* Cc: [email protected] Acked-by: Matt Turner <[email protected]> Acked-by: Marek Olšák <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* meson: Add build Intel "anv" vulkan driverDylan Baker2017-09-271-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows building and installing the Intel "anv" Vulkan driver using meson and ninja, the driver has been tested against the CTS and has seems to pass the same series of tests (they both segfault when the CTS tries to run wayland wsi tests). There are still a mess of TODO, XXX, and FIXME comments in here. Those are mostly for meson bugs I'm trying to fix, or for additional things to implement for other drivers/features. I have configured all intermediate libraries and optional tools to not build by default, meaning they will only be built if they're pulled in as a dependency of a target that will actually be installed) this allows us to avoid massive if chains, while ensuring that only the bits that need to be built are. v2: - enable anv, x11, and wayland by default - add configure option to disable valgrind v3: - fix typo in meson_options (Nicholas) v4: - Remove dead code (Eric) - Remove change to generator that was from v0 (Eric) - replace if chain with loop (Eric) - Fix typos (Eric) - define HAVE_DLOPEN for both libdl and builtin dl cases (Eric) v5: - rebase on util string buffer implementation Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]> (v4)
* glcpp: Avoid unnecessary call to strlenThomas Helland2017-09-262-9/+39
| | | | | | | | | | | | | | | | | | Length of the token was already calculated by flex and stored in yyleng, no need to implicitly call strlen() via linear_strdup(). Signed-off-by: Thomas Helland <[email protected]> Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com> V2: Also convert this pattern in glsl_lexer.ll V3: Remove a misplaced comment V4: Use a temporary char to avoid type change Remove bogus +1 on length check of identifier
* glcpp: Use string_buffer for line continuation removalThomas Helland2017-09-261-7/+18
| | | | | | | | | | | | | Migrate removal of line continuations to string_buffer. Before this it used ralloc_strncat() to append strings, which internally each time calculates strlen() of its argument. Its argument is entire shader, so it multiple time scans the whole shader text. Signed-off-by: Vladislav Egorov <[email protected]> Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com> V2: Adapt to different API of string buffer (Thomas Helland)
* glsl: Change the parser to use the string bufferThomas Helland2017-09-263-164/+78
| | | | | | | | | | | | | | | Signed-off-by: Thomas Helland <[email protected]> Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com> V2: Pointed out by Timothy - Fix pp.c reralloc size issue and comment V3 - Use vprintf instead of printf where we should - Fixes failing make-check tests V4 - Use buffer_append_char in a couple places - Use append_char in even more places
* glsl: mark xfb varyings as always activeTimothy Arceri2017-09-261-0/+3
| | | | | | | | This will be used by the nir linking pass so that we don't remove otherwise unused varyings. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* nir: add always_active_io to nir variableTimothy Arceri2017-09-261-0/+1
| | | | | | | | Will be used in nir link pass to decided if we can remove a varying or not. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* glsl: silence signed/unsigned comparison warningBrian Paul2017-09-211-1/+1
| | | | Reviewed-by: Samuel Pitoiset <[email protected]>
* glsl/linker: properly fix output variable overlap checkNicolai Hähnle2017-09-211-6/+12
| | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102904 Fixes: 15cae12804e ("glsl/linker: fix output variable overlap check") Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: merge loop_controls.cpp with loop_unroll.cppTimothy Arceri2017-09-214-127/+34
| | | | | | | Having this separate just makes the code harder to follow, and requires an extra walk of the IR. Reviewed-by: Thomas Helland <[email protected]>
* glsl: move loop analysis helpers to loop_analysis.cppTimothy Arceri2017-09-213-146/+139
| | | | Reviewed-by: Thomas Helland <[email protected]>
* glsl/linker: fix output variable overlap checkNicolai Hähnle2017-09-201-6/+11
| | | | | | | | | | | | | | | | | Prevent an overflow caused by too many output variables. To limit the scope of the issue, write to the assigned array only for the non-ES fragment shader path, which is the only place where it's needed. Since the function will bail with an error when output variables with overlapping components are found, (max # of FS outputs) * 4 is an upper limit to the space we need. Found by address sanitizer. Fixes dEQP-GLES3.functional.attribute_location.bind_aliasing.* Cc: [email protected] Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Unify ir_constant::const_elements and ::componentsIan Romanick2017-09-196-113/+24
| | | | | | | | | | There was no reason to treat array types and record types differently. Unifying them saves a bunch of code and saves a few bytes in every ir_constant. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Elie Tournier <[email protected]>
* glsl: Rename ir_constant::array_elements to ::const_elementsIan Romanick2017-09-196-22/+22
| | | | | | | | | | | The next patch will unify ::array_elements and ::components, so the name ::array_elements wouldn't be appropriate. A lot of things use the names array_elements and components, so grepping for either is pretty useless. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Elie Tournier <[email protected]>
* glsl: Silence unused parameter warningsIan Romanick2017-09-196-19/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glsl/ast_type.cpp: In function ‘void merge_bindless_qualifier(YYLTYPE*, _mesa_glsl_parse_state*, const ast_type_qualifier&, const ast_type_qualifier&)’: glsl/ast_type.cpp:189:35: warning: unused parameter ‘loc’ [-Wunused-parameter] merge_bindless_qualifier(YYLTYPE *loc, ^~~ glsl/ast_type.cpp:191:52: warning: unused parameter ‘qualifier’ [-Wunused-parameter] const ast_type_qualifier &qualifier, ^~~~~~~~~ glsl/ast_type.cpp:192:52: warning: unused parameter ‘new_qualifier’ [-Wunused-parameter] const ast_type_qualifier &new_qualifier) ^~~~~~~~~~~~~ glsl/ir_constant_expression.cpp: In member function ‘virtual ir_constant* ir_rvalue::constant_expression_value(void*, hash_table*)’: glsl/ir_constant_expression.cpp:512:44: warning: unused parameter ‘mem_ctx’ [-Wunused-parameter] ir_rvalue::constant_expression_value(void *mem_ctx, struct hash_table *) ^~~~~~~ glsl/ir_constant_expression.cpp: In member function ‘virtual ir_constant* ir_texture::constant_expression_value(void*, hash_table*)’: glsl/ir_constant_expression.cpp:705:45: warning: unused parameter ‘mem_ctx’ [-Wunused-parameter] ir_texture::constant_expression_value(void *mem_ctx, struct hash_table *) ^~~~~~~ glsl/ir_constant_expression.cpp: In member function ‘virtual ir_constant* ir_assignment::constant_expression_value(void*, hash_table*)’: glsl/ir_constant_expression.cpp:851:48: warning: unused parameter ‘mem_ctx’ [-Wunused-parameter] ir_assignment::constant_expression_value(void *mem_ctx, struct hash_table *) ^~~~~~~ glsl/ir_constant_expression.cpp: In member function ‘virtual ir_constant* ir_constant::constant_expression_value(void*, hash_table*)’: glsl/ir_constant_expression.cpp:859:46: warning: unused parameter ‘mem_ctx’ [-Wunused-parameter] ir_constant::constant_expression_value(void *mem_ctx, struct hash_table *) ^~~~~~~ glsl/linker.cpp: In function ‘void link_xfb_stride_layout_qualifiers(gl_context*, gl_shader_program*, gl_linked_shader*, gl_shader**, unsigned int)’: glsl/linker.cpp:1655:60: warning: unused parameter ‘linked_shader’ [-Wunused-parameter] struct gl_linked_shader *linked_shader, ^~~~~~~~~~~~~ glsl/linker.cpp: In function ‘void link_bindless_layout_qualifiers(gl_shader_program*, gl_program*, gl_shader**, unsigned int)’: glsl/linker.cpp:1693:52: warning: unused parameter ‘gl_prog’ [-Wunused-parameter] struct gl_program *gl_prog, ^~~~~~~ glsl/lower_distance.cpp: In member function ‘virtual void {anonymous}::lower_distance_visitor_counter::handle_rvalue(ir_rvalue**)’: glsl/lower_distance.cpp:652:59: warning: unused parameter ‘rv’ [-Wunused-parameter] lower_distance_visitor_counter::handle_rvalue(ir_rvalue **rv) ^~ glsl/opt_array_splitting.cpp: In member function ‘virtual ir_visitor_status {anonymous}::ir_array_reference_visitor::visit_leave(ir_assignment*)’: glsl/opt_array_splitting.cpp:198:56: warning: unused parameter ‘ir’ [-Wunused-parameter] ir_array_reference_visitor::visit_leave(ir_assignment *ir) ^~ glsl/glsl_parser_extras.cpp: In function ‘void assign_subroutine_indexes(gl_shader*, _mesa_glsl_parse_state*)’: glsl/glsl_parser_extras.cpp:1869:45: warning: unused parameter ‘sh’ [-Wunused-parameter] assign_subroutine_indexes(struct gl_shader *sh, ^~ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Elie Tournier <[email protected]>
* glsl: buffer variables can be readonly and writeonlyJuan A. Suarez Romero2017-09-191-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | In GLSL ES 3.10 session 4.9 [Memory Access Qualifiers], it has the following description: "A variable could be qualified as both readonly and writeonly, disallowing both read and write, but still be passed to imageSize() to have the size queried.". This is for image variable, but not for buffer variables. According to https://github.com/KhronosGroup/OpenGL-API/issues/7 Khronos intent is to allow both readonly and writeonly in buffer variables, and as such it will update the GLSL specification. This commit address this issue, and fixes: KHR-GL{43,44,45}.shader_storage_buffer_object.basic-readonly-writeonly KHR-GLES31.core.shader_storage_buffer_object.basic-readonly-writeonly v2: set correctly fields[i] memory flags (Samuel Pitoiset). Reviewed-by: Samuel Pitoiset <[email protected]>
* glsl: replace conditional compilation with MAYBE_UNUSEDEric Engestrom2017-09-191-3/+2
| | | | | | Suggested-by: Nicolai Hähnle <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* glsl: avoid accessing invalid memory after get_variable_being_redeclared()Iago Toral Quiroga2017-09-141-20/+19
| | | | | | | | | | | | | | After get_variable_being_redeclared() has been called, it is no longer safe to access the original variable pointer, since its memory might have been freed. Since callers of this function should only be accessing the variable pointer returned by the function, avoid potential bugs by re-assigning the original variable pointer to the result of the function call, making it impossible for the remaining code to access an invalid variable pointer. Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: make the redeclared variable NULL if it is deletedIago Toral Quiroga2017-09-141-3/+6
| | | | | | | | | | | | | | get_variable_being_redeclared() can delete the original variable in a specific scenario. The code sets it to NULL after this so other code in that same function doesn't try to access trashed memory after the fact, however, the copy of that variable in the caller code won't see any of this making it very easy to overlook. Make the function a bit safer by taking a pointer to the original variable so we can also make NULL the caller's pointer to the variable if this function deletes it. Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: use 'declared_var' instead of 'var' after checking redeclarationsIago Toral Quiroga2017-09-141-2/+2
| | | | | | | | | Since the original 'var' might have been deleted from this point forward. Bugzila: https://bugs.freedesktop.org/show_bug.cgi?id=102685 Fixes: 51bf007d2c27fba (glsl: Disallow unsized array of atomic_uint) Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: compile unused function outEric Engestrom2017-09-131-0/+2
| | | | | | | | | The function is only called from one place, which is hidden behind the same `#ifdef DEBUG`. Fixes: ca73c3358c91434e68ab "glsl: Mark functions static" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util/disk_cache: turn MESA_GLSL_CACHE_DISABLE into a booleanEric Engestrom2017-09-121-2/+2
| | | | | | | | | | Instead of setting based on set/unset, allow users to use boolean values. In the docs and tests, use `DISABLE=true` instead of `DISABLE=1` as it's clearer IMO. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glsl: Disallow unsized array of atomic_uintIago Toral Quiroga2017-09-121-0/+11
| | | | | | | | | | This was a bugfix to the spec addressed in OpenGL 4.5 (revision 7 of the spec) and there is a CTS test to check this. Fixes: KHR-GL45.shader_atomic_counters.negative-unsized-array Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: define YY_NO_INPUT to prevent unused symbol warningsMatt Turner2017-08-291-0/+1
| | | | | | | | | | | | Otherwise clang warns: glsl/glsl_lexer.cpp:3507:16: warning: function 'yyinput' is not needed and will not be emitted [-Wunneeded-internal-declaration] static int yyinput (yyscan_t yyscanner) ^ Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util: move string_to_uint_map to glslEmil Velikov2017-08-298-6/+225
| | | | | | | | | | | | | | | | | | The functionality is used by glsl and mesa. With the latter already depending on the former. With this in place the src/util/ static library libmesautil.la no longer has a C++ dependency. Thus objects which use it (like libEGL) don't need the C++ link. Cc: "17.2" <[email protected]> Fixes: 02cc35937277 ("egl/wayland: Use linux-dmabuf interface for buffers") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101851 Signed-off-by: Emil Velikov <[email protected]> Suggested-by: Jason Ekstrand <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Tested-by: Mike Lothian <[email protected]> Tested-by: James Harvey <[email protected]>
* glsl: fix counting of vertex shader output slots used by explicit varsIlia Mirkin2017-08-281-1/+2
| | | | | | | | | | | | The argument to count_attribute_slots should only be set to true for vertex inputs, not for all vertex shader varyings. Fixes KHR-GL45.enhanced_layouts.varying_locations Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Cc: [email protected]
* glsl: fix glsl_struct_field size calculations for shader cacheNicolai Hähnle2017-08-251-7/+4
| | | | | | | | | | | | | | | | | | Found by address sanitizer: ==22621==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61400000cbd8 at pc 0x7f561610a4ff bp 0x7ffca85f9d50 sp 0x7ffca85f94f8 READ of size 344 at 0x61400000cbd8 thread T0 #0 0x7f561610a4fe (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5f4fe) #1 0x7f560bb305a5 in memcpy /usr/include/x86_64-linux-gnu/bits/string3.h:53 #2 0x7f560bb305a5 in blob_write_bytes ../../../mesa-src/src/compiler/glsl/blob.c:136 #3 0x7f560be7d7ff in encode_type_to_blob ../../../mesa-src/src/compiler/glsl/shader_cache.cpp:153 #4 0x7f560be81222 in write_program_resource_data ../../../mesa-src/src/compiler/glsl/shader_cache.cpp:950 #5 0x7f560be81222 in write_program_resource_list ../../../mesa-src/src/compiler/glsl/shader_cache.cpp:1118 #6 0x7f560be81222 in shader_cache_write_program_metadata(gl_context*, gl_shader_program*) ../../../mesa-src/src/compiler/glsl/shader_cache.cpp:1407 #7 0x7f560b825fdb in link_program ../../../mesa-src/src/mesa/main/shaderapi.c:1163 Fixes: 073a84ff60db ("glsl: stop adding pointers from glsl_struct_field to the cache") Reviewed-by: Timothy Arceri <[email protected]>
* glsl: pass shader source keys to the disk cacheTimothy Arceri2017-08-252-9/+23
| | | | | | | We don't actually write them to disk here. That will happen in the following commit. Reviewed-by: Nicolai Hähnle <[email protected]>