pass->attachments = anv_device_alloc(device, size, 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
- pass->attachments[i].format = pCreateInfo->pAttachments[i].format;
+ pass->attachments[i].format =
+ anv_format_for_vk_format(pCreateInfo->pAttachments[i].format);
pass->attachments[i].samples = pCreateInfo->pAttachments[i].samples;
pass->attachments[i].load_op = pCreateInfo->pAttachments[i].loadOp;
pass->attachments[i].stencil_load_op = pCreateInfo->pAttachments[i].stencilLoadOp;
return &anv_formats[format];
}
-bool
-anv_is_vk_format_depth_or_stencil(VkFormat format)
-{
- const struct anv_format *format_info =
- anv_format_for_vk_format(format);
-
- if (format_info->depth_format != UNSUPPORTED &&
- format_info->depth_format != 0)
- return true;
-
- return format_info->has_stencil;
-}
-
// Format capabilities
struct surface_format_info {
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO);
- if (anv_is_vk_format_depth_or_stencil(pCreateInfo->format)) {
+ const struct anv_format *format =
+ anv_format_for_vk_format(pCreateInfo->format);
+
+ if (anv_format_is_depth_or_stencil(format)) {
struct anv_depth_stencil_view *view =
anv_device_alloc(device, sizeof(*view), 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
int num_clear_layers = 0;
for (uint32_t i = 0; i < pass->attachment_count; i++) {
if (pass->attachments[i].load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
- if (anv_is_vk_format_depth_or_stencil(pass->attachments[i].format)) {
+ if (anv_format_is_depth_or_stencil(pass->attachments[i].format)) {
anv_finishme("Can't clear depth-stencil yet");
continue;
}
int layer = 0;
for (uint32_t i = 0; i < pass->attachment_count; i++) {
if (pass->attachments[i].load_op == VK_ATTACHMENT_LOAD_OP_CLEAR &&
- !anv_is_vk_format_depth_or_stencil(pass->attachments[i].format)) {
+ !anv_format_is_depth_or_stencil(pass->attachments[i].format)) {
instance_data[layer] = (struct clear_instance_data) {
.vue_header = {
.RTAIndex = i,
const struct anv_format *
anv_format_for_vk_format(VkFormat format);
-bool anv_is_vk_format_depth_or_stencil(VkFormat format);
+
+static inline bool
+anv_format_is_depth_or_stencil(const struct anv_format *format)
+{
+ return format->depth_format || format->has_stencil;
+}
/**
* A proxy for the color surfaces, depth surfaces, and stencil surfaces.
};
struct anv_render_pass_attachment {
- VkFormat format;
+ const struct anv_format *format;
uint32_t samples;
VkAttachmentLoadOp load_op;
VkAttachmentLoadOp stencil_load_op;