I’m trying to render to a cubemap face (actually six faces at once). I’m confused about how to do this, because if I change the baseArrayLayer value in the CreateImageView structure I get errors indicating that baseArrayLayer needs to be 0 and layerCount needs to be 6:
for (int l = 0; l < faces; ++l)
{
viewInfo.subresourceRange.baseArrayLayer = l;
viewInfo.subresourceRange.levelCount = 1;
viewInfo.subresourceRange.layerCount = faces;
mipimageview.resize(CountMipmaps());
for (int n = 0; n < mipimageview.size(); ++n)
{
viewInfo.subresourceRange.baseMipLevel = n;
VkAssert(vkCreateImageView(device->device, &viewInfo, NULL, &mipimageview[n]));
}
}
How do I set the pColorAttachments array to indicate six different cubemap faces to render to, if the imageview doesn’t have any way to specify a cubemap face without causing a validation error?
VkRenderingAttachmentInfo colorattachment = {};
colorattachment.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
colorattachment.imageLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
colorattachment.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
std::array<VkRenderingAttachmentInfo, 6> colorattachments;
for (int n = 0; n < 6; ++n)
{
colorattachment.imageView = tex->mipimageview[m];
colorattachments[n] = colorattachment;
}
renderinfo.pColorAttachments = colorattachments.data();