Module: Mesa Branch: main Commit: a3a04ed6f3617ab7891f827fae8a9dd8e67596bf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3a04ed6f3617ab7891f827fae8a9dd8e67596bf
Author: Tapani Pälli <[email protected]> Date: Fri Aug 5 11:00:27 2022 +0300 glsl: add check for too large atomic counter buffer offset Fixes upcoming CTS test for atomic counter buffer offsets. "It's being clarified that placing an atomic counter into a buffer at such an offset that the buffer is too large results in a compilation error." https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/3124 Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17905> --- src/compiler/glsl/ast_to_hir.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 68eb84eba66..a61fe1d56d9 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3862,6 +3862,10 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual, _mesa_glsl_error(loc, state, "misaligned atomic counter offset"); + if (*offset >= state->Const.MaxAtomicCounterBufferSize) + _mesa_glsl_error(loc, state, + "offset > max atomic counter buffer size"); + var->data.offset = *offset; *offset += var->type->atomic_size();
