radv: add a helper to set shader stage key robustness info

For future work.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30643>
This commit is contained in:
Samuel Pitoiset 2024-08-13 15:39:44 +02:00 committed by Marge Bot
parent 7a5b40a2ff
commit d8861d52a2
3 changed files with 19 additions and 8 deletions

View file

@ -149,14 +149,7 @@ radv_pipeline_get_shader_key(const struct radv_device *device, const VkPipelineS
vk_pipeline_robustness_state_fill(&device->vk, &rs, pNext, stage->pNext);
if (rs.storage_buffers == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT)
key.storage_robustness2 = 1;
if (rs.uniform_buffers == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT)
key.uniform_robustness2 = 1;
if (s == MESA_SHADER_VERTEX &&
(rs.vertex_inputs == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_EXT ||
rs.vertex_inputs == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT))
key.vertex_robustness1 = 1u;
radv_set_stage_key_robustness(&rs, s, &key);
const VkPipelineShaderStageRequiredSubgroupSizeCreateInfo *const subgroup_size =
vk_find_struct_const(stage->pNext, PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO);

View file

@ -2795,6 +2795,20 @@ radv_fill_nir_compiler_options(struct radv_nir_compiler_options *options, struct
options->enable_mrt_output_nan_fixup = gfx_state ? gfx_state->ps.epilog.enable_mrt_output_nan_fixup : false;
}
void
radv_set_stage_key_robustness(const struct vk_pipeline_robustness_state *rs, gl_shader_stage stage,
struct radv_shader_stage_key *key)
{
if (rs->storage_buffers == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT)
key->storage_robustness2 = 1;
if (rs->uniform_buffers == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT)
key->uniform_robustness2 = 1;
if (stage == MESA_SHADER_VERTEX &&
(rs->vertex_inputs == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_EXT ||
rs->vertex_inputs == VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT))
key->vertex_robustness1 = 1u;
}
static void
radv_capture_shader_executable_info(struct radv_device *device, struct radv_shader *shader,
struct nir_shader *const *shaders, int shader_count,

View file

@ -32,6 +32,7 @@ struct radv_shader_args;
struct radv_vs_input_state;
struct radv_shader_args;
struct radv_serialized_shader_arena_block;
struct vk_pipeline_robustness_state;
enum {
RADV_GRAPHICS_STAGE_BITS =
@ -721,4 +722,7 @@ uint32_t radv_get_user_sgpr(const struct radv_shader *shader, int idx);
void radv_precompute_registers_hw_ngg(struct radv_device *device, const struct ac_shader_config *config,
struct radv_shader_info *info);
void radv_set_stage_key_robustness(const struct vk_pipeline_robustness_state *rs, gl_shader_stage stage,
struct radv_shader_stage_key *key);
#endif /* RADV_SHADER_H */