diff options
author | Fredrik Höglund <[email protected]> | 2017-04-14 00:26:59 +0200 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-04-14 23:21:24 +0200 |
commit | 5ab5d1bee4f01c56c9f87a43b82fd65473b75473 (patch) | |
tree | 568682bd2db84d60813a9ea668f2c5fe2576cbf0 /src/amd/vulkan/radv_meta_buffer.c | |
parent | f95caae504a894d804257674538640a9178dceb2 (diff) |
radv: use push descriptors in meta
Use push descriptors instead of temp descriptor sets.
Signed-off-by: Fredrik Höglund <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_meta_buffer.c')
-rw-r--r-- | src/amd/vulkan/radv_meta_buffer.c | 122 |
1 files changed, 50 insertions, 72 deletions
diff --git a/src/amd/vulkan/radv_meta_buffer.c b/src/amd/vulkan/radv_meta_buffer.c index cb13f2f288f..0bb926fa902 100644 --- a/src/amd/vulkan/radv_meta_buffer.c +++ b/src/amd/vulkan/radv_meta_buffer.c @@ -126,6 +126,7 @@ VkResult radv_device_init_meta_buffer_state(struct radv_device *device) VkDescriptorSetLayoutCreateInfo fill_ds_create_info = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, + .flags = VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR, .bindingCount = 1, .pBindings = (VkDescriptorSetLayoutBinding[]) { { @@ -147,6 +148,7 @@ VkResult radv_device_init_meta_buffer_state(struct radv_device *device) VkDescriptorSetLayoutCreateInfo copy_ds_create_info = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, + .flags = VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR, .bindingCount = 2, .pBindings = (VkDescriptorSetLayoutBinding[]) { { @@ -297,46 +299,37 @@ static void fill_buffer_shader(struct radv_cmd_buffer *cmd_buffer, struct radv_device *device = cmd_buffer->device; uint64_t block_count = round_up_u64(size, 1024); struct radv_meta_saved_compute_state saved_state; - VkDescriptorSet ds; radv_meta_save_compute(&saved_state, cmd_buffer, 4); - radv_temp_descriptor_set_create(device, cmd_buffer, - device->meta_state.buffer.fill_ds_layout, - &ds); - struct radv_buffer dst_buffer = { .bo = bo, .offset = offset, .size = size }; - radv_UpdateDescriptorSets(radv_device_to_handle(device), - 1, /* writeCount */ - (VkWriteDescriptorSet[]) { - { - .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - .dstSet = ds, - .dstBinding = 0, - .dstArrayElement = 0, - .descriptorCount = 1, - .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, - .pBufferInfo = &(VkDescriptorBufferInfo) { - .buffer = radv_buffer_to_handle(&dst_buffer), - .offset = 0, - .range = size - } - } - }, 0, NULL); - radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer), VK_PIPELINE_BIND_POINT_COMPUTE, device->meta_state.buffer.fill_pipeline); - radv_CmdBindDescriptorSets(radv_cmd_buffer_to_handle(cmd_buffer), - VK_PIPELINE_BIND_POINT_COMPUTE, - device->meta_state.buffer.fill_p_layout, 0, 1, - &ds, 0, NULL); + radv_meta_push_descriptor_set(cmd_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, + device->meta_state.buffer.fill_p_layout, + 0, /* set */ + 1, /* descriptorWriteCount */ + (VkWriteDescriptorSet[]) { + { + .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, + .dstBinding = 0, + .dstArrayElement = 0, + .descriptorCount = 1, + .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, + .pBufferInfo = &(VkDescriptorBufferInfo) { + .buffer = radv_buffer_to_handle(&dst_buffer), + .offset = 0, + .range = size + } + } + }); radv_CmdPushConstants(radv_cmd_buffer_to_handle(cmd_buffer), device->meta_state.buffer.fill_p_layout, @@ -345,8 +338,6 @@ static void fill_buffer_shader(struct radv_cmd_buffer *cmd_buffer, radv_CmdDispatch(radv_cmd_buffer_to_handle(cmd_buffer), block_count, 1, 1); - radv_temp_descriptor_set_destroy(device, ds); - radv_meta_restore_compute(&saved_state, cmd_buffer, 4); } @@ -359,14 +350,9 @@ static void copy_buffer_shader(struct radv_cmd_buffer *cmd_buffer, struct radv_device *device = cmd_buffer->device; uint64_t block_count = round_up_u64(size, 1024); struct radv_meta_saved_compute_state saved_state; - VkDescriptorSet ds; radv_meta_save_compute(&saved_state, cmd_buffer, 0); - radv_temp_descriptor_set_create(device, cmd_buffer, - device->meta_state.buffer.copy_ds_layout, - &ds); - struct radv_buffer dst_buffer = { .bo = dst_bo, .offset = dst_offset, @@ -379,51 +365,43 @@ static void copy_buffer_shader(struct radv_cmd_buffer *cmd_buffer, .size = size }; - radv_UpdateDescriptorSets(radv_device_to_handle(device), - 2, /* writeCount */ - (VkWriteDescriptorSet[]) { - { - .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - .dstSet = ds, - .dstBinding = 0, - .dstArrayElement = 0, - .descriptorCount = 1, - .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, - .pBufferInfo = &(VkDescriptorBufferInfo) { - .buffer = radv_buffer_to_handle(&dst_buffer), - .offset = 0, - .range = size - } - }, - { - .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, - .dstSet = ds, - .dstBinding = 1, - .dstArrayElement = 0, - .descriptorCount = 1, - .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, - .pBufferInfo = &(VkDescriptorBufferInfo) { - .buffer = radv_buffer_to_handle(&src_buffer), - .offset = 0, - .range = size - } - } - }, 0, NULL); - radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer), VK_PIPELINE_BIND_POINT_COMPUTE, device->meta_state.buffer.copy_pipeline); - radv_CmdBindDescriptorSets(radv_cmd_buffer_to_handle(cmd_buffer), - VK_PIPELINE_BIND_POINT_COMPUTE, - device->meta_state.buffer.copy_p_layout, 0, 1, - &ds, 0, NULL); - + radv_meta_push_descriptor_set(cmd_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, + device->meta_state.buffer.copy_p_layout, + 0, /* set */ + 2, /* descriptorWriteCount */ + (VkWriteDescriptorSet[]) { + { + .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, + .dstBinding = 0, + .dstArrayElement = 0, + .descriptorCount = 1, + .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, + .pBufferInfo = &(VkDescriptorBufferInfo) { + .buffer = radv_buffer_to_handle(&dst_buffer), + .offset = 0, + .range = size + } + }, + { + .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, + .dstBinding = 1, + .dstArrayElement = 0, + .descriptorCount = 1, + .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, + .pBufferInfo = &(VkDescriptorBufferInfo) { + .buffer = radv_buffer_to_handle(&src_buffer), + .offset = 0, + .range = size + } + } + }); radv_CmdDispatch(radv_cmd_buffer_to_handle(cmd_buffer), block_count, 1, 1); - radv_temp_descriptor_set_destroy(device, ds); - radv_meta_restore_compute(&saved_state, cmd_buffer, 0); } |