mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 22:40:09 +01:00
radv: remove more references to the pipeline layout during compilation
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15749>
This commit is contained in:
parent
2c97e79473
commit
115fd6dd8e
4 changed files with 19 additions and 29 deletions
|
|
@ -4206,8 +4206,7 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
|
|||
radv_start_feedback(stage_feedbacks[i]);
|
||||
|
||||
nir[i] = radv_shader_compile_to_nir(device, modules[i], stage ? stage->pName : "main", i,
|
||||
stage ? stage->pSpecializationInfo : NULL,
|
||||
pipeline_layout, pipeline_key);
|
||||
stage ? stage->pSpecializationInfo : NULL, pipeline_key);
|
||||
|
||||
radv_stop_feedback(stage_feedbacks[i], false);
|
||||
}
|
||||
|
|
@ -4444,7 +4443,7 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
|
|||
radv_start_feedback(stage_feedbacks[MESA_SHADER_FRAGMENT]);
|
||||
|
||||
pipeline->shaders[MESA_SHADER_FRAGMENT] = radv_shader_compile(
|
||||
device, modules[MESA_SHADER_FRAGMENT], &nir[MESA_SHADER_FRAGMENT], 1, pipeline_layout,
|
||||
device, modules[MESA_SHADER_FRAGMENT], &nir[MESA_SHADER_FRAGMENT], 1,
|
||||
pipeline_key, infos + MESA_SHADER_FRAGMENT, &args[MESA_SHADER_FRAGMENT],
|
||||
keep_executable_info, keep_statistic_info, &binaries[MESA_SHADER_FRAGMENT]);
|
||||
|
||||
|
|
@ -4459,7 +4458,7 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
|
|||
radv_start_feedback(stage_feedbacks[MESA_SHADER_TESS_CTRL]);
|
||||
|
||||
pipeline->shaders[MESA_SHADER_TESS_CTRL] = radv_shader_compile(
|
||||
device, modules[MESA_SHADER_TESS_CTRL], combined_nir, 2, pipeline_layout, pipeline_key,
|
||||
device, modules[MESA_SHADER_TESS_CTRL], combined_nir, 2, pipeline_key,
|
||||
&infos[MESA_SHADER_TESS_CTRL], &args[MESA_SHADER_TESS_CTRL], keep_executable_info,
|
||||
keep_statistic_info, &binaries[MESA_SHADER_TESS_CTRL]);
|
||||
|
||||
|
|
@ -4477,7 +4476,7 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
|
|||
radv_start_feedback(stage_feedbacks[MESA_SHADER_GEOMETRY]);
|
||||
|
||||
pipeline->shaders[MESA_SHADER_GEOMETRY] = radv_shader_compile(
|
||||
device, modules[MESA_SHADER_GEOMETRY], combined_nir, 2, pipeline_layout, pipeline_key,
|
||||
device, modules[MESA_SHADER_GEOMETRY], combined_nir, 2, pipeline_key,
|
||||
&infos[MESA_SHADER_GEOMETRY], &args[MESA_SHADER_GEOMETRY], keep_executable_info,
|
||||
keep_statistic_info, &binaries[MESA_SHADER_GEOMETRY]);
|
||||
|
||||
|
|
@ -4491,7 +4490,7 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
|
|||
radv_start_feedback(stage_feedbacks[i]);
|
||||
|
||||
pipeline->shaders[i] = radv_shader_compile(
|
||||
device, modules[i], &nir[i], 1, pipeline_layout, pipeline_key, infos + i, &args[i],
|
||||
device, modules[i], &nir[i], 1, pipeline_key, infos + i, &args[i],
|
||||
keep_executable_info, keep_statistic_info, &binaries[i]);
|
||||
|
||||
radv_stop_feedback(stage_feedbacks[i], false);
|
||||
|
|
|
|||
|
|
@ -810,15 +810,14 @@ convert_rt_stage(VkShaderStageFlagBits vk_stage)
|
|||
}
|
||||
|
||||
static nir_shader *
|
||||
parse_rt_stage(struct radv_device *device, struct radv_pipeline_layout *layout,
|
||||
const VkPipelineShaderStageCreateInfo *stage)
|
||||
parse_rt_stage(struct radv_device *device, const VkPipelineShaderStageCreateInfo *stage)
|
||||
{
|
||||
struct radv_pipeline_key key;
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
nir_shader *shader = radv_shader_compile_to_nir(
|
||||
device, vk_shader_module_from_handle(stage->module), stage->pName,
|
||||
convert_rt_stage(stage->stage), stage->pSpecializationInfo, layout, &key);
|
||||
convert_rt_stage(stage->stage), stage->pSpecializationInfo, &key);
|
||||
|
||||
if (shader->info.stage == MESA_SHADER_RAYGEN || shader->info.stage == MESA_SHADER_CLOSEST_HIT ||
|
||||
shader->info.stage == MESA_SHADER_CALLABLE || shader->info.stage == MESA_SHADER_MISS) {
|
||||
|
|
@ -1087,7 +1086,6 @@ visit_any_hit_shaders(struct radv_device *device,
|
|||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, nir_builder *b,
|
||||
struct rt_variables *vars)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_pipeline_layout, layout, pCreateInfo->layout);
|
||||
nir_ssa_def *sbt_idx = nir_load_var(b, vars->idx);
|
||||
|
||||
nir_push_if(b, nir_ine(b, sbt_idx, nir_imm_int(b, 0)));
|
||||
|
|
@ -1106,7 +1104,7 @@ visit_any_hit_shaders(struct radv_device *device,
|
|||
continue;
|
||||
|
||||
const VkPipelineShaderStageCreateInfo *stage = &pCreateInfo->pStages[shader_id];
|
||||
nir_shader *nir_stage = parse_rt_stage(device, layout, stage);
|
||||
nir_shader *nir_stage = parse_rt_stage(device, stage);
|
||||
|
||||
vars->group_idx = i;
|
||||
insert_rt_case(b, nir_stage, vars, sbt_idx, 0, i + 2);
|
||||
|
|
@ -1265,8 +1263,6 @@ insert_traversal_aabb_case(struct radv_device *device,
|
|||
const struct rt_variables *vars,
|
||||
const struct rt_traversal_vars *trav_vars, nir_ssa_def *bvh_node)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_pipeline_layout, layout, pCreateInfo->layout);
|
||||
|
||||
nir_ssa_def *node_addr = build_node_to_addr(device, b, bvh_node);
|
||||
nir_ssa_def *triangle_info =
|
||||
nir_build_load_global(b, 2, 32, nir_iadd(b, node_addr, nir_imm_int64(b, 24)));
|
||||
|
|
@ -1331,12 +1327,12 @@ insert_traversal_aabb_case(struct radv_device *device,
|
|||
continue;
|
||||
|
||||
const VkPipelineShaderStageCreateInfo *stage = &pCreateInfo->pStages[shader_id];
|
||||
nir_shader *nir_stage = parse_rt_stage(device, layout, stage);
|
||||
nir_shader *nir_stage = parse_rt_stage(device, stage);
|
||||
|
||||
nir_shader *any_hit_stage = NULL;
|
||||
if (any_hit_shader_id != VK_SHADER_UNUSED_KHR) {
|
||||
stage = &pCreateInfo->pStages[any_hit_shader_id];
|
||||
any_hit_stage = parse_rt_stage(device, layout, stage);
|
||||
any_hit_stage = parse_rt_stage(device, stage);
|
||||
|
||||
nir_lower_intersection_shader(nir_stage, any_hit_stage);
|
||||
ralloc_free(any_hit_stage);
|
||||
|
|
@ -1711,7 +1707,6 @@ static nir_shader *
|
|||
create_rt_shader(struct radv_device *device, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
|
||||
struct radv_pipeline_shader_stack_size *stack_sizes)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_pipeline_layout, layout, pCreateInfo->layout);
|
||||
struct radv_pipeline_key key;
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
|
|
@ -1768,7 +1763,7 @@ create_rt_shader(struct radv_device *device, const VkRayTracingPipelineCreateInf
|
|||
continue;
|
||||
|
||||
const VkPipelineShaderStageCreateInfo *stage = &pCreateInfo->pStages[shader_id];
|
||||
nir_shader *nir_stage = parse_rt_stage(device, layout, stage);
|
||||
nir_shader *nir_stage = parse_rt_stage(device, stage);
|
||||
|
||||
b.shader->options = nir_stage->options;
|
||||
|
||||
|
|
|
|||
|
|
@ -292,8 +292,7 @@ radv_compiler_debug(void *private_data, enum radv_compiler_debug_level level, co
|
|||
}
|
||||
|
||||
static bool
|
||||
lower_intrinsics(nir_shader *nir, const struct radv_pipeline_key *key,
|
||||
const struct radv_pipeline_layout *layout, const struct radv_physical_device *pdev)
|
||||
lower_intrinsics(nir_shader *nir, const struct radv_pipeline_key *key)
|
||||
{
|
||||
nir_function_impl *entry = nir_shader_get_entrypoint(nir);
|
||||
bool progress = false;
|
||||
|
|
@ -556,7 +555,6 @@ nir_shader *
|
|||
radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module *module,
|
||||
const char *entrypoint_name, gl_shader_stage stage,
|
||||
const VkSpecializationInfo *spec_info,
|
||||
const struct radv_pipeline_layout *layout,
|
||||
const struct radv_pipeline_key *key)
|
||||
{
|
||||
unsigned subgroup_size = 64, ballot_bit_size = 64;
|
||||
|
|
@ -868,7 +866,7 @@ radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module *
|
|||
NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_ubo | nir_var_mem_ssbo,
|
||||
nir_address_format_vec2_index_32bit_offset);
|
||||
|
||||
NIR_PASS_V(nir, lower_intrinsics, key, layout, device->physical_device);
|
||||
NIR_PASS_V(nir, lower_intrinsics, key);
|
||||
|
||||
/* Lower deref operations for compute shared memory. */
|
||||
if (nir->info.stage == MESA_SHADER_COMPUTE ||
|
||||
|
|
@ -2025,10 +2023,9 @@ shader_compile(struct radv_device *device, struct vk_shader_module *module,
|
|||
struct radv_shader *
|
||||
radv_shader_compile(struct radv_device *device, struct vk_shader_module *module,
|
||||
struct nir_shader *const *shaders, int shader_count,
|
||||
struct radv_pipeline_layout *layout, const struct radv_pipeline_key *key,
|
||||
struct radv_shader_info *info, const struct radv_shader_args *args,
|
||||
bool keep_shader_info, bool keep_statistic_info,
|
||||
struct radv_shader_binary **binary_out)
|
||||
const struct radv_pipeline_key *key, struct radv_shader_info *info,
|
||||
const struct radv_shader_args *args, bool keep_shader_info,
|
||||
bool keep_statistic_info, struct radv_shader_binary **binary_out)
|
||||
{
|
||||
gl_shader_stage stage = shaders[shader_count - 1]->info.stage;
|
||||
struct radv_nir_compiler_options options = {0};
|
||||
|
|
|
|||
|
|
@ -516,7 +516,6 @@ void radv_nir_apply_pipeline_layout(nir_shader *shader, struct radv_device *devi
|
|||
nir_shader *radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module *module,
|
||||
const char *entrypoint_name, gl_shader_stage stage,
|
||||
const VkSpecializationInfo *spec_info,
|
||||
const struct radv_pipeline_layout *layout,
|
||||
const struct radv_pipeline_key *key);
|
||||
|
||||
void radv_init_shader_arenas(struct radv_device *device);
|
||||
|
|
@ -539,9 +538,9 @@ struct radv_shader *radv_shader_create(struct radv_device *device,
|
|||
const struct radv_shader_args *args);
|
||||
struct radv_shader *radv_shader_compile(
|
||||
struct radv_device *device, struct vk_shader_module *module, struct nir_shader *const *shaders,
|
||||
int shader_count, struct radv_pipeline_layout *layout, const struct radv_pipeline_key *key,
|
||||
struct radv_shader_info *info, const struct radv_shader_args *args, bool keep_shader_info,
|
||||
bool keep_statistic_info, struct radv_shader_binary **binary_out);
|
||||
int shader_count, const struct radv_pipeline_key *key, struct radv_shader_info *info,
|
||||
const struct radv_shader_args *args, bool keep_shader_info, bool keep_statistic_info,
|
||||
struct radv_shader_binary **binary_out);
|
||||
|
||||
bool radv_shader_binary_upload(struct radv_device *device, const struct radv_shader_binary *binary,
|
||||
struct radv_shader *shader, void *dest_ptr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue