glsl: fix num_views linker error

The declaration must be the same across shaders but not all shaders
must make the declaration.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33149>
This commit is contained in:
Timothy Arceri 2025-01-22 10:07:15 +11:00 committed by Marge Bot
parent 914697c4ac
commit 09f73024a5

View file

@ -2662,7 +2662,7 @@ link_intrastage_shaders(void *mem_ctx,
{
bool arb_fragment_coord_conventions_enable = false;
bool KHR_shader_subgroup_basic_enable = false;
int32_t view_mask = -1;
unsigned view_mask = 0;
/* Check that global variables defined in multiple shaders are consistent.
*/
@ -2678,13 +2678,16 @@ link_intrastage_shaders(void *mem_ctx,
if (shader_list[i]->KHR_shader_subgroup_basic_enable)
KHR_shader_subgroup_basic_enable = true;
if (view_mask != -1 && view_mask != shader_list[i]->view_mask) {
linker_error(prog, "vertex shader defined with "
"conflicting num_views (%d and %d)\n",
ffs(view_mask) - 1, ffs(shader_list[i]->view_mask) - 1);
return NULL;
if (shader_list[i]->view_mask != 0) {
if (view_mask != 0 && shader_list[i]->view_mask != view_mask) {
linker_error(prog, "vertex shader defined with "
"conflicting num_views (%d and %d)\n",
ffs(view_mask) - 1, ffs(shader_list[i]->view_mask) - 1);
return NULL;
}
view_mask = shader_list[i]->view_mask;
}
view_mask = shader_list[i]->view_mask;
}
if (!prog->data->LinkStatus)