mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
radv: create only one pipeline for decompressing depth/stencil images
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11263>
This commit is contained in:
parent
213c4c5f44
commit
60348360a2
2 changed files with 20 additions and 37 deletions
|
|
@ -33,12 +33,6 @@ 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, VkRenderPass *pass)
|
||||
{
|
||||
|
|
@ -123,8 +117,7 @@ create_pipeline_layout(struct radv_device *device, VkPipelineLayout *layout)
|
|||
|
||||
static VkResult
|
||||
create_pipeline(struct radv_device *device, uint32_t samples, VkRenderPass pass,
|
||||
VkPipelineLayout layout, enum radv_depth_op op,
|
||||
enum radv_depth_decompress decompress, VkPipeline *pipeline)
|
||||
VkPipelineLayout layout, enum radv_depth_op op, VkPipeline *pipeline)
|
||||
{
|
||||
VkResult result;
|
||||
VkDevice device_h = radv_device_to_handle(device);
|
||||
|
|
@ -237,10 +230,8 @@ create_pipeline(struct radv_device *device, uint32_t samples, VkRenderPass pass,
|
|||
|
||||
struct radv_graphics_pipeline_create_info extra = {
|
||||
.use_rectlist = true,
|
||||
.depth_compress_disable =
|
||||
decompress == DECOMPRESS_DEPTH_STENCIL || decompress == DECOMPRESS_DEPTH,
|
||||
.stencil_compress_disable =
|
||||
decompress == DECOMPRESS_DEPTH_STENCIL || decompress == DECOMPRESS_STENCIL,
|
||||
.depth_compress_disable = true,
|
||||
.stencil_compress_disable = true,
|
||||
.resummarize_enable = op == DEPTH_RESUMMARIZE,
|
||||
};
|
||||
|
||||
|
|
@ -266,10 +257,8 @@ 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);
|
||||
|
||||
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].decompress_pipeline, &state->alloc);
|
||||
radv_DestroyPipeline(radv_device_to_handle(device),
|
||||
state->depth_decomp[i].resummarize_pipeline, &state->alloc);
|
||||
}
|
||||
|
|
@ -295,16 +284,14 @@ radv_device_init_meta_depth_decomp_state(struct radv_device *device, bool on_dem
|
|||
if (on_demand)
|
||||
continue;
|
||||
|
||||
for (uint32_t j = 0; j < NUM_DEPTH_DECOMPRESS_PIPELINES; j++) {
|
||||
res = create_pipeline(device, 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, 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;
|
||||
|
||||
res = create_pipeline(device, samples, state->depth_decomp[i].pass,
|
||||
state->depth_decomp[i].p_layout, DEPTH_RESUMMARIZE, 0, /* unused */
|
||||
state->depth_decomp[i].p_layout, DEPTH_RESUMMARIZE,
|
||||
&state->depth_decomp[i].resummarize_pipeline);
|
||||
if (res != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
|
@ -324,25 +311,21 @@ radv_get_depth_pipeline(struct radv_cmd_buffer *cmd_buffer, struct radv_image *i
|
|||
struct radv_meta_state *state = &cmd_buffer->device->meta_state;
|
||||
uint32_t samples = image->info.samples;
|
||||
uint32_t samples_log2 = ffs(samples) - 1;
|
||||
enum radv_depth_decompress decompress = DECOMPRESS_DEPTH_STENCIL;
|
||||
VkPipeline *pipeline;
|
||||
|
||||
if (!state->depth_decomp[samples_log2].decompress_pipeline[decompress]) {
|
||||
if (!state->depth_decomp[samples_log2].decompress_pipeline) {
|
||||
VkResult ret;
|
||||
|
||||
for (uint32_t i = 0; i < NUM_DEPTH_DECOMPRESS_PIPELINES; i++) {
|
||||
ret = create_pipeline(cmd_buffer->device, 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, 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;
|
||||
}
|
||||
|
||||
ret = create_pipeline(cmd_buffer->device, 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;
|
||||
|
|
@ -352,7 +335,7 @@ radv_get_depth_pipeline(struct radv_cmd_buffer *cmd_buffer, struct radv_image *i
|
|||
|
||||
switch (op) {
|
||||
case DEPTH_DECOMPRESS:
|
||||
pipeline = &state->depth_decomp[samples_log2].decompress_pipeline[decompress];
|
||||
pipeline = &state->depth_decomp[samples_log2].decompress_pipeline;
|
||||
break;
|
||||
case DEPTH_RESUMMARIZE:
|
||||
pipeline = &state->depth_decomp[samples_log2].resummarize_pipeline;
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ struct radv_meta_state {
|
|||
|
||||
struct {
|
||||
VkPipelineLayout p_layout;
|
||||
VkPipeline decompress_pipeline[NUM_DEPTH_DECOMPRESS_PIPELINES];
|
||||
VkPipeline decompress_pipeline;
|
||||
VkPipeline resummarize_pipeline;
|
||||
VkRenderPass pass;
|
||||
} depth_decomp[MAX_SAMPLES_LOG2];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue