mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 04:10:09 +01:00
glsl: plumb num_views down to shader_info::view_mask
this is needed for drivers to more effectively compile multiview-enabled shaders Reviewed-by: Timothy Arceri <tarceri@itqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33016>
This commit is contained in:
parent
732101d609
commit
48d0a0322f
5 changed files with 21 additions and 4 deletions
|
|
@ -524,10 +524,10 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
|
|||
unsigned num_views;
|
||||
if (process_qualifier_constant(state, loc, "num_views",
|
||||
this->num_views, &num_views)){
|
||||
if (!validate_view_qualifier(loc, state, num_views)){
|
||||
_mesa_glsl_error(loc, state,
|
||||
"Invalid num_views specified");
|
||||
}
|
||||
if (!validate_view_qualifier(loc, state, num_views)){
|
||||
_mesa_glsl_error(loc, state, "Invalid num_views specified");
|
||||
}
|
||||
state->view_mask = BITFIELD_MASK(num_views);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2722,6 +2722,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;
|
||||
|
||||
/* Check that global variables defined in multiple shaders are consistent.
|
||||
*/
|
||||
|
|
@ -2736,6 +2737,14 @@ link_intrastage_shaders(void *mem_ctx,
|
|||
arb_fragment_coord_conventions_enable = true;
|
||||
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;
|
||||
}
|
||||
view_mask = shader_list[i]->view_mask;
|
||||
}
|
||||
|
||||
if (!prog->data->LinkStatus)
|
||||
|
|
@ -2833,6 +2842,7 @@ link_intrastage_shaders(void *mem_ctx,
|
|||
|
||||
link_layer_viewport_relative_qualifier(prog, gl_prog, shader_list, num_shaders);
|
||||
|
||||
gl_prog->nir->info.view_mask = view_mask;
|
||||
gl_prog->nir->info.subgroup_size = KHR_shader_subgroup_basic_enable ?
|
||||
SUBGROUP_SIZE_API_CONSTANT : SUBGROUP_SIZE_UNIFORM;
|
||||
|
||||
|
|
|
|||
|
|
@ -2095,6 +2095,7 @@ set_shader_inout_layout(struct gl_shader *shader,
|
|||
break;
|
||||
}
|
||||
|
||||
shader->view_mask = state->view_mask;
|
||||
shader->bindless_sampler = state->bindless_sampler_specified;
|
||||
shader->bindless_image = state->bindless_image_specified;
|
||||
shader->bound_sampler = state->bound_sampler_specified;
|
||||
|
|
|
|||
|
|
@ -1015,6 +1015,9 @@ struct _mesa_glsl_parse_state {
|
|||
* so we can check totals aren't too large.
|
||||
*/
|
||||
unsigned clip_dist_size, cull_dist_size;
|
||||
|
||||
/* for OVR_multiview */
|
||||
uint32_t view_mask;
|
||||
};
|
||||
|
||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
|
|
|
|||
|
|
@ -233,6 +233,9 @@ struct gl_shader
|
|||
/** Global xfb_stride out qualifier if any */
|
||||
GLuint TransformFeedbackBufferStride[MAX_FEEDBACK_BUFFERS];
|
||||
|
||||
/* for OVR_multiview */
|
||||
uint32_t view_mask;
|
||||
|
||||
struct gl_shader_info info;
|
||||
|
||||
/* ARB_gl_spirv related data */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue