radv: re-introduce radv_pipeline_stage_init()

This helper is used to initialize a radv_shader_stage struct for
pipelines, while radv_shader_stage_init() would be for shader object
only (ie. using VkCreateShaderInfoEXT).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24562>
This commit is contained in:
Samuel Pitoiset
2023-08-09 09:05:35 +02:00
committed by Marge Bot
parent afcafa1b61
commit 3bbfc45c37
6 changed files with 12 additions and 14 deletions
+4 -1
View File
@@ -252,7 +252,8 @@ radv_get_hash_flags(const struct radv_device *device, bool stats)
}
void
radv_shader_stage_init(const VkPipelineShaderStageCreateInfo *sinfo, struct radv_shader_stage *out_stage)
radv_pipeline_stage_init(const VkPipelineShaderStageCreateInfo *sinfo,
const struct radv_pipeline_layout *pipeline_layout, struct radv_shader_stage *out_stage)
{
const VkShaderModuleCreateInfo *minfo = vk_find_struct_const(sinfo->pNext, SHADER_MODULE_CREATE_INFO);
const VkPipelineShaderStageModuleIdentifierCreateInfoEXT *iinfo =
@@ -282,6 +283,8 @@ radv_shader_stage_init(const VkPipelineShaderStageCreateInfo *sinfo, struct radv
out_stage->spirv.size = minfo->codeSize;
}
radv_shader_layout_init(pipeline_layout, out_stage->stage, &out_stage->layout);
vk_pipeline_hash_shader_stage(sinfo, NULL, out_stage->shader_sha1);
}
+1 -2
View File
@@ -196,8 +196,7 @@ radv_compute_pipeline_compile(struct radv_compute_pipeline *pipeline, struct rad
int64_t pipeline_start = os_time_get_nano();
radv_shader_stage_init(pStage, &cs_stage);
radv_shader_layout_init(pipeline_layout, MESA_SHADER_COMPUTE, &cs_stage.layout);
radv_pipeline_stage_init(pStage, pipeline_layout, &cs_stage);
radv_hash_shaders(hash, &cs_stage, 1, pipeline_layout, pipeline_key,
radv_get_hash_flags(device, keep_statistic_info));
+2 -4
View File
@@ -2337,8 +2337,7 @@ radv_pipeline_import_retained_shaders(const struct radv_device *device, struct r
if (!(shader_stage_to_pipeline_library_flags(sinfo->stage) & lib->lib_flags))
continue;
radv_shader_stage_init(sinfo, &stages[s]);
radv_shader_layout_init(&lib->layout, s, &stages[s].layout);
radv_pipeline_stage_init(sinfo, &lib->layout, &stages[s]);
}
/* Import the NIR shaders (after SPIRV->NIR). */
@@ -2663,8 +2662,7 @@ radv_graphics_pipeline_compile(struct radv_graphics_pipeline *pipeline, const Vk
if (!(shader_stage_to_pipeline_library_flags(sinfo->stage) & lib_flags))
continue;
radv_shader_stage_init(sinfo, &stages[stage]);
radv_shader_layout_init(pipeline_layout, stage, &stages[stage].layout);
radv_pipeline_stage_init(sinfo, pipeline_layout, &stages[stage]);
}
radv_pipeline_load_retained_shaders(device, pipeline, pCreateInfo, stages);
+2 -4
View File
@@ -260,8 +260,7 @@ radv_rt_fill_stage_info(struct radv_device *device, const VkRayTracingPipelineCr
stages[idx].stage = vk_to_mesa_shader_stage(pCreateInfo->pStages[idx].stage);
struct radv_shader_stage stage;
radv_shader_stage_init(&pCreateInfo->pStages[idx], &stage);
radv_shader_layout_init(pipeline_layout, stages[idx].stage, &stage.layout);
radv_pipeline_stage_init(&pCreateInfo->pStages[idx], pipeline_layout, &stage);
radv_hash_shaders(stages[idx].sha1, &stage, 1, NULL, key, radv_get_hash_flags(device, false));
}
@@ -453,8 +452,7 @@ radv_rt_compile_shaders(struct radv_device *device, struct vk_pipeline_cache *ca
for (uint32_t idx = 0; idx < pCreateInfo->stageCount; idx++) {
int64_t stage_start = os_time_get_nano();
struct radv_shader_stage stage;
radv_shader_stage_init(&pCreateInfo->pStages[idx], &stage);
radv_shader_layout_init(pipeline_layout, stages[idx].stage, &stage.layout);
radv_pipeline_stage_init(&pCreateInfo->pStages[idx], pipeline_layout, &stage);
if (stages[idx].shader)
goto feedback;
+2 -1
View File
@@ -2171,7 +2171,8 @@ struct radv_event {
struct radv_pipeline_key;
struct radv_ray_tracing_group;
void radv_shader_stage_init(const VkPipelineShaderStageCreateInfo *sinfo, struct radv_shader_stage *out_stage);
void radv_pipeline_stage_init(const VkPipelineShaderStageCreateInfo *sinfo, const struct radv_pipeline_layout *layout,
struct radv_shader_stage *out_stage);
void radv_hash_shaders(unsigned char *hash, const struct radv_shader_stage *stages, uint32_t stage_count,
const struct radv_pipeline_layout *layout, const struct radv_pipeline_key *key, uint32_t flags);
+1 -2
View File
@@ -815,8 +815,7 @@ radv_parse_rt_stage(struct radv_device *device, const VkPipelineShaderStageCreat
{
struct radv_shader_stage rt_stage;
radv_shader_stage_init(sinfo, &rt_stage);
radv_shader_layout_init(pipeline_layout, vk_to_mesa_shader_stage(sinfo->stage), &rt_stage.layout);
radv_pipeline_stage_init(sinfo, pipeline_layout, &rt_stage);
nir_shader *shader = radv_shader_spirv_to_nir(device, &rt_stage, key, false);