Mesa (master): radv: create decompress pipelines for separate depth/stencil layouts
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Nov 25 15:45:26 UTC 2019
Module: Mesa
Branch: master
Commit: 905c005561015957da8faf1613034521f8ac42ca
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=905c005561015957da8faf1613034521f8ac42ca
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Thu Oct 17 14:57:04 2019 +0200
radv: create decompress pipelines for separate depth/stencil layouts
No functional changes as the driver still uses the depth+stencil
pipeline.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
src/amd/vulkan/radv_constants.h | 1 +
src/amd/vulkan/radv_meta_decompress.c | 64 +++++++++++++++++++++++------------
src/amd/vulkan/radv_private.h | 2 +-
3 files changed, 44 insertions(+), 23 deletions(-)
diff --git a/src/amd/vulkan/radv_constants.h b/src/amd/vulkan/radv_constants.h
index 7e33d0c584f..6abcf085206 100644
--- a/src/amd/vulkan/radv_constants.h
+++ b/src/amd/vulkan/radv_constants.h
@@ -53,6 +53,7 @@
#define MAX_INLINE_UNIFORM_BLOCK_COUNT 64
#define NUM_DEPTH_CLEAR_PIPELINES 3
+#define NUM_DEPTH_DECOMPRESS_PIPELINES 3
/*
* This is the point we switch from using CP to compute shader
diff --git a/src/amd/vulkan/radv_meta_decompress.c b/src/amd/vulkan/radv_meta_decompress.c
index db1579be8aa..39340c7a778 100644
--- a/src/amd/vulkan/radv_meta_decompress.c
+++ b/src/amd/vulkan/radv_meta_decompress.c
@@ -33,6 +33,12 @@ enum radv_depth_op {
DEPTH_RESUMMARIZE,
};
+enum radv_depth_decompress {
+ DECOMPRESS_DEPTH_STENCIL,
+ DECOMPRESS_DEPTH,
+ DECOMPRESS_STENCIL,
+};
+
static VkResult
create_pass(struct radv_device *device,
uint32_t samples,
@@ -104,6 +110,7 @@ create_pipeline(struct radv_device *device,
VkRenderPass pass,
VkPipelineLayout layout,
enum radv_depth_op op,
+ enum radv_depth_decompress decompress,
VkPipeline *pipeline)
{
VkResult result;
@@ -214,8 +221,10 @@ create_pipeline(struct radv_device *device,
struct radv_graphics_pipeline_create_info extra = {
.use_rectlist = true,
- .db_flush_depth_inplace = true,
- .db_flush_stencil_inplace = true,
+ .db_flush_depth_inplace = decompress == DECOMPRESS_DEPTH_STENCIL ||
+ decompress == DECOMPRESS_DEPTH,
+ .db_flush_stencil_inplace = decompress == DECOMPRESS_DEPTH_STENCIL ||
+ decompress == DECOMPRESS_STENCIL,
.db_resummarize = op == DEPTH_RESUMMARIZE,
};
@@ -245,9 +254,12 @@ radv_device_finish_meta_depth_decomp_state(struct radv_device *device)
radv_DestroyPipelineLayout(radv_device_to_handle(device),
state->depth_decomp[i].p_layout,
&state->alloc);
- radv_DestroyPipeline(radv_device_to_handle(device),
- state->depth_decomp[i].decompress_pipeline,
- &state->alloc);
+
+ for (uint32_t j = 0; j < NUM_DEPTH_DECOMPRESS_PIPELINES; j++) {
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->depth_decomp[i].decompress_pipeline[j],
+ &state->alloc);
+ }
radv_DestroyPipeline(radv_device_to_handle(device),
state->depth_decomp[i].resummarize_pipeline,
&state->alloc);
@@ -284,18 +296,22 @@ radv_device_init_meta_depth_decomp_state(struct radv_device *device, bool on_dem
if (on_demand)
continue;
- res = create_pipeline(device, vs_module_h, samples,
- state->depth_decomp[i].pass,
- state->depth_decomp[i].p_layout,
- DEPTH_DECOMPRESS,
- &state->depth_decomp[i].decompress_pipeline);
- if (res != VK_SUCCESS)
- goto fail;
+ for (uint32_t j = 0; j < NUM_DEPTH_DECOMPRESS_PIPELINES; j++) {
+ res = create_pipeline(device, vs_module_h, samples,
+ state->depth_decomp[i].pass,
+ state->depth_decomp[i].p_layout,
+ DEPTH_DECOMPRESS,
+ j,
+ &state->depth_decomp[i].decompress_pipeline[j]);
+ 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,
+ 0, /* unused */
&state->depth_decomp[i].resummarize_pipeline);
if (res != VK_SUCCESS)
goto fail;
@@ -321,23 +337,27 @@ radv_get_depth_pipeline(struct radv_cmd_buffer *cmd_buffer,
uint32_t samples_log2 = ffs(samples) - 1;
VkPipeline *pipeline;
- if (!state->depth_decomp[samples_log2].decompress_pipeline) {
+ if (!state->depth_decomp[samples_log2].decompress_pipeline[DECOMPRESS_DEPTH_STENCIL]) {
VkResult ret;
- ret = create_pipeline(cmd_buffer->device, VK_NULL_HANDLE, samples,
- state->depth_decomp[samples_log2].pass,
- state->depth_decomp[samples_log2].p_layout,
- DEPTH_DECOMPRESS,
- &state->depth_decomp[samples_log2].decompress_pipeline);
- if (ret != VK_SUCCESS) {
- cmd_buffer->record_result = ret;
- return NULL;
+ for (uint32_t i = 0; i < NUM_DEPTH_DECOMPRESS_PIPELINES; i++) {
+ ret = create_pipeline(cmd_buffer->device, VK_NULL_HANDLE, samples,
+ state->depth_decomp[samples_log2].pass,
+ state->depth_decomp[samples_log2].p_layout,
+ DEPTH_DECOMPRESS,
+ i,
+ &state->depth_decomp[samples_log2].decompress_pipeline[i]);
+ 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,
+ 0, /* unused */
&state->depth_decomp[samples_log2].resummarize_pipeline);
if (ret != VK_SUCCESS) {
cmd_buffer->record_result = ret;
@@ -347,7 +367,7 @@ radv_get_depth_pipeline(struct radv_cmd_buffer *cmd_buffer,
switch (op) {
case DEPTH_DECOMPRESS:
- pipeline = &state->depth_decomp[samples_log2].decompress_pipeline;
+ pipeline = &state->depth_decomp[samples_log2].decompress_pipeline[DECOMPRESS_DEPTH_STENCIL];
break;
case DEPTH_RESUMMARIZE:
pipeline = &state->depth_decomp[samples_log2].resummarize_pipeline;
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 5d63f4145f2..1e15de10924 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -653,7 +653,7 @@ struct radv_meta_state {
struct {
VkPipelineLayout p_layout;
- VkPipeline decompress_pipeline;
+ VkPipeline decompress_pipeline[NUM_DEPTH_DECOMPRESS_PIPELINES];
VkPipeline resummarize_pipeline;
VkRenderPass pass;
} depth_decomp[MAX_SAMPLES_LOG2];
More information about the mesa-commit
mailing list