VK_AMD_device_coherent_memory on RADV.
VK_EXT_subgroup_size_control on RADV.
-VK_KHR_separate_depth_stencil_layouts on Intel.
+VK_KHR_separate_depth_stencil_layouts on Intel, RADV.
VK_KHR_shader_subgroup_extended_types on RADV.
EXT_direct_state_access for compatibility profile.
sample_locs = radv_get_attachment_sample_locations(cmd_buffer, idx,
begin_subpass);
- radv_handle_image_transition(cmd_buffer,
- view->image,
- cmd_buffer->state.attachments[idx].current_layout,
- cmd_buffer->state.attachments[idx].current_in_render_loop,
- att.layout, att.in_render_loop,
- 0, 0, &range, sample_locs);
+ /* Determine if the subpass uses separate depth/stencil layouts. */
+ bool uses_separate_depth_stencil_layouts = false;
+ if ((cmd_buffer->state.attachments[idx].current_layout !=
+ cmd_buffer->state.attachments[idx].current_stencil_layout) ||
+ (att.layout != att.stencil_layout)) {
+ uses_separate_depth_stencil_layouts = true;
+ }
+
+ /* For separate layouts, perform depth and stencil transitions
+ * separately.
+ */
+ if (uses_separate_depth_stencil_layouts &&
+ (range.aspectMask == (VK_IMAGE_ASPECT_DEPTH_BIT |
+ VK_IMAGE_ASPECT_STENCIL_BIT))) {
+ /* Depth-only transitions. */
+ range.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
+ radv_handle_image_transition(cmd_buffer,
+ view->image,
+ cmd_buffer->state.attachments[idx].current_layout,
+ cmd_buffer->state.attachments[idx].current_in_render_loop,
+ att.layout, att.in_render_loop,
+ 0, 0, &range, sample_locs);
+
+ /* Stencil-only transitions. */
+ range.aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT;
+ radv_handle_image_transition(cmd_buffer,
+ view->image,
+ cmd_buffer->state.attachments[idx].current_stencil_layout,
+ cmd_buffer->state.attachments[idx].current_in_render_loop,
+ att.stencil_layout, att.in_render_loop,
+ 0, 0, &range, sample_locs);
+ } else {
+ radv_handle_image_transition(cmd_buffer,
+ view->image,
+ cmd_buffer->state.attachments[idx].current_layout,
+ cmd_buffer->state.attachments[idx].current_in_render_loop,
+ att.layout, att.in_render_loop,
+ 0, 0, &range, sample_locs);
+ }
cmd_buffer->state.attachments[idx].current_layout = att.layout;
+ cmd_buffer->state.attachments[idx].current_stencil_layout = att.stencil_layout;
cmd_buffer->state.attachments[idx].current_in_render_loop = att.in_render_loop;
}
state->attachments[i].current_layout = att->initial_layout;
+ state->attachments[i].current_stencil_layout = att->stencil_initial_layout;
state->attachments[i].sample_location.count = 0;
struct radv_image_view *iview;
continue;
VkImageLayout layout = state->pass->attachments[a].final_layout;
- struct radv_subpass_attachment att = { a, layout };
+ VkImageLayout stencil_layout = state->pass->attachments[a].stencil_final_layout;
+ struct radv_subpass_attachment att = { a, layout, stencil_layout };
radv_handle_subpass_image_transition(cmd_buffer, att, false);
}
}
features->shaderSubgroupExtendedTypes = true;
break;
}
+ case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES_KHR: {
+ VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR *features =
+ (VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR *)ext;
+ features->separateDepthStencilLayouts = true;
+ break;
+ }
default:
break;
}
Extension('VK_KHR_relaxed_block_layout', 1, True),
Extension('VK_KHR_sampler_mirror_clamp_to_edge', 1, True),
Extension('VK_KHR_sampler_ycbcr_conversion', 1, True),
+ Extension('VK_KHR_separate_depth_stencil_layouts', 1, True),
Extension('VK_KHR_shader_atomic_int64', 1, 'LLVM_VERSION_MAJOR >= 9'),
Extension('VK_KHR_shader_clock', 1, True),
Extension('VK_KHR_shader_draw_parameters', 1, True),
return radv_image_has_htile(image) &&
(layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
+ layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
+ layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
(layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL &&
queue_mask == (1u << RADV_QUEUE_GENERAL)));
}
return radv_image_has_htile(image) &&
(layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
+ layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
+ layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
(layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL &&
queue_mask == (1u << RADV_QUEUE_GENERAL)));
}
att->stencil_load_op = pCreateInfo->pAttachments[i].stencilLoadOp;
att->initial_layout = pCreateInfo->pAttachments[i].initialLayout;
att->final_layout = pCreateInfo->pAttachments[i].finalLayout;
+ att->stencil_initial_layout = pCreateInfo->pAttachments[i].initialLayout;
+ att->stencil_final_layout = pCreateInfo->pAttachments[i].finalLayout;
// att->store_op = pCreateInfo->pAttachments[i].storeOp;
// att->stencil_store_op = pCreateInfo->pAttachments[i].stencilStoreOp;
}
subpass->input_attachments[j] = (struct radv_subpass_attachment) {
.attachment = desc->pInputAttachments[j].attachment,
.layout = desc->pInputAttachments[j].layout,
+ .stencil_layout = desc->pInputAttachments[j].layout,
};
}
}
subpass->resolve_attachments[j] = (struct radv_subpass_attachment) {
.attachment = desc->pResolveAttachments[j].attachment,
.layout = desc->pResolveAttachments[j].layout,
+ .stencil_layout = desc->pResolveAttachments[j].layout,
};
}
}
*subpass->depth_stencil_attachment = (struct radv_subpass_attachment) {
.attachment = desc->pDepthStencilAttachment->attachment,
.layout = desc->pDepthStencilAttachment->layout,
+ .stencil_layout = desc->pDepthStencilAttachment->layout,
};
}
}
for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
struct radv_render_pass_attachment *att = &pass->attachments[i];
+ const VkAttachmentDescriptionStencilLayoutKHR *stencil_layout =
+ vk_find_struct_const(pCreateInfo->pAttachments[i].pNext,
+ ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR);
att->format = pCreateInfo->pAttachments[i].format;
att->samples = pCreateInfo->pAttachments[i].samples;
att->stencil_load_op = pCreateInfo->pAttachments[i].stencilLoadOp;
att->initial_layout = pCreateInfo->pAttachments[i].initialLayout;
att->final_layout = pCreateInfo->pAttachments[i].finalLayout;
+ att->stencil_initial_layout = (stencil_layout ?
+ stencil_layout->stencilInitialLayout :
+ pCreateInfo->pAttachments[i].initialLayout);
+ att->stencil_final_layout = (stencil_layout ?
+ stencil_layout->stencilFinalLayout :
+ pCreateInfo->pAttachments[i].finalLayout);
// att->store_op = pCreateInfo->pAttachments[i].storeOp;
// att->stencil_store_op = pCreateInfo->pAttachments[i].stencilStoreOp;
}
p += desc->inputAttachmentCount;
for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) {
+ const VkAttachmentReferenceStencilLayoutKHR *stencil_attachment =
+ vk_find_struct_const(desc->pInputAttachments[j].pNext,
+ ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
+
subpass->input_attachments[j] = (struct radv_subpass_attachment) {
.attachment = desc->pInputAttachments[j].attachment,
.layout = desc->pInputAttachments[j].layout,
+ .stencil_layout = (stencil_attachment ?
+ stencil_attachment->stencilLayout :
+ desc->pInputAttachments[j].layout),
};
}
}
if (desc->pDepthStencilAttachment) {
subpass->depth_stencil_attachment = p++;
+ const VkAttachmentReferenceStencilLayoutKHR *stencil_attachment =
+ vk_find_struct_const(desc->pDepthStencilAttachment->pNext,
+ ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
+
*subpass->depth_stencil_attachment = (struct radv_subpass_attachment) {
.attachment = desc->pDepthStencilAttachment->attachment,
.layout = desc->pDepthStencilAttachment->layout,
+ .stencil_layout = (stencil_attachment ?
+ stencil_attachment->stencilLayout :
+ desc->pDepthStencilAttachment->layout),
};
}
if (ds_resolve && ds_resolve->pDepthStencilResolveAttachment) {
subpass->ds_resolve_attachment = p++;
+ const VkAttachmentReferenceStencilLayoutKHR *stencil_resolve_attachment =
+ vk_find_struct_const(ds_resolve->pDepthStencilResolveAttachment->pNext,
+ ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
+
*subpass->ds_resolve_attachment = (struct radv_subpass_attachment) {
.attachment = ds_resolve->pDepthStencilResolveAttachment->attachment,
.layout = ds_resolve->pDepthStencilResolveAttachment->layout,
+ .stencil_layout = (stencil_resolve_attachment ?
+ stencil_resolve_attachment->stencilLayout :
+ ds_resolve->pDepthStencilResolveAttachment->layout),
};
subpass->depth_resolve_mode = ds_resolve->depthResolveMode;
uint32_t cleared_views;
VkClearValue clear_value;
VkImageLayout current_layout;
+ VkImageLayout current_stencil_layout;
bool current_in_render_loop;
struct radv_sample_locations_state sample_location;
struct radv_subpass_attachment {
uint32_t attachment;
VkImageLayout layout;
+ VkImageLayout stencil_layout;
bool in_render_loop;
};
VkAttachmentLoadOp stencil_load_op;
VkImageLayout initial_layout;
VkImageLayout final_layout;
+ VkImageLayout stencil_initial_layout;
+ VkImageLayout stencil_final_layout;
/* The subpass id in which the attachment will be used first/last. */
uint32_t first_subpass_idx;