glsl: set shader_info.subgroup_size for KHR_shader_subgroup

Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30610>
This commit is contained in:
Qiang Yu 2024-08-05 11:02:07 +08:00
parent ea33876fbe
commit 40fdd97de3
4 changed files with 8 additions and 2 deletions

View file

@ -2473,6 +2473,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
shader->has_implicit_conversions = state->has_implicit_conversions();
shader->has_implicit_int_to_uint_conversion =
state->has_implicit_int_to_uint_conversion();
shader->KHR_shader_subgroup_basic_enable = state->KHR_shader_subgroup_basic_enable;
struct gl_shader_compiler_options *options =
&ctx->Const.ShaderCompilerOptions[shader->Stage];

View file

@ -172,8 +172,6 @@ glsl_to_nir(const struct gl_constants *consts,
nir_print_shader(shader, stdout);
}
shader->info.subgroup_size = SUBGROUP_SIZE_UNIFORM;
return shader;
}

View file

@ -1540,6 +1540,7 @@ link_intrastage_shaders(void *mem_ctx,
bool allow_missing_main)
{
bool arb_fragment_coord_conventions_enable = false;
bool KHR_shader_subgroup_basic_enable = false;
/* Check that global variables defined in multiple shaders are consistent.
*/
@ -1551,6 +1552,8 @@ link_intrastage_shaders(void *mem_ctx,
false);
if (shader_list[i]->ARB_fragment_coord_conventions_enable)
arb_fragment_coord_conventions_enable = true;
if (shader_list[i]->KHR_shader_subgroup_basic_enable)
KHR_shader_subgroup_basic_enable = true;
}
if (!prog->data->LinkStatus)
@ -1660,6 +1663,9 @@ link_intrastage_shaders(void *mem_ctx,
populate_symbol_table(linked, shader_list[0]->symbols);
gl_prog->info.subgroup_size = KHR_shader_subgroup_basic_enable ?
SUBGROUP_SIZE_API_CONSTANT : SUBGROUP_SIZE_UNIFORM;
/* The pointer to the main function in the final linked shader (i.e., the
* copy of the original shader that contained the main function).
*/

View file

@ -188,6 +188,7 @@ struct gl_shader
bool EarlyFragmentTests;
bool ARB_fragment_coord_conventions_enable;
bool KHR_shader_subgroup_basic_enable;
bool redeclares_gl_fragcoord;
bool uses_gl_fragcoord;