mirror of https://gitlab.freedesktop.org/mesa/mesa
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:
parent
fd28984f84
commit
a3a04ed6f3
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue