Summary: | shader crashing glsl_compiler (uniform block assigned to vec2, then component substraced by 1) | ||
---|---|---|---|
Product: | Mesa | Reporter: | Karol Herbst <karolherbst> |
Component: | glsl-compiler | Assignee: | mesa-dev |
Status: | RESOLVED FIXED | QA Contact: | Intel 3D Bugs Mailing List <intel-3d-bugs> |
Severity: | normal | ||
Priority: | medium | ||
Version: | git | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | shader.frag |
seems to only happen with a certain build config (doesn't happen on my debug build). Will investigate. crashes only with "-Dbuildtype=release" Proposed patch: https://patchwork.freedesktop.org/patch/249568/ One more version: https://patchwork.freedesktop.org/series/48256/ Should be fixed by: commit 6f3c7374b11299c21d829db794fad3b756af60fb Author: Danylo Piliaiev <danylo.piliaiev@gmail.com> Date: Wed Aug 15 15:46:22 2018 +0300 Date: Wed Aug 15 15:46:22 2018 +0300 glsl: Avoid propagating incompatible type of initializer do_assignment validated assigment but when rhs type was not compatible it proceeded without issues and returned error_emitted = false. On the other hand process_initializer expected do_assignment to always return compatible type and never fail. As a result when variable was initialized with incompatible type the type of variable changed to the incompatible one. This manifested in unnecessary error messages and in one case in crash. Example GLSL: vec4 tmp = vec2(0.0); tmp.z -= 1.0; Past error messages: initializer of type vec2 cannot be assigned to variable of type vec4 invalid swizzle / mask `z' type mismatch operands to arithmetic operators must be numeric After this patch: initializer of type vec2 cannot be assigned to variable of type vec4 In the other case when we initialize variable with incompatible struct, accessing variable's field leaded to a crash. Example: uniform struct {float field;} data; ... vec4 tmp = data; tmp.x -= 1.0; After the patch there is only error line without a crash: initializer of type #anon_struct cannot be assigned to variable of type vec4 Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107547 |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.
Created attachment 141048 [details] shader.frag see the attached shader. no program output backtrace: #0 __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31 #1 0x00000000005e6723 in glsl_type::field_type (this=0x896090, name=0x0) at ../src/compiler/glsl_types.cpp:1228 #2 0x0000000000481f98 in ir_dereference_record::ir_dereference_record (this=0x88b800, value=0x88b870, field=0x0) at ../src/compiler/glsl/ir.cpp:1429 #3 0x00000000004636e9 in ir_dereference_record::clone (this=0x88b3f0, mem_ctx=0x8836d0, ht=<optimized out>) at ../src/compiler/glsl/ir_clone.cpp:199 #4 0x0000000000572d67 in ast_expression::do_hir (this=0x88a200, instructions=0x896480, state=0x8836d0, needs_rvalue=<optimized out>) at ../src/compiler/glsl/ast_to_hir.cpp:1703 #5 0x000000000057680e in ast_expression::hir_no_rvalue (this=0x0, instructions=0x8961e0, state=0x0) at ../src/compiler/glsl/ast_to_hir.cpp:1307 #6 0x0000000000579f5d in ast_expression_statement::hir (this=<optimized out>, instructions=0x896480, state=0x8836d0) at ../src/compiler/glsl/ast_to_hir.cpp:2227 #7 0x000000000057a0a9 in ast_compound_statement::hir (this=0x88a2d0, instructions=0x896480, state=0x8836d0) at ../src/compiler/glsl/ast_to_hir.cpp:2243 #8 0x0000000000588b17 in ast_function_definition::hir (this=0x88a330, instructions=<optimized out>, state=0x8836d0) at ../src/compiler/glsl/ast_to_hir.cpp:6191 #9 0x0000000000571729 in _mesa_ast_to_hir (instructions=0x8885a0, state=0x8836d0) at ../src/compiler/glsl/ast_to_hir.cpp:156 #10 0x0000000000456122 in _mesa_glsl_compile_shader (ctx=0x840370 <standalone_compile_shader::local_ctx>, shader=0x8815b0, dump_ast=<optimized out>, dump_hir=false, force_recompile=<optimized out>) at ../src/compiler/glsl/glsl_parser_extras.cpp:2119 #11 0x0000000000408ce1 in compile_shader (ctx=<optimized out>, shader=<optimized out>) at ../src/compiler/glsl/standalone.cpp:394 #12 standalone_compile_shader (_options=<optimized out>, num_files=<optimized out>, files=0x7fffffffdca0) at ../src/compiler/glsl/standalone.cpp:504 #13 0x0000000000408340 in main (argc=<optimized out>, argv=0x7fffffffdc88) at ../src/compiler/glsl/main.cpp:95