radv: Handle VK_ATTACHMENT_UNUSED in color attachments.
This just sets them to INVALID COLOR, instead of shifting the
attachments together.
This also fixes a number of cases where we use it first and only
then check if it is VK_ATTACHMENT_UNUSED.
Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Fixes: f4e499ec79
"radv: add initial non-conformant radv vulkan driver"
Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -1208,7 +1208,13 @@ radv_emit_framebuffer_state(struct radv_cmd_buffer *cmd_buffer)
|
|||||||
struct radv_framebuffer *framebuffer = cmd_buffer->state.framebuffer;
|
struct radv_framebuffer *framebuffer = cmd_buffer->state.framebuffer;
|
||||||
const struct radv_subpass *subpass = cmd_buffer->state.subpass;
|
const struct radv_subpass *subpass = cmd_buffer->state.subpass;
|
||||||
|
|
||||||
for (i = 0; i < subpass->color_count; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
|
if (i >= subpass->color_count || subpass->color_attachments[i].attachment == VK_ATTACHMENT_UNUSED) {
|
||||||
|
radeon_set_context_reg(cmd_buffer->cs, R_028C70_CB_COLOR0_INFO + i * 0x3C,
|
||||||
|
S_028C70_FORMAT(V_028C70_COLOR_INVALID));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int idx = subpass->color_attachments[i].attachment;
|
int idx = subpass->color_attachments[i].attachment;
|
||||||
struct radv_attachment_info *att = &framebuffer->attachments[idx];
|
struct radv_attachment_info *att = &framebuffer->attachments[idx];
|
||||||
|
|
||||||
@@ -1220,10 +1226,6 @@ radv_emit_framebuffer_state(struct radv_cmd_buffer *cmd_buffer)
|
|||||||
radv_load_color_clear_regs(cmd_buffer, att->attachment->image, i);
|
radv_load_color_clear_regs(cmd_buffer, att->attachment->image, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = subpass->color_count; i < 8; i++)
|
|
||||||
radeon_set_context_reg(cmd_buffer->cs, R_028C70_CB_COLOR0_INFO + i * 0x3C,
|
|
||||||
S_028C70_FORMAT(V_028C70_COLOR_INVALID));
|
|
||||||
|
|
||||||
if(subpass->depth_stencil_attachment.attachment != VK_ATTACHMENT_UNUSED) {
|
if(subpass->depth_stencil_attachment.attachment != VK_ATTACHMENT_UNUSED) {
|
||||||
int idx = subpass->depth_stencil_attachment.attachment;
|
int idx = subpass->depth_stencil_attachment.attachment;
|
||||||
VkImageLayout layout = subpass->depth_stencil_attachment.layout;
|
VkImageLayout layout = subpass->depth_stencil_attachment.layout;
|
||||||
@@ -1797,8 +1799,9 @@ radv_cmd_buffer_set_subpass(struct radv_cmd_buffer *cmd_buffer,
|
|||||||
radv_subpass_barrier(cmd_buffer, &subpass->start_barrier);
|
radv_subpass_barrier(cmd_buffer, &subpass->start_barrier);
|
||||||
|
|
||||||
for (unsigned i = 0; i < subpass->color_count; ++i) {
|
for (unsigned i = 0; i < subpass->color_count; ++i) {
|
||||||
radv_handle_subpass_image_transition(cmd_buffer,
|
if (subpass->color_attachments[i].attachment != VK_ATTACHMENT_UNUSED)
|
||||||
subpass->color_attachments[i]);
|
radv_handle_subpass_image_transition(cmd_buffer,
|
||||||
|
subpass->color_attachments[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < subpass->input_count; ++i) {
|
for (unsigned i = 0; i < subpass->input_count; ++i) {
|
||||||
|
@@ -1080,7 +1080,8 @@ subpass_needs_clear(const struct radv_cmd_buffer *cmd_buffer)
|
|||||||
ds = cmd_state->subpass->depth_stencil_attachment.attachment;
|
ds = cmd_state->subpass->depth_stencil_attachment.attachment;
|
||||||
for (uint32_t i = 0; i < cmd_state->subpass->color_count; ++i) {
|
for (uint32_t i = 0; i < cmd_state->subpass->color_count; ++i) {
|
||||||
uint32_t a = cmd_state->subpass->color_attachments[i].attachment;
|
uint32_t a = cmd_state->subpass->color_attachments[i].attachment;
|
||||||
if (cmd_state->attachments[a].pending_clear_aspects) {
|
if (a != VK_ATTACHMENT_UNUSED &&
|
||||||
|
cmd_state->attachments[a].pending_clear_aspects) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1120,7 +1121,8 @@ radv_cmd_buffer_clear_subpass(struct radv_cmd_buffer *cmd_buffer)
|
|||||||
for (uint32_t i = 0; i < cmd_state->subpass->color_count; ++i) {
|
for (uint32_t i = 0; i < cmd_state->subpass->color_count; ++i) {
|
||||||
uint32_t a = cmd_state->subpass->color_attachments[i].attachment;
|
uint32_t a = cmd_state->subpass->color_attachments[i].attachment;
|
||||||
|
|
||||||
if (!cmd_state->attachments[a].pending_clear_aspects)
|
if (a == VK_ATTACHMENT_UNUSED ||
|
||||||
|
!cmd_state->attachments[a].pending_clear_aspects)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
assert(cmd_state->attachments[a].pending_clear_aspects ==
|
assert(cmd_state->attachments[a].pending_clear_aspects ==
|
||||||
|
@@ -560,6 +560,11 @@ radv_cmd_buffer_resolve_subpass(struct radv_cmd_buffer *cmd_buffer)
|
|||||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
||||||
VkAttachmentReference src_att = subpass->color_attachments[i];
|
VkAttachmentReference src_att = subpass->color_attachments[i];
|
||||||
VkAttachmentReference dest_att = subpass->resolve_attachments[i];
|
VkAttachmentReference dest_att = subpass->resolve_attachments[i];
|
||||||
|
|
||||||
|
if (src_att.attachment == VK_ATTACHMENT_UNUSED ||
|
||||||
|
dest_att.attachment == VK_ATTACHMENT_UNUSED)
|
||||||
|
continue;
|
||||||
|
|
||||||
struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment->image;
|
struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment->image;
|
||||||
struct radv_image *src_img = cmd_buffer->state.framebuffer->attachments[src_att.attachment].attachment->image;
|
struct radv_image *src_img = cmd_buffer->state.framebuffer->attachments[src_att.attachment].attachment->image;
|
||||||
|
|
||||||
@@ -582,10 +587,13 @@ radv_cmd_buffer_resolve_subpass(struct radv_cmd_buffer *cmd_buffer)
|
|||||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
||||||
VkAttachmentReference src_att = subpass->color_attachments[i];
|
VkAttachmentReference src_att = subpass->color_attachments[i];
|
||||||
VkAttachmentReference dest_att = subpass->resolve_attachments[i];
|
VkAttachmentReference dest_att = subpass->resolve_attachments[i];
|
||||||
struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment->image;
|
|
||||||
if (dest_att.attachment == VK_ATTACHMENT_UNUSED)
|
if (src_att.attachment == VK_ATTACHMENT_UNUSED ||
|
||||||
|
dest_att.attachment == VK_ATTACHMENT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment->image;
|
||||||
|
|
||||||
if (dst_img->surface.dcc_size) {
|
if (dst_img->surface.dcc_size) {
|
||||||
radv_initialize_dcc(cmd_buffer, dst_img, 0xffffffff);
|
radv_initialize_dcc(cmd_buffer, dst_img, 0xffffffff);
|
||||||
cmd_buffer->state.attachments[dest_att.attachment].current_layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
cmd_buffer->state.attachments[dest_att.attachment].current_layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
@@ -447,11 +447,14 @@ radv_cmd_buffer_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer)
|
|||||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
||||||
VkAttachmentReference src_att = subpass->color_attachments[i];
|
VkAttachmentReference src_att = subpass->color_attachments[i];
|
||||||
VkAttachmentReference dest_att = subpass->resolve_attachments[i];
|
VkAttachmentReference dest_att = subpass->resolve_attachments[i];
|
||||||
|
|
||||||
|
if (src_att.attachment == VK_ATTACHMENT_UNUSED ||
|
||||||
|
dest_att.attachment == VK_ATTACHMENT_UNUSED)
|
||||||
|
continue;
|
||||||
|
|
||||||
struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment->image;
|
struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment->image;
|
||||||
struct radv_image_view *src_iview = cmd_buffer->state.framebuffer->attachments[src_att.attachment].attachment;
|
struct radv_image_view *src_iview = cmd_buffer->state.framebuffer->attachments[src_att.attachment].attachment;
|
||||||
|
|
||||||
if (dest_att.attachment == VK_ATTACHMENT_UNUSED)
|
|
||||||
continue;
|
|
||||||
if (dst_img->surface.dcc_size) {
|
if (dst_img->surface.dcc_size) {
|
||||||
radv_initialize_dcc(cmd_buffer, dst_img, 0xffffffff);
|
radv_initialize_dcc(cmd_buffer, dst_img, 0xffffffff);
|
||||||
cmd_buffer->state.attachments[dest_att.attachment].current_layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
cmd_buffer->state.attachments[dest_att.attachment].current_layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
@@ -618,11 +618,14 @@ radv_cmd_buffer_resolve_subpass_fs(struct radv_cmd_buffer *cmd_buffer)
|
|||||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
||||||
VkAttachmentReference src_att = subpass->color_attachments[i];
|
VkAttachmentReference src_att = subpass->color_attachments[i];
|
||||||
VkAttachmentReference dest_att = subpass->resolve_attachments[i];
|
VkAttachmentReference dest_att = subpass->resolve_attachments[i];
|
||||||
|
|
||||||
|
if (src_att.attachment == VK_ATTACHMENT_UNUSED ||
|
||||||
|
dest_att.attachment == VK_ATTACHMENT_UNUSED)
|
||||||
|
continue;
|
||||||
|
|
||||||
struct radv_image_view *dest_iview = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment;
|
struct radv_image_view *dest_iview = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment;
|
||||||
struct radv_image *dst_img = dest_iview->image;
|
struct radv_image *dst_img = dest_iview->image;
|
||||||
struct radv_image_view *src_iview = cmd_buffer->state.framebuffer->attachments[src_att.attachment].attachment;
|
struct radv_image_view *src_iview = cmd_buffer->state.framebuffer->attachments[src_att.attachment].attachment;
|
||||||
if (dest_att.attachment == VK_ATTACHMENT_UNUSED)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (dst_img->surface.dcc_size) {
|
if (dst_img->surface.dcc_size) {
|
||||||
radv_initialize_dcc(cmd_buffer, dst_img, 0xffffffff);
|
radv_initialize_dcc(cmd_buffer, dst_img, 0xffffffff);
|
||||||
|
@@ -1035,14 +1035,17 @@ radv_pipeline_compute_spi_color_formats(struct radv_pipeline *pipeline,
|
|||||||
unsigned col_format = 0;
|
unsigned col_format = 0;
|
||||||
|
|
||||||
for (unsigned i = 0; i < (single_cb_enable ? 1 : subpass->color_count); ++i) {
|
for (unsigned i = 0; i < (single_cb_enable ? 1 : subpass->color_count); ++i) {
|
||||||
struct radv_render_pass_attachment *attachment;
|
|
||||||
unsigned cf;
|
unsigned cf;
|
||||||
|
|
||||||
attachment = pass->attachments + subpass->color_attachments[i].attachment;
|
if (subpass->color_attachments[i].attachment == VK_ATTACHMENT_UNUSED) {
|
||||||
|
cf = V_028714_SPI_SHADER_ZERO;
|
||||||
|
} else {
|
||||||
|
struct radv_render_pass_attachment *attachment = pass->attachments + subpass->color_attachments[i].attachment;
|
||||||
|
|
||||||
cf = si_choose_spi_color_format(attachment->format,
|
cf = si_choose_spi_color_format(attachment->format,
|
||||||
blend_enable & (1 << i),
|
blend_enable & (1 << i),
|
||||||
blend_need_alpha & (1 << i));
|
blend_need_alpha & (1 << i));
|
||||||
|
}
|
||||||
|
|
||||||
col_format |= cf << (4 * i);
|
col_format |= cf << (4 * i);
|
||||||
}
|
}
|
||||||
@@ -1082,6 +1085,9 @@ radv_pipeline_compute_is_int8(const VkGraphicsPipelineCreateInfo *pCreateInfo)
|
|||||||
for (unsigned i = 0; i < subpass->color_count; ++i) {
|
for (unsigned i = 0; i < subpass->color_count; ++i) {
|
||||||
struct radv_render_pass_attachment *attachment;
|
struct radv_render_pass_attachment *attachment;
|
||||||
|
|
||||||
|
if (subpass->color_attachments[i].attachment == VK_ATTACHMENT_UNUSED)
|
||||||
|
continue;
|
||||||
|
|
||||||
attachment = pass->attachments + subpass->color_attachments[i].attachment;
|
attachment = pass->attachments + subpass->color_attachments[i].attachment;
|
||||||
|
|
||||||
if (format_is_int8(attachment->format))
|
if (format_is_int8(attachment->format))
|
||||||
|
Reference in New Issue
Block a user