aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_meta_decompress.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-10-17 14:48:23 +0200
committerSamuel Pitoiset <[email protected]>2019-11-25 16:29:18 +0100
commitfaa58201f362e65d7b24f3cb1dd1fb8a87a7f8db (patch)
tree2e059a7bb7b9b2ec9b3c3f753c54f16ee30b205f /src/amd/vulkan/radv_meta_decompress.c
parent8f0fb38825594fd74b59c5a965d817608ed113c6 (diff)
radv: rework creation of decompress/resummarize meta pipelines
This refactoring will help for creating more decompress pipelines. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_meta_decompress.c')
-rw-r--r--src/amd/vulkan/radv_meta_decompress.c70
1 files changed, 36 insertions, 34 deletions
diff --git a/src/amd/vulkan/radv_meta_decompress.c b/src/amd/vulkan/radv_meta_decompress.c
index 649a22cda74..db1579be8aa 100644
--- a/src/amd/vulkan/radv_meta_decompress.c
+++ b/src/amd/vulkan/radv_meta_decompress.c
@@ -28,6 +28,11 @@
#include "radv_private.h"
#include "sid.h"
+enum radv_depth_op {
+ DEPTH_DECOMPRESS,
+ DEPTH_RESUMMARIZE,
+};
+
static VkResult
create_pass(struct radv_device *device,
uint32_t samples,
@@ -98,15 +103,15 @@ create_pipeline(struct radv_device *device,
uint32_t samples,
VkRenderPass pass,
VkPipelineLayout layout,
- VkPipeline *decompress_pipeline,
- VkPipeline *resummarize_pipeline)
+ enum radv_depth_op op,
+ VkPipeline *pipeline)
{
VkResult result;
VkDevice device_h = radv_device_to_handle(device);
struct radv_shader_module vs_module = {0};
mtx_lock(&device->meta_state.mtx);
- if (*decompress_pipeline) {
+ if (*pipeline) {
mtx_unlock(&device->meta_state.mtx);
return VK_SUCCESS;
}
@@ -207,34 +212,18 @@ create_pipeline(struct radv_device *device,
.subpass = 0,
};
- result = radv_graphics_pipeline_create(device_h,
- radv_pipeline_cache_to_handle(&device->meta_state.cache),
- &pipeline_create_info,
- &(struct radv_graphics_pipeline_create_info) {
- .use_rectlist = true,
- .db_flush_depth_inplace = true,
- .db_flush_stencil_inplace = true,
- },
- &device->meta_state.alloc,
- decompress_pipeline);
- if (result != VK_SUCCESS)
- goto cleanup;
+ struct radv_graphics_pipeline_create_info extra = {
+ .use_rectlist = true,
+ .db_flush_depth_inplace = true,
+ .db_flush_stencil_inplace = true,
+ .db_resummarize = op == DEPTH_RESUMMARIZE,
+ };
result = radv_graphics_pipeline_create(device_h,
radv_pipeline_cache_to_handle(&device->meta_state.cache),
- &pipeline_create_info,
- &(struct radv_graphics_pipeline_create_info) {
- .use_rectlist = true,
- .db_flush_depth_inplace = true,
- .db_flush_stencil_inplace = true,
- .db_resummarize = true,
- },
+ &pipeline_create_info, &extra,
&device->meta_state.alloc,
- resummarize_pipeline);
- if (result != VK_SUCCESS)
- goto cleanup;
-
- goto cleanup;
+ pipeline);
cleanup:
ralloc_free(fs_module.nir);
@@ -298,7 +287,15 @@ radv_device_init_meta_depth_decomp_state(struct radv_device *device, bool on_dem
res = create_pipeline(device, vs_module_h, samples,
state->depth_decomp[i].pass,
state->depth_decomp[i].p_layout,
- &state->depth_decomp[i].decompress_pipeline,
+ DEPTH_DECOMPRESS,
+ &state->depth_decomp[i].decompress_pipeline);
+ if (res != VK_SUCCESS)
+ goto fail;
+
+ res = create_pipeline(device, vs_module_h, samples,
+ state->depth_decomp[i].pass,
+ state->depth_decomp[i].p_layout,
+ DEPTH_RESUMMARIZE,
&state->depth_decomp[i].resummarize_pipeline);
if (res != VK_SUCCESS)
goto fail;
@@ -315,11 +312,6 @@ cleanup:
return res;
}
-enum radv_depth_op {
- DEPTH_DECOMPRESS,
- DEPTH_RESUMMARIZE,
-};
-
static VkPipeline *
radv_get_depth_pipeline(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image, enum radv_depth_op op)
@@ -335,7 +327,17 @@ radv_get_depth_pipeline(struct radv_cmd_buffer *cmd_buffer,
ret = create_pipeline(cmd_buffer->device, VK_NULL_HANDLE, samples,
state->depth_decomp[samples_log2].pass,
state->depth_decomp[samples_log2].p_layout,
- &state->depth_decomp[samples_log2].decompress_pipeline,
+ DEPTH_DECOMPRESS,
+ &state->depth_decomp[samples_log2].decompress_pipeline);
+ if (ret != VK_SUCCESS) {
+ cmd_buffer->record_result = ret;
+ return NULL;
+ }
+
+ ret = create_pipeline(cmd_buffer->device, VK_NULL_HANDLE, samples,
+ state->depth_decomp[samples_log2].pass,
+ state->depth_decomp[samples_log2].p_layout,
+ DEPTH_RESUMMARIZE,
&state->depth_decomp[samples_log2].resummarize_pipeline);
if (ret != VK_SUCCESS) {
cmd_buffer->record_result = ret;