radv/meta: create btoi r32g32b32 pipeline on-demand when needed
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30248>
This commit is contained in:
@@ -344,7 +344,28 @@ create_btoi_r32g32b32_pipeline(struct radv_device *device, VkPipeline *pipeline)
|
||||
}
|
||||
|
||||
static VkResult
|
||||
radv_device_init_meta_btoi_r32g32b32_state(struct radv_device *device)
|
||||
get_btoi_r32g32b32_pipeline(struct radv_device *device, VkPipeline *pipeline_out)
|
||||
{
|
||||
struct radv_meta_state *state = &device->meta_state;
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
mtx_lock(&state->mtx);
|
||||
|
||||
if (!state->btoi_r32g32b32.pipeline) {
|
||||
result = create_btoi_r32g32b32_pipeline(device, &state->btoi_r32g32b32.pipeline);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*pipeline_out = state->btoi_r32g32b32.pipeline;
|
||||
|
||||
fail:
|
||||
mtx_unlock(&state->mtx);
|
||||
return result;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
radv_device_init_meta_btoi_r32g32b32_state(struct radv_device *device, bool on_demand)
|
||||
{
|
||||
VkResult result;
|
||||
|
||||
@@ -378,6 +399,9 @@ radv_device_init_meta_btoi_r32g32b32_state(struct radv_device *device)
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
if (on_demand)
|
||||
return VK_SUCCESS;
|
||||
|
||||
return create_btoi_r32g32b32_pipeline(device, &device->meta_state.btoi_r32g32b32.pipeline);
|
||||
}
|
||||
|
||||
@@ -867,7 +891,7 @@ radv_device_init_meta_bufimage_state(struct radv_device *device, bool on_demand)
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
result = radv_device_init_meta_btoi_r32g32b32_state(device);
|
||||
result = radv_device_init_meta_btoi_r32g32b32_state(device, on_demand);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
@@ -1190,11 +1214,18 @@ radv_meta_buffer_to_image_cs_r32g32b32(struct radv_cmd_buffer *cmd_buffer, struc
|
||||
struct radv_meta_blit2d_surf *dst, struct radv_meta_blit2d_rect *rect)
|
||||
{
|
||||
struct radv_device *device = radv_cmd_buffer_device(cmd_buffer);
|
||||
VkPipeline pipeline = device->meta_state.btoi_r32g32b32.pipeline;
|
||||
struct radv_buffer_view src_view, dst_view;
|
||||
unsigned dst_offset = 0;
|
||||
VkPipeline pipeline;
|
||||
unsigned stride;
|
||||
VkBuffer buffer;
|
||||
VkResult result;
|
||||
|
||||
result = get_btoi_r32g32b32_pipeline(device, &pipeline);
|
||||
if (result != VK_SUCCESS) {
|
||||
vk_command_buffer_set_error(&cmd_buffer->vk, result);
|
||||
return;
|
||||
}
|
||||
|
||||
/* This special btoi path for R32G32B32 formats will write the linear
|
||||
* image as a buffer with the same underlying memory. The compute
|
||||
|
Reference in New Issue
Block a user