[Mesa-dev] [RFC PATCH 2/4] glsl: early bailout if local size too large

Giuseppe Bilotta giuseppe.bilotta at gmail.com
Sat Apr 22 07:52:12 UTC 2017


When checking the compute shader local size against the maximum
per-dimension and overall work-group size, return rather than breaking
out of the loop over all dimensions.

Oversized local sizes are an error anyway, and the early bail out
eliminates the warning about qual_local_size potentially being used
unitialized further down the function block.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
---
 src/compiler/glsl/ast_to_hir.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index aeb223db9e..2a83cfad25 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -8144,7 +8144,7 @@ ast_cs_input_layout::hir(exec_list *instructions,
                           "local_size_%c exceeds MAX_COMPUTE_WORK_GROUP_SIZE"
                           " (%d)", 'x' + i,
                           state->ctx->Const.MaxComputeWorkGroupSize[i]);
-         break;
+         return NULL;
       }
       total_invocations *= qual_local_size[i];
       if (total_invocations >
@@ -8153,7 +8153,7 @@ ast_cs_input_layout::hir(exec_list *instructions,
                           "product of local_sizes exceeds "
                           "MAX_COMPUTE_WORK_GROUP_INVOCATIONS (%d)",
                           state->ctx->Const.MaxComputeWorkGroupInvocations);
-         break;
+         return NULL;
       }
    }
 
-- 
2.13.0.rc0.207.gb442654931



More information about the mesa-dev mailing list