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,
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,
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,
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));
},
.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,
},
.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,
},
},
.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,
},
.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,
},
.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,
.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,
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,
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,
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,
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));
},
.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,
},
.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,
},
.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,
},
.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,
},
.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,
},
.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,
},
.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,
* 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,
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,
},
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);
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,
},
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);
}
},
.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,
.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,
};
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,
},
},
};
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);
}
.pViewportState = &(VkPipelineViewportStateCreateInfo) {
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
- .viewportCount = 0,
- .scissorCount = 0,
+ .viewportCount = 1,
+ .scissorCount = 1,
},
.pRasterizationState = &rs_state,
.pMultisampleState = &(VkPipelineMultisampleStateCreateInfo) {
.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,
},
.pViewportState = &(VkPipelineViewportStateCreateInfo) {
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
- .viewportCount = 0,
- .scissorCount = 0,
+ .viewportCount = 1,
+ .scissorCount = 1,
},
.pRasterizationState = &rs_state,
.pMultisampleState = &(VkPipelineMultisampleStateCreateInfo) {
.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,
},
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,
},
},
};
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);
},
.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,
}
},
},
- .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,
},
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,
},
},
};
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;
}