summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_meta_blit.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_blit.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_blit.c')
-rw-r--r--src/amd/vulkan/radv_meta_blit.c53
1 files changed, 38 insertions, 15 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,