summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_meta_clear.c
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2017-03-01 00:39:58 +0100
committerBas Nieuwenhuizen <[email protected]>2017-03-30 22:21:14 +0200
commit4083a2ddcb02a6e79bcc21b3f5b20e10dcef73b1 (patch)
tree1dc608f5ed73ec0da75437c0531cb3f4d9c04592 /src/amd/vulkan/radv_meta_clear.c
parent42f2bccd119d12a53b61556767b77d59d5a9780f (diff)
radv: Set proper viewport & scissor for meta draws.
Signed-off-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_meta_clear.c')
-rw-r--r--src/amd/vulkan/radv_meta_clear.c54
1 files changed, 39 insertions, 15 deletions
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);
}