From 4d24a7cb97641cacecd371d1968f6964785822e4 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Sat, 21 Oct 2017 15:15:41 -0400 Subject: glsl: fix derived cs variables There are two issues with the current implementation. First, it relies on the layout(local_size_*) happening in the same shader as the main function, and secondly it doesn't work for variable group sizes. In both cases, the simplest fix is to move the setup of these derived values to a later time, similar to how the gl_VertexID workarounds are done. There already exist system values defined for both of the derived values, so we use them unconditionally, and lower them after linking is performed. While we're at it, we move to using gl_LocalGroupSizeARB instead of gl_WorkGroupSize for variable group sizes. Also the dead code elimination avoidance can be removed, since there can be situations where gl_LocalGroupSizeARB is needed but has not been inserted for the shader with main function. As a result, the lowering code has to insert its own copies of the system values if needed. Reported-by: Stephane Chevigny Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103393 Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Ilia Mirkin Reviewed-by: Jordan Justen Reviewed-by: Samuel Pitoiset --- src/compiler/Makefile.sources | 1 + 1 file changed, 1 insertion(+) (limited to 'src/compiler/Makefile.sources') diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index 2724a41286e..27cc33ab835 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -85,6 +85,7 @@ LIBGLSL_FILES = \ glsl/lower_buffer_access.cpp \ glsl/lower_buffer_access.h \ glsl/lower_const_arrays_to_uniforms.cpp \ + glsl/lower_cs_derived.cpp \ glsl/lower_discard.cpp \ glsl/lower_discard_flow.cpp \ glsl/lower_distance.cpp \ -- cgit v1.2.3