diff options
author | Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> | 2017-03-01 00:39:58 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> | 2017-03-30 22:21:14 +0200 |
commit | 4083a2ddcb02a6e79bcc21b3f5b20e10dcef73b1 (patch) | |
tree | 1dc608f5ed73ec0da75437c0531cb3f4d9c04592 /src/amd | |
parent | 42f2bccd119d12a53b61556767b77d59d5a9780f (diff) |
radv: Set proper viewport & scissor for meta draws.
Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/vulkan/radv_meta_blit.c | 53 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_blit2d.c | 52 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_clear.c | 54 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_decompress.c | 39 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_fast_clear.c | 52 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_resolve.c | 39 |
6 files changed, 214 insertions, 75 deletions
diff --git a/src/amd/vulkan/radv_meta_blit.c b/src/amd/vulkan/radv_meta_blit.c index 9d4d3f02555..228aefaf4b6 100644 --- a/src/amd/vulkan/radv_meta_blit.c +++ b/src/amd/vulkan/radv_meta_blit.c @@ -246,8 +246,8 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer, unsigned vb_size = 3 * sizeof(*vb_data); vb_data[0] = (struct blit_vb_data) { .pos = { - dest_offset_0.x, - dest_offset_0.y, + -1.0, + -1.0, }, .tex_coord = { (float)src_offset_0.x / (float)src_iview->extent.width, @@ -258,8 +258,8 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer, vb_data[1] = (struct blit_vb_data) { .pos = { - dest_offset_0.x, - dest_offset_1.y, + -1.0, + 1.0, }, .tex_coord = { (float)src_offset_0.x / (float)src_iview->extent.width, @@ -270,8 +270,8 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer, vb_data[2] = (struct blit_vb_data) { .pos = { - dest_offset_1.x, - dest_offset_0.y, + 1.0, + -1.0, }, .tex_coord = { (float)src_offset_1.x / (float)src_iview->extent.width, @@ -444,6 +444,23 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer, device->meta_state.blit.pipeline_layout, 0, 1, &set, 0, NULL); + radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkViewport) { + .x = dest_offset_0.x, + .y = dest_offset_0.y, + .width = dest_offset_1.x - dest_offset_0.x, + .height = dest_offset_1.y - dest_offset_0.y, + .minDepth = 0.0f, + .maxDepth = 1.0f + }); + + radv_CmdSetScissor(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkRect2D) { + .offset = (VkOffset2D) { MIN2(dest_offset_0.x, dest_offset_1.x), MIN2(dest_offset_0.y, dest_offset_1.y) }, + .extent = (VkExtent2D) { + abs(dest_offset_1.x - dest_offset_0.x), + abs(dest_offset_1.y - dest_offset_0.y) + }, + }); + radv_CmdDraw(radv_cmd_buffer_to_handle(cmd_buffer), 3, 1, 0, 0); radv_CmdEndRenderPass(radv_cmd_buffer_to_handle(cmd_buffer)); @@ -813,8 +830,8 @@ radv_device_init_meta_blit_color(struct radv_device *device, }, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &(VkPipelineRasterizationStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, @@ -842,8 +859,10 @@ radv_device_init_meta_blit_color(struct radv_device *device, }, .pDynamicState = &(VkPipelineDynamicStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, - .dynamicStateCount = 2, + .dynamicStateCount = 4, .pDynamicStates = (VkDynamicState[]) { + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_LINE_WIDTH, VK_DYNAMIC_STATE_BLEND_CONSTANTS, }, @@ -990,8 +1009,8 @@ radv_device_init_meta_blit_depth(struct radv_device *device, }, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &(VkPipelineRasterizationStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, @@ -1019,8 +1038,10 @@ radv_device_init_meta_blit_depth(struct radv_device *device, }, .pDynamicState = &(VkPipelineDynamicStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, - .dynamicStateCount = 7, + .dynamicStateCount = 9, .pDynamicStates = (VkDynamicState[]) { + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_LINE_WIDTH, VK_DYNAMIC_STATE_DEPTH_BIAS, VK_DYNAMIC_STATE_BLEND_CONSTANTS, @@ -1169,8 +1190,8 @@ radv_device_init_meta_blit_stencil(struct radv_device *device, }, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &(VkPipelineRasterizationStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, @@ -1218,8 +1239,10 @@ radv_device_init_meta_blit_stencil(struct radv_device *device, .pDynamicState = &(VkPipelineDynamicStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, - .dynamicStateCount = 4, + .dynamicStateCount = 6, .pDynamicStates = (VkDynamicState[]) { + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_LINE_WIDTH, VK_DYNAMIC_STATE_DEPTH_BIAS, VK_DYNAMIC_STATE_BLEND_CONSTANTS, diff --git a/src/amd/vulkan/radv_meta_blit2d.c b/src/amd/vulkan/radv_meta_blit2d.c index d0cf5885bdb..e6848de7e97 100644 --- a/src/amd/vulkan/radv_meta_blit2d.c +++ b/src/amd/vulkan/radv_meta_blit2d.c @@ -305,8 +305,8 @@ radv_meta_blit2d_normal_dst(struct radv_cmd_buffer *cmd_buffer, vb_data[0] = (struct blit_vb_data) { .pos = { - rects[r].dst_x, - rects[r].dst_y, + -1.0, + -1.0, }, .tex_coord = { rects[r].src_x, @@ -316,8 +316,8 @@ radv_meta_blit2d_normal_dst(struct radv_cmd_buffer *cmd_buffer, vb_data[1] = (struct blit_vb_data) { .pos = { - rects[r].dst_x, - rects[r].dst_y + rects[r].height, + -1.0, + 1.0, }, .tex_coord = { rects[r].src_x, @@ -327,8 +327,8 @@ radv_meta_blit2d_normal_dst(struct radv_cmd_buffer *cmd_buffer, vb_data[2] = (struct blit_vb_data) { .pos = { - rects[r].dst_x + rects[r].width, - rects[r].dst_y, + 1.0, + -1.0, }, .tex_coord = { rects[r].src_x + rects[r].width, @@ -408,6 +408,22 @@ radv_meta_blit2d_normal_dst(struct radv_cmd_buffer *cmd_buffer, bind_stencil_pipeline(cmd_buffer, src_type); } + radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkViewport) { + .x = rects[r].dst_x, + .y = rects[r].dst_y, + .width = rects[r].width, + .height = rects[r].height, + .minDepth = 0.0f, + .maxDepth = 1.0f + }); + + radv_CmdSetScissor(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkRect2D) { + .offset = (VkOffset2D) { rects[r].dst_x, rects[r].dst_y }, + .extent = (VkExtent2D) { rects[r].width, rects[r].height }, + }); + + + radv_CmdDraw(radv_cmd_buffer_to_handle(cmd_buffer), 3, 1, 0, 0); radv_CmdEndRenderPass(radv_cmd_buffer_to_handle(cmd_buffer)); @@ -798,8 +814,8 @@ blit2d_init_color_pipeline(struct radv_device *device, }, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &(VkPipelineRasterizationStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, @@ -827,8 +843,10 @@ blit2d_init_color_pipeline(struct radv_device *device, }, .pDynamicState = &(VkPipelineDynamicStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, - .dynamicStateCount = 7, + .dynamicStateCount = 9, .pDynamicStates = (VkDynamicState[]) { + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_LINE_WIDTH, VK_DYNAMIC_STATE_DEPTH_BIAS, VK_DYNAMIC_STATE_BLEND_CONSTANTS, @@ -951,8 +969,8 @@ blit2d_init_depth_only_pipeline(struct radv_device *device, }, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &(VkPipelineRasterizationStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, @@ -980,8 +998,10 @@ blit2d_init_depth_only_pipeline(struct radv_device *device, }, .pDynamicState = &(VkPipelineDynamicStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, - .dynamicStateCount = 7, + .dynamicStateCount = 9, .pDynamicStates = (VkDynamicState[]) { + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_LINE_WIDTH, VK_DYNAMIC_STATE_DEPTH_BIAS, VK_DYNAMIC_STATE_BLEND_CONSTANTS, @@ -1104,8 +1124,8 @@ blit2d_init_stencil_only_pipeline(struct radv_device *device, }, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &(VkPipelineRasterizationStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, @@ -1152,8 +1172,10 @@ blit2d_init_stencil_only_pipeline(struct radv_device *device, }, .pDynamicState = &(VkPipelineDynamicStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, - .dynamicStateCount = 4, + .dynamicStateCount = 6, .pDynamicStates = (VkDynamicState[]) { + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_LINE_WIDTH, VK_DYNAMIC_STATE_DEPTH_BIAS, VK_DYNAMIC_STATE_BLEND_CONSTANTS, diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c index 6583d64153f..cbb90a4f280 100644 --- a/src/amd/vulkan/radv_meta_clear.c +++ b/src/amd/vulkan/radv_meta_clear.c @@ -159,8 +159,8 @@ create_pipeline(struct radv_device *device, }, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &(VkPipelineRasterizationStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, @@ -187,9 +187,11 @@ create_pipeline(struct radv_device *device, * we need only restore dynamic state was vkCmdSet. */ .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, - .dynamicStateCount = 6, + .dynamicStateCount = 8, .pDynamicStates = (VkDynamicState[]) { /* Everything except stencil write mask */ + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_LINE_WIDTH, VK_DYNAMIC_STATE_DEPTH_BIAS, VK_DYNAMIC_STATE_BLEND_CONSTANTS, @@ -408,22 +410,22 @@ emit_color_clear(struct radv_cmd_buffer *cmd_buffer, const struct color_clear_vattrs vertex_data[3] = { { .position = { - clear_rect->rect.offset.x, - clear_rect->rect.offset.y, + -1.0, + -1.0, }, .color = clear_value, }, { .position = { - clear_rect->rect.offset.x, - clear_rect->rect.offset.y + clear_rect->rect.extent.height, + -1.0, + 1.0, }, .color = clear_value, }, { .position = { - clear_rect->rect.offset.x + clear_rect->rect.extent.width, - clear_rect->rect.offset.y, + 1.0, + -1.0, }, .color = clear_value, }, @@ -457,6 +459,17 @@ emit_color_clear(struct radv_cmd_buffer *cmd_buffer, pipeline_h); } + radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkViewport) { + .x = clear_rect->rect.offset.x, + .y = clear_rect->rect.offset.y, + .width = clear_rect->rect.extent.width, + .height = clear_rect->rect.extent.height, + .minDepth = 0.0f, + .maxDepth = 1.0f + }); + + radv_CmdSetScissor(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &clear_rect->rect); + radv_CmdDraw(cmd_buffer_h, 3, clear_rect->layerCount, 0, 0); radv_cmd_buffer_set_subpass(cmd_buffer, subpass, false); @@ -683,22 +696,22 @@ emit_depthstencil_clear(struct radv_cmd_buffer *cmd_buffer, const struct depthstencil_clear_vattrs vertex_data[3] = { { .position = { - clear_rect->rect.offset.x, - clear_rect->rect.offset.y, + -1.0, + -1.0 }, .depth_clear = clear_value.depth, }, { .position = { - clear_rect->rect.offset.x, - clear_rect->rect.offset.y + clear_rect->rect.extent.height, + -1.0, + 1.0, }, .depth_clear = clear_value.depth, }, { .position = { - clear_rect->rect.offset.x + clear_rect->rect.extent.width, - clear_rect->rect.offset.y, + 1.0, + -1.0, }, .depth_clear = clear_value.depth, }, @@ -736,6 +749,17 @@ emit_depthstencil_clear(struct radv_cmd_buffer *cmd_buffer, if (depth_view_can_fast_clear(iview, subpass->depth_stencil_attachment.layout, clear_rect)) radv_set_depth_clear_regs(cmd_buffer, iview->image, clear_value, aspects); + radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkViewport) { + .x = clear_rect->rect.offset.x, + .y = clear_rect->rect.offset.y, + .width = clear_rect->rect.extent.width, + .height = clear_rect->rect.extent.height, + .minDepth = 0.0f, + .maxDepth = 1.0f + }); + + radv_CmdSetScissor(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &clear_rect->rect); + radv_CmdDraw(cmd_buffer_h, 3, clear_rect->layerCount, 0, 0); } diff --git a/src/amd/vulkan/radv_meta_decompress.c b/src/amd/vulkan/radv_meta_decompress.c index 2ee27d40970..854b88a3622 100644 --- a/src/amd/vulkan/radv_meta_decompress.c +++ b/src/amd/vulkan/radv_meta_decompress.c @@ -178,8 +178,8 @@ create_pipeline(struct radv_device *device, }, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &(VkPipelineRasterizationStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, @@ -210,7 +210,14 @@ create_pipeline(struct radv_device *device, .depthBoundsTestEnable = false, .stencilTestEnable = false, }, - .pDynamicState = NULL, + .pDynamicState = &(VkPipelineDynamicStateCreateInfo) { + .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, + .dynamicStateCount = 2, + .pDynamicStates = (VkDynamicState[]) { + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, + }, + }, .renderPass = device->meta_state.depth_decomp.pass, .subpass = 0, }; @@ -317,20 +324,20 @@ emit_depth_decomp(struct radv_cmd_buffer *cmd_buffer, const struct vertex_attrs vertex_data[3] = { { .position = { - dest_offset->x, - dest_offset->y, + -1.0, + -1.0, }, }, { .position = { - dest_offset->x, - dest_offset->y + depth_decomp_extent->height, + -1.0, + 1.0, }, }, { .position = { - dest_offset->x + depth_decomp_extent->width, - dest_offset->y, + 1.0, + -1.0, }, }, }; @@ -358,6 +365,20 @@ emit_depth_decomp(struct radv_cmd_buffer *cmd_buffer, pipeline_h); } + radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkViewport) { + .x = dest_offset->x, + .y = dest_offset->y, + .width = depth_decomp_extent->width, + .height = depth_decomp_extent->height, + .minDepth = 0.0f, + .maxDepth = 1.0f + }); + + radv_CmdSetScissor(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkRect2D) { + .offset = *dest_offset, + .extent = *depth_decomp_extent, + }); + radv_CmdDraw(cmd_buffer_h, 3, 1, 0, 0); } diff --git a/src/amd/vulkan/radv_meta_fast_clear.c b/src/amd/vulkan/radv_meta_fast_clear.c index eedd3e15b94..3393bcb25ea 100644 --- a/src/amd/vulkan/radv_meta_fast_clear.c +++ b/src/amd/vulkan/radv_meta_fast_clear.c @@ -214,8 +214,8 @@ create_pipeline(struct radv_device *device, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &rs_state, .pMultisampleState = &(VkPipelineMultisampleStateCreateInfo) { @@ -227,7 +227,14 @@ create_pipeline(struct radv_device *device, .alphaToOneEnable = false, }, .pColorBlendState = &blend_state, - .pDynamicState = NULL, + .pDynamicState = &(VkPipelineDynamicStateCreateInfo) { + .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, + .dynamicStateCount = 2, + .pDynamicStates = (VkDynamicState[]) { + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, + }, + }, .renderPass = device->meta_state.fast_clear_flush.pass, .subpass = 0, }, @@ -252,8 +259,8 @@ create_pipeline(struct radv_device *device, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &rs_state, .pMultisampleState = &(VkPipelineMultisampleStateCreateInfo) { @@ -265,7 +272,14 @@ create_pipeline(struct radv_device *device, .alphaToOneEnable = false, }, .pColorBlendState = &blend_state, - .pDynamicState = NULL, + .pDynamicState = &(VkPipelineDynamicStateCreateInfo) { + .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, + .dynamicStateCount = 2, + .pDynamicStates = (VkDynamicState[]) { + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, + }, + }, .renderPass = device->meta_state.fast_clear_flush.pass, .subpass = 0, }, @@ -354,20 +368,20 @@ emit_fast_clear_flush(struct radv_cmd_buffer *cmd_buffer, const struct vertex_attrs vertex_data[3] = { { .position = { - 0, - 0, + -1.0, + -1.0, }, }, { .position = { - 0, - resolve_extent->height, + -1.0, + 1.0, }, }, { .position = { - resolve_extent->width, - 0, + 1.0, + -1.0, }, }, }; @@ -400,6 +414,20 @@ emit_fast_clear_flush(struct radv_cmd_buffer *cmd_buffer, pipeline_h); } + radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkViewport) { + .x = 0, + .y = 0, + .width = resolve_extent->width, + .height = resolve_extent->height, + .minDepth = 0.0f, + .maxDepth = 1.0f + }); + + radv_CmdSetScissor(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkRect2D) { + .offset = (VkOffset2D) { 0, 0 }, + .extent = (VkExtent2D) { resolve_extent->width, resolve_extent->height }, + }); + radv_CmdDraw(cmd_buffer_h, 3, 1, 0, 0); cmd_buffer->state.flush_bits |= (RADV_CMD_FLAG_FLUSH_AND_INV_CB | RADV_CMD_FLAG_FLUSH_AND_INV_CB_META); diff --git a/src/amd/vulkan/radv_meta_resolve.c b/src/amd/vulkan/radv_meta_resolve.c index 105270cb742..52f7246f6e3 100644 --- a/src/amd/vulkan/radv_meta_resolve.c +++ b/src/amd/vulkan/radv_meta_resolve.c @@ -200,8 +200,8 @@ create_pipeline(struct radv_device *device, }, .pViewportState = &(VkPipelineViewportStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 0, - .scissorCount = 0, + .viewportCount = 1, + .scissorCount = 1, }, .pRasterizationState = &(VkPipelineRasterizationStateCreateInfo) { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, @@ -236,7 +236,14 @@ create_pipeline(struct radv_device *device, } }, }, - .pDynamicState = NULL, + .pDynamicState = &(VkPipelineDynamicStateCreateInfo) { + .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, + .dynamicStateCount = 2, + .pDynamicStates = (VkDynamicState[]) { + VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, + }, + }, .renderPass = device->meta_state.resolve.pass, .subpass = 0, }, @@ -319,20 +326,20 @@ emit_resolve(struct radv_cmd_buffer *cmd_buffer, const struct vertex_attrs vertex_data[3] = { { .position = { - dest_offset->x, - dest_offset->y, + -1.0, + -1.0, }, }, { .position = { - dest_offset->x, - dest_offset->y + resolve_extent->height, + -1.0, + 1.0, }, }, { .position = { - dest_offset->x + resolve_extent->width, - dest_offset->y, + 1.0, + -1.0, }, }, }; @@ -362,6 +369,20 @@ emit_resolve(struct radv_cmd_buffer *cmd_buffer, pipeline_h); } + radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkViewport) { + .x = dest_offset->x, + .y = dest_offset->y, + .width = resolve_extent->width, + .height = resolve_extent->height, + .minDepth = 0.0f, + .maxDepth = 1.0f + }); + + radv_CmdSetScissor(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkRect2D) { + .offset = *dest_offset, + .extent = *resolve_extent, + }); + radv_CmdDraw(cmd_buffer_h, 3, 1, 0, 0); cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_CB; } |