So we can use it with imageless framebuffers.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
VkClearDepthStencilValue ds_clear_value,
VkImageAspectFlags aspects)
{
- struct radv_framebuffer *framebuffer = cmd_buffer->state.framebuffer;
const struct radv_subpass *subpass = cmd_buffer->state.subpass;
struct radeon_cmdbuf *cs = cmd_buffer->cs;
uint32_t att_idx;
- if (!framebuffer || !subpass)
+ if (!cmd_buffer->state.attachments || !subpass)
return;
if (!subpass->depth_stencil_attachment)
return;
att_idx = subpass->depth_stencil_attachment->attachment;
- if (framebuffer->attachments[att_idx]->image != image)
+ if (cmd_buffer->state.attachments[att_idx].iview->image != image)
return;
radeon_set_context_reg_seq(cs, R_028028_DB_STENCIL_CLEAR, 2);
int cb_idx,
uint32_t color_values[2])
{
- struct radv_framebuffer *framebuffer = cmd_buffer->state.framebuffer;
const struct radv_subpass *subpass = cmd_buffer->state.subpass;
struct radeon_cmdbuf *cs = cmd_buffer->cs;
uint32_t att_idx;
- if (!framebuffer || !subpass)
+ if (!cmd_buffer->state.attachments || !subpass)
return;
att_idx = subpass->color_attachments[cb_idx].attachment;
if (att_idx == VK_ATTACHMENT_UNUSED)
return;
- if (framebuffer->attachments[att_idx]->image != image)
+ if (cmd_buffer->state.attachments[att_idx].iview->image != image)
return;
radeon_set_context_reg_seq(cs, R_028C8C_CB_COLOR0_CLEAR_WORD0 + cb_idx * 0x3c, 2);
}
int idx = subpass->color_attachments[i].attachment;
- struct radv_image_view *iview = framebuffer->attachments[idx];
+ struct radv_image_view *iview = cmd_buffer->state.attachments[idx].iview;
VkImageLayout layout = subpass->color_attachments[i].layout;
radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, iview->bo);
if (subpass->depth_stencil_attachment) {
int idx = subpass->depth_stencil_attachment->attachment;
VkImageLayout layout = subpass->depth_stencil_attachment->layout;
- struct radv_image *image = framebuffer->attachments[idx]->image;
- radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, framebuffer->attachments[idx]->bo);
+ struct radv_image *image = cmd_buffer->state.attachments[idx].iview->image;
+ radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, cmd_buffer->state.attachments[idx].iview->bo);
ASSERTED uint32_t queue_mask = radv_image_queue_family_mask(image,
cmd_buffer->queue_family_index,
cmd_buffer->queue_family_index);
{
struct radv_cmd_state *state = &cmd_buffer->state;
uint32_t subpass_id = radv_get_subpass_id(cmd_buffer);
- struct radv_image_view *view = state->framebuffer->attachments[att_idx];
+ struct radv_image_view *view = state->attachments[att_idx].iview;
if (view->image->info.samples == 1)
return NULL;
bool begin_subpass)
{
unsigned idx = att.attachment;
- struct radv_image_view *view = cmd_buffer->state.framebuffer->attachments[idx];
+ struct radv_image_view *view = cmd_buffer->state.attachments[idx].iview;
struct radv_sample_locations_state *sample_locs;
VkImageSubresourceRange range;
range.aspectMask = 0;
vk_find_struct_const(info->pNext,
RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT);
struct radv_cmd_state *state = &cmd_buffer->state;
- struct radv_framebuffer *framebuffer = state->framebuffer;
if (!sample_locs) {
state->subpass_sample_locs = NULL;
const VkAttachmentSampleLocationsEXT *att_sample_locs =
&sample_locs->pAttachmentInitialSampleLocations[i];
uint32_t att_idx = att_sample_locs->attachmentIndex;
- struct radv_image *image = framebuffer->attachments[att_idx]->image;
+ struct radv_image *image = cmd_buffer->state.attachments[att_idx].iview->image;
assert(vk_format_is_depth_or_stencil(image->vk_format));
{
struct radv_device *device = cmd_buffer->device;
const struct radv_subpass *subpass = cmd_buffer->state.subpass;
- const struct radv_framebuffer *fb = cmd_buffer->state.framebuffer;
const uint32_t subpass_att = clear_att->colorAttachment;
const uint32_t pass_att = subpass->color_attachments[subpass_att].attachment;
- const struct radv_image_view *iview = fb ? fb->attachments[pass_att] : NULL;
+ const struct radv_image_view *iview = cmd_buffer->state.attachments ?
+ cmd_buffer->state.attachments[pass_att].iview : NULL;
uint32_t samples, samples_log2;
VkFormat format;
unsigned fs_key;
struct radv_device *device = cmd_buffer->device;
struct radv_meta_state *meta_state = &device->meta_state;
const struct radv_subpass *subpass = cmd_buffer->state.subpass;
- const struct radv_framebuffer *fb = cmd_buffer->state.framebuffer;
const uint32_t pass_att = ds_att->attachment;
VkClearDepthStencilValue clear_value = clear_att->clearValue.depthStencil;
VkImageAspectFlags aspects = clear_att->aspectMask;
- const struct radv_image_view *iview = fb ? fb->attachments[pass_att] : NULL;
+ const struct radv_image_view *iview = cmd_buffer->state.attachments ?
+ cmd_buffer->state.attachments[pass_att].iview : NULL;
uint32_t samples, samples_log2;
VkCommandBuffer cmd_buffer_h = radv_cmd_buffer_to_handle(cmd_buffer);
return;
VkImageLayout image_layout = subpass->color_attachments[subpass_att].layout;
- const struct radv_image_view *iview = fb ? fb->attachments[pass_att] : NULL;
+ const struct radv_image_view *iview = fb ? cmd_buffer->state.attachments[pass_att].iview : NULL;
VkClearColorValue clear_value = clear_att->clearValue.color;
if (radv_can_fast_clear_color(cmd_buffer, iview, image_layout,
return;
VkImageLayout image_layout = ds_att->layout;
- const struct radv_image_view *iview = fb ? fb->attachments[ds_att->attachment] : NULL;
+ const struct radv_image_view *iview = fb ? cmd_buffer->state.attachments[ds_att->attachment].iview : NULL;
VkClearDepthStencilValue clear_value = clear_att->clearValue.depthStencil;
assert(aspects & (VK_IMAGE_ASPECT_DEPTH_BIT |
struct radv_subpass_attachment src_att = *subpass->depth_stencil_attachment;
struct radv_subpass_attachment dst_att = *subpass->ds_resolve_attachment;
struct radv_image_view *src_iview =
- cmd_buffer->state.framebuffer->attachments[src_att.attachment];
+ cmd_buffer->state.attachments[src_att.attachment].iview;
struct radv_image_view *dst_iview =
- cmd_buffer->state.framebuffer->attachments[dst_att.attachment];
+ cmd_buffer->state.attachments[dst_att.attachment].iview;
radv_pick_resolve_method_images(src_iview->image,
src_iview->vk_format,
/* Make sure to not clear color attachments after resolves. */
cmd_buffer->state.attachments[dest_att.attachment].pending_clear_aspects = 0;
- struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment]->image;
- struct radv_image_view *src_iview= cmd_buffer->state.framebuffer->attachments[src_att.attachment];
+ struct radv_image *dst_img = cmd_buffer->state.attachments[dest_att.attachment].iview->image;
+ struct radv_image_view *src_iview= cmd_buffer->state.attachments[src_att.attachment].iview;
struct radv_image *src_img = src_iview->image;
radv_pick_resolve_method_images(src_img, src_iview->vk_format,
if (dest_att.attachment == VK_ATTACHMENT_UNUSED)
continue;
- struct radv_image_view *dest_iview = cmd_buffer->state.framebuffer->attachments[dest_att.attachment];
+ struct radv_image_view *dest_iview = cmd_buffer->state.attachments[dest_att.attachment].iview;
struct radv_image *dst_img = dest_iview->image;
if (radv_dcc_enabled(dst_img, dest_iview->base_mip)) {
if (dest_att.attachment == VK_ATTACHMENT_UNUSED)
continue;
- struct radv_image_view *src_iview = fb->attachments[src_att.attachment];
+ struct radv_image_view *src_iview = cmd_buffer->state.attachments[src_att.attachment].iview;
struct radv_image *src_image = src_iview->image;
VkImageResolve region = {};
if (dst_att.attachment == VK_ATTACHMENT_UNUSED)
continue;
- struct radv_image_view *src_iview = fb->attachments[src_att.attachment];
- struct radv_image_view *dst_iview = fb->attachments[dst_att.attachment];
+ struct radv_image_view *src_iview = cmd_buffer->state.attachments[src_att.attachment].iview;
+ struct radv_image_view *dst_iview = cmd_buffer->state.attachments[dst_att.attachment].iview;
VkImageResolve region = {
.extent = (VkExtent3D){ fb->width, fb->height, 0 },
struct radv_subpass_attachment dest_att = *subpass->ds_resolve_attachment;
struct radv_image_view *src_iview =
- cmd_buffer->state.framebuffer->attachments[src_att.attachment];
+ cmd_buffer->state.attachments[src_att.attachment].iview;
struct radv_image_view *dst_iview =
- cmd_buffer->state.framebuffer->attachments[dest_att.attachment];
+ cmd_buffer->state.attachments[dest_att.attachment].iview;
struct radv_image *src_image = src_iview->image;
struct radv_image *dst_image = dst_iview->image;
if (dest_att.attachment == VK_ATTACHMENT_UNUSED)
continue;
- struct radv_image_view *dest_iview = cmd_buffer->state.framebuffer->attachments[dest_att.attachment];
- struct radv_image_view *src_iview = cmd_buffer->state.framebuffer->attachments[src_att.attachment];
+ struct radv_image_view *dest_iview = cmd_buffer->state.attachments[dest_att.attachment].iview;
+ struct radv_image_view *src_iview = cmd_buffer->state.attachments[src_att.attachment].iview;
struct radv_subpass resolve_subpass = {
.color_count = 1,
struct radv_subpass_attachment dst_att = *subpass->ds_resolve_attachment;
struct radv_image_view *src_iview =
- cmd_buffer->state.framebuffer->attachments[src_att.attachment];
+ cmd_buffer->state.attachments[src_att.attachment].iview;
struct radv_image *src_image = src_iview->image;
struct radv_image_view *dst_iview =
- cmd_buffer->state.framebuffer->attachments[dst_att.attachment];
+ cmd_buffer->state.attachments[dst_att.attachment].iview;
struct radv_subpass resolve_subpass = {
.color_count = 0,
struct radv_color_buffer_info cb;
struct radv_ds_buffer_info ds;
};
+ struct radv_image_view *iview;
};
struct radv_descriptor_state {