glsl: mark structs containing images as bindless

Structs are not allowed to contain an image in regular glsl. The only time
they are intended to be allowed to be declared in a struct is when
they are bindless.

Unfortunately the bindless spec does not meantion this behaviour
explicitly so there is no spec quote to reference but you can see in
the original commit to allow them in mesa that spec clarification was
provided 48b7882200

The spec also states that certain uses are implicitly bindless as per
the following spec quote:

   "When used as shader inputs, outputs, uniform block members,
   or temporaries, the value of the sampler is a 64-bit unsigned
   integer handle and never refers to a texture image unit."

Given images are not allowed in regular glsl for the above types
similair to being forbidden in structs, we can also assume
declarations in structs are implicitly bindless.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24269>
This commit is contained in:
Timothy Arceri
2023-07-21 13:59:35 +10:00
committed by Marge Bot
parent 8dd2691020
commit 92c5460253
3 changed files with 16 additions and 6 deletions
+16
View File
@@ -3753,6 +3753,22 @@ apply_bindless_qualifier_to_variable(const struct ast_type_qualifier *qual,
state->bound_sampler_specified ||
state->bound_image_specified;
}
/* ARB_bindless_texture spec says:
*
* "When used as shader inputs, outputs, uniform block members,
* or temporaries, the value of the sampler is a 64-bit unsigned
* integer handle and never refers to a texture image unit."
*
* The spec doesn't reference images defined inside structs but it was
* clarified with the authors that bindless images are allowed in structs.
* So we treat these images as implicitly bindless just like the types
* in the spec quote above.
*/
if (!var->data.bindless && var->type->is_struct() &&
var->type->contains_image()) {
var->data.bindless = true;
}
}
static void
@@ -2,9 +2,6 @@
glx@glx-multi-window-single-context,Crash
spec@egl_chromium_sync_control@conformance@eglGetSyncValuesCHROMIUM_ust_test,Fail
# Mesa bug not Zink bug. See piglit MR 824
spec@arb_bindless_texture@compiler@images@return-struct.frag,Crash
# #6115
spec@arb_tessellation_shader@execution@variable-indexing@tes-both-input-array-float-index-rd,Crash
spec@arb_tessellation_shader@execution@variable-indexing@tes-both-input-array-vec2-index-rd,Crash
@@ -2,9 +2,6 @@
glx@glx-multi-window-single-context,Crash
spec@egl_chromium_sync_control@conformance@eglGetSyncValuesCHROMIUM_ust_test,Fail
# Mesa bug not Zink bug. See piglit MR 824
spec@arb_bindless_texture@compiler@images@return-struct.frag,Crash
# #6115
spec@arb_tessellation_shader@execution@variable-indexing@tes-both-input-array-float-index-rd,Crash
spec@arb_tessellation_shader@execution@variable-indexing@tes-both-input-array-vec2-index-rd,Crash