radv: Reduce the amount of radv_device_to_handle calls
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26697>
This commit is contained in:
@@ -325,38 +325,35 @@ radv_CopyAccelerationStructureKHR(VkDevice _device, VkDeferredOperationKHR defer
|
|||||||
void
|
void
|
||||||
radv_device_finish_accel_struct_build_state(struct radv_device *device)
|
radv_device_finish_accel_struct_build_state(struct radv_device *device)
|
||||||
{
|
{
|
||||||
|
VkDevice _device = radv_device_to_handle(device);
|
||||||
struct radv_meta_state *state = &device->meta_state;
|
struct radv_meta_state *state = &device->meta_state;
|
||||||
radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.copy_pipeline, &state->alloc);
|
|
||||||
radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.ploc_pipeline, &state->alloc);
|
radv_DestroyPipeline(_device, state->accel_struct_build.copy_pipeline, &state->alloc);
|
||||||
radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.lbvh_generate_ir_pipeline,
|
radv_DestroyPipeline(_device, state->accel_struct_build.ploc_pipeline, &state->alloc);
|
||||||
&state->alloc);
|
radv_DestroyPipeline(_device, state->accel_struct_build.lbvh_generate_ir_pipeline, &state->alloc);
|
||||||
radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.lbvh_main_pipeline, &state->alloc);
|
radv_DestroyPipeline(_device, state->accel_struct_build.lbvh_main_pipeline, &state->alloc);
|
||||||
radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.leaf_pipeline, &state->alloc);
|
radv_DestroyPipeline(_device, state->accel_struct_build.leaf_pipeline, &state->alloc);
|
||||||
radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.encode_pipeline, &state->alloc);
|
radv_DestroyPipeline(_device, state->accel_struct_build.encode_pipeline, &state->alloc);
|
||||||
radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.encode_compact_pipeline,
|
radv_DestroyPipeline(_device, state->accel_struct_build.encode_compact_pipeline, &state->alloc);
|
||||||
&state->alloc);
|
radv_DestroyPipeline(_device, state->accel_struct_build.header_pipeline, &state->alloc);
|
||||||
radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.header_pipeline, &state->alloc);
|
radv_DestroyPipeline(_device, state->accel_struct_build.morton_pipeline, &state->alloc);
|
||||||
radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.morton_pipeline, &state->alloc);
|
radv_DestroyPipeline(_device, state->accel_struct_build.update_pipeline, &state->alloc);
|
||||||
radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.update_pipeline, &state->alloc);
|
radv_DestroyPipelineLayout(_device, state->accel_struct_build.copy_p_layout, &state->alloc);
|
||||||
radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.copy_p_layout, &state->alloc);
|
radv_DestroyPipelineLayout(_device, state->accel_struct_build.ploc_p_layout, &state->alloc);
|
||||||
radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.ploc_p_layout, &state->alloc);
|
radv_DestroyPipelineLayout(_device, state->accel_struct_build.lbvh_generate_ir_p_layout, &state->alloc);
|
||||||
radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.lbvh_generate_ir_p_layout,
|
radv_DestroyPipelineLayout(_device, state->accel_struct_build.lbvh_main_p_layout, &state->alloc);
|
||||||
&state->alloc);
|
radv_DestroyPipelineLayout(_device, state->accel_struct_build.leaf_p_layout, &state->alloc);
|
||||||
radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.lbvh_main_p_layout,
|
radv_DestroyPipelineLayout(_device, state->accel_struct_build.encode_p_layout, &state->alloc);
|
||||||
&state->alloc);
|
radv_DestroyPipelineLayout(_device, state->accel_struct_build.header_p_layout, &state->alloc);
|
||||||
radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.leaf_p_layout, &state->alloc);
|
radv_DestroyPipelineLayout(_device, state->accel_struct_build.morton_p_layout, &state->alloc);
|
||||||
radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.encode_p_layout, &state->alloc);
|
radv_DestroyPipelineLayout(_device, state->accel_struct_build.update_p_layout, &state->alloc);
|
||||||
radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.header_p_layout, &state->alloc);
|
|
||||||
radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.morton_p_layout, &state->alloc);
|
|
||||||
radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.update_p_layout, &state->alloc);
|
|
||||||
|
|
||||||
if (state->accel_struct_build.radix_sort)
|
if (state->accel_struct_build.radix_sort)
|
||||||
radix_sort_vk_destroy(state->accel_struct_build.radix_sort, radv_device_to_handle(device), &state->alloc);
|
radix_sort_vk_destroy(state->accel_struct_build.radix_sort, _device, &state->alloc);
|
||||||
|
|
||||||
radv_DestroyBuffer(radv_device_to_handle(device), state->accel_struct_build.null.buffer, &state->alloc);
|
radv_DestroyBuffer(_device, state->accel_struct_build.null.buffer, &state->alloc);
|
||||||
radv_FreeMemory(radv_device_to_handle(device), state->accel_struct_build.null.memory, &state->alloc);
|
radv_FreeMemory(_device, state->accel_struct_build.null.memory, &state->alloc);
|
||||||
vk_common_DestroyAccelerationStructureKHR(radv_device_to_handle(device), state->accel_struct_build.null.accel_struct,
|
vk_common_DestroyAccelerationStructureKHR(_device, state->accel_struct_build.null.accel_struct, &state->alloc);
|
||||||
&state->alloc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkResult
|
static VkResult
|
||||||
@@ -366,6 +363,8 @@ create_build_pipeline_spv(struct radv_device *device, const uint32_t *spv, uint3
|
|||||||
if (*pipeline)
|
if (*pipeline)
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
|
|
||||||
|
VkDevice _device = radv_device_to_handle(device);
|
||||||
|
|
||||||
const VkPipelineLayoutCreateInfo pl_create_info = {
|
const VkPipelineLayoutCreateInfo pl_create_info = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
|
||||||
.setLayoutCount = 0,
|
.setLayoutCount = 0,
|
||||||
@@ -382,14 +381,13 @@ create_build_pipeline_spv(struct radv_device *device, const uint32_t *spv, uint3
|
|||||||
};
|
};
|
||||||
|
|
||||||
VkShaderModule module;
|
VkShaderModule module;
|
||||||
VkResult result = device->vk.dispatch_table.CreateShaderModule(radv_device_to_handle(device), &module_info,
|
VkResult result =
|
||||||
&device->meta_state.alloc, &module);
|
device->vk.dispatch_table.CreateShaderModule(_device, &module_info, &device->meta_state.alloc, &module);
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (!*layout) {
|
if (!*layout) {
|
||||||
result =
|
result = radv_CreatePipelineLayout(_device, &pl_create_info, &device->meta_state.alloc, layout);
|
||||||
radv_CreatePipelineLayout(radv_device_to_handle(device), &pl_create_info, &device->meta_state.alloc, layout);
|
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -409,11 +407,11 @@ create_build_pipeline_spv(struct radv_device *device, const uint32_t *spv, uint3
|
|||||||
.layout = *layout,
|
.layout = *layout,
|
||||||
};
|
};
|
||||||
|
|
||||||
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &pipeline_info,
|
result = radv_compute_pipeline_create(_device, device->meta_state.cache, &pipeline_info, &device->meta_state.alloc,
|
||||||
&device->meta_state.alloc, pipeline);
|
pipeline);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
device->vk.dispatch_table.DestroyShaderModule(radv_device_to_handle(device), module, &device->meta_state.alloc);
|
device->vk.dispatch_table.DestroyShaderModule(_device, module, &device->meta_state.alloc);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user