summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2018-09-17 14:57:51 +0200
committerSamuel Pitoiset <[email protected]>2018-09-18 13:27:59 +0200
commit450a325858a70dc610d77d3d91c61793ce2223a2 (patch)
treea3ce806f7b5f949eb0be8e04cff0f582ded8d7c8 /src/amd
parent3871dd7a92624675bd45d9d596bbe34c33d7bb4d (diff)
radv: do not re-create the sampler for every blits in CmdBlitImage()
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/vulkan/radv_meta_blit.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/amd/vulkan/radv_meta_blit.c b/src/amd/vulkan/radv_meta_blit.c
index e7962911208..ef690edb471 100644
--- a/src/amd/vulkan/radv_meta_blit.c
+++ b/src/amd/vulkan/radv_meta_blit.c
@@ -307,7 +307,7 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer,
VkOffset2D dest_offset_0,
VkOffset2D dest_offset_1,
VkRect2D dest_box,
- VkFilter blit_filter)
+ VkSampler sampler)
{
struct radv_device *device = cmd_buffer->device;
uint32_t src_width = radv_minify(src_iview->image->info.width, src_iview->base_mip);
@@ -331,17 +331,6 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer,
VK_SHADER_STAGE_VERTEX_BIT, 0, 20,
vertex_push_constants);
- VkSampler sampler;
- radv_CreateSampler(radv_device_to_handle(device),
- &(VkSamplerCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
- .magFilter = blit_filter,
- .minFilter = blit_filter,
- .addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
- .addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
- .addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
- }, &cmd_buffer->pool->alloc, &sampler);
-
VkFramebuffer fb;
radv_CreateFramebuffer(radv_device_to_handle(device),
&(VkFramebufferCreateInfo) {
@@ -510,8 +499,6 @@ fail_pipeline:
/* TODO: above comment is not valid for at least descriptor sets/pools,
* as we may not free them till after execution finishes. Check others. */
- radv_DestroySampler(radv_device_to_handle(device), sampler,
- &cmd_buffer->pool->alloc);
radv_DestroyFramebuffer(radv_device_to_handle(device), fb,
&cmd_buffer->pool->alloc);
}
@@ -550,8 +537,10 @@ void radv_CmdBlitImage(
RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
RADV_FROM_HANDLE(radv_image, src_image, srcImage);
RADV_FROM_HANDLE(radv_image, dest_image, destImage);
+ struct radv_device *device = cmd_buffer->device;
struct radv_meta_saved_state saved_state;
bool old_predicating;
+ VkSampler sampler;
/* From the Vulkan 1.0 spec:
*
@@ -561,6 +550,16 @@ void radv_CmdBlitImage(
assert(src_image->info.samples == 1);
assert(dest_image->info.samples == 1);
+ radv_CreateSampler(radv_device_to_handle(device),
+ &(VkSamplerCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
+ .magFilter = filter,
+ .minFilter = filter,
+ .addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
+ .addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
+ .addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
+ }, &cmd_buffer->pool->alloc, &sampler);
+
radv_meta_save(&saved_state, cmd_buffer,
RADV_META_SAVE_GRAPHICS_PIPELINE |
RADV_META_SAVE_CONSTANTS |
@@ -682,7 +681,7 @@ void radv_CmdBlitImage(
dest_image, &dest_iview, destImageLayout,
dest_offset_0, dest_offset_1,
dest_box,
- filter);
+ sampler);
}
}
@@ -690,6 +689,9 @@ void radv_CmdBlitImage(
cmd_buffer->state.predicating = old_predicating;
radv_meta_restore(&saved_state, cmd_buffer);
+
+ radv_DestroySampler(radv_device_to_handle(device), sampler,
+ &cmd_buffer->pool->alloc);
}
void