radv: add radv_shader_info::is_monolithic

This will be used to implement shader object on GFX9+.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24697>
This commit is contained in:
Samuel Pitoiset 2023-08-14 12:01:49 +02:00 committed by Marge Bot
parent f64f08a9e0
commit 467bf47281
2 changed files with 29 additions and 1 deletions

View file

@ -311,7 +311,8 @@ struct radv_shader_info {
uint32_t user_data_0;
bool inputs_linked;
bool outputs_linked;
bool has_epilog; /* Only for TCS or PS */
bool has_epilog; /* Only for TCS or PS */
bool is_monolithic; /* False only for merged shaders which are compiled separately */
struct {
uint8_t input_usage_mask[RADV_VERT_ATTRIB_MAX];

View file

@ -1011,6 +1011,32 @@ radv_get_user_data_0(const struct radv_device *device, struct radv_shader_info *
}
}
static bool
radv_is_shader_monolithic(const struct radv_device *device, const struct radv_shader_info *info)
{
const enum amd_gfx_level gfx_level = device->physical_device->rad_info.gfx_level;
if (gfx_level >= GFX9) {
switch (info->stage) {
case MESA_SHADER_VERTEX:
if (info->next_stage == MESA_SHADER_TESS_CTRL || info->next_stage == MESA_SHADER_GEOMETRY)
return info->outputs_linked;
break;
case MESA_SHADER_TESS_EVAL:
if (info->next_stage == MESA_SHADER_GEOMETRY)
return info->outputs_linked;
break;
case MESA_SHADER_TESS_CTRL:
case MESA_SHADER_GEOMETRY:
return info->inputs_linked;
default:
break;
}
}
return true;
}
void
radv_nir_shader_info_init(gl_shader_stage stage, gl_shader_stage next_stage, struct radv_shader_info *info)
{
@ -1134,6 +1160,7 @@ radv_nir_shader_info_pass(struct radv_device *device, const struct nir_shader *n
}
info->user_data_0 = radv_get_user_data_0(device, info);
info->is_monolithic = radv_is_shader_monolithic(device, info);
switch (nir->info.stage) {
case MESA_SHADER_COMPUTE: