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 <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17905>
This commit is contained in:
Tapani Pälli 2022-08-05 11:00:27 +03:00 committed by Marge Bot
parent fd28984f84
commit a3a04ed6f3
1 changed files with 4 additions and 0 deletions

View File

@ -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();