}
}
+VkImageAspectFlags
+aspectFlagsForFormat(VkFormat vkformat)
+{
+ const tcu::TextureFormat format(mapVkFormat(vkformat));
+ VkImageAspectFlags aspectFlags =
+ ((tcu::hasDepthComponent(format.order) ? static_cast<vk::VkImageAspectFlags>(vk::VK_IMAGE_ASPECT_DEPTH_BIT) : 0u) |
+ (tcu::hasStencilComponent(format.order) ? static_cast<vk::VkImageAspectFlags>(vk::VK_IMAGE_ASPECT_STENCIL_BIT) : 0u));
+ return aspectFlags;
+}
+
enum VerifyBuffer
{
VB_DEPTH = 0,
bool unusedResolve;
tcu::Maybe<VkFormat> compatibleFormat;
bool sampleMask;
+
+ VkFormat resolveFormat() const
+ {
+ return compatibleFormat ? compatibleFormat.get() : format;
+ }
+
+ VkImageAspectFlags resolveAspectFlags() const
+ {
+ return aspectFlagsForFormat(resolveFormat());
+ }
};
// Auxiliar class to group depth formats by compatibility in bit size and format. Note there is at most one alternative format for
bool isSupportedFormat (Context& context, VkFormat format) const;
VkSampleCountFlagBits sampleCountBitFromSampleCount (deUint32 count) const;
- VkImageSp createImage (deUint32 sampleCount, VkImageUsageFlags additionalUsage = 0u);
+ VkImageSp createImage (VkFormat vkformat, deUint32 sampleCount, VkImageUsageFlags additionalUsage = 0u);
AllocationSp createImageMemory (VkImageSp image);
- VkImageViewSp createImageView (VkImageSp image, deUint32 baseArrayLayer);
+ VkImageViewSp createImageView (VkImageSp image, VkFormat vkformat, deUint32 baseArrayLayer);
AllocationSp createBufferMemory (void);
VkBufferSp createBuffer (void);
, m_commandPool (createCommandPool(context.getDeviceInterface(), context.getDevice(), VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, context.getUniversalQueueFamilyIndex()))
- , m_multisampleImage (createImage(m_config.sampleCount, VK_IMAGE_USAGE_TRANSFER_SRC_BIT))
+ , m_multisampleImage (createImage(m_config.format, m_config.sampleCount, VK_IMAGE_USAGE_TRANSFER_SRC_BIT))
, m_multisampleImageMemory (createImageMemory(m_multisampleImage))
- , m_multisampleImageView (createImageView(m_multisampleImage, 0u))
+ , m_multisampleImageView (createImageView(m_multisampleImage, m_config.format, 0u))
- , m_singlesampleImage (createImage(1, (VK_IMAGE_USAGE_TRANSFER_SRC_BIT | (config.unusedResolve ? static_cast<vk::VkImageUsageFlags>(VK_IMAGE_USAGE_TRANSFER_DST_BIT) : 0u))))
+ , m_singlesampleImage (createImage(m_config.resolveFormat(), 1, (VK_IMAGE_USAGE_TRANSFER_SRC_BIT | (config.unusedResolve ? static_cast<vk::VkImageUsageFlags>(VK_IMAGE_USAGE_TRANSFER_DST_BIT) : 0u))))
, m_singlesampleImageMemory (createImageMemory(m_singlesampleImage))
- , m_singlesampleImageView (createImageView(m_singlesampleImage, m_config.resolveBaseLayer))
+ , m_singlesampleImageView (createImageView(m_singlesampleImage, m_config.resolveFormat(), m_config.resolveBaseLayer))
, m_buffer (createBuffer())
, m_bufferMemory (createBufferMemory())
m_renderPass.push_back(createRenderPass(m_config.format, i));
m_renderPipeline.push_back(createRenderPipeline(*m_renderPass[i], i, *m_renderPipelineLayout));
}
- m_framebuffer = createFramebuffer(*m_renderPass[0], m_multisampleImageView, m_singlesampleImageView);
+ m_framebuffer = createFramebuffer(m_config.compatibleFormat ? *m_renderPassCompatible : *m_renderPass[0],
+ m_multisampleImageView, m_singlesampleImageView);
}
DepthStencilResolveTest::~DepthStencilResolveTest (void)
}
}
-VkImageSp DepthStencilResolveTest::createImage (deUint32 sampleCount, VkImageUsageFlags additionalUsage)
+VkImageSp DepthStencilResolveTest::createImage (VkFormat vkformat, deUint32 sampleCount, VkImageUsageFlags additionalUsage)
{
const tcu::TextureFormat format(mapVkFormat(m_config.format));
const VkImageTiling imageTiling(VK_IMAGE_TILING_OPTIMAL);
DE_NULL,
0u,
VK_IMAGE_TYPE_2D,
- m_config.format,
+ vkformat,
imageExtent,
1u,
m_config.imageLayers,
return safeSharedPtr(allocation.release());
}
-VkImageViewSp DepthStencilResolveTest::createImageView (VkImageSp image, deUint32 baseArrayLayer)
+VkImageViewSp DepthStencilResolveTest::createImageView (VkImageSp image, VkFormat vkformat, deUint32 baseArrayLayer)
{
const VkImageSubresourceRange range =
{
- m_config.aspectFlag,
+ aspectFlagsForFormat(vkformat),
0u,
1u,
baseArrayLayer,
0u,
**image,
(m_config.viewLayers > 1) ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D,
- m_config.format,
+ vkformat,
makeComponentMappingRGBA(),
range,
};
const VkSampleCountFlagBits samples(sampleCountBitFromSampleCount(m_config.sampleCount));
VkImageLayout layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
- VkAttachmentReferenceStencilLayoutKHR stencilLayout =
- {
- VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR,
- DE_NULL,
- VK_IMAGE_LAYOUT_UNDEFINED,
- };
- void * attachmentRefStencil = DE_NULL;
+ VkImageLayout stencilLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
VkImageLayout finalLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
- VkAttachmentDescriptionStencilLayoutKHR multisampleStencilFinalLayout =
- {
- VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR,
- DE_NULL,
- VK_IMAGE_LAYOUT_UNDEFINED,
- VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
- };
- VkAttachmentDescriptionStencilLayoutKHR singlesampleStencilFinalLayout =
- {
- VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR,
- DE_NULL,
- VK_IMAGE_LAYOUT_UNDEFINED,
- VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
- };
- void * multisampleAttachmentDescriptionStencil = DE_NULL;
- void * singlesampleAttachmentDescriptionStencil = DE_NULL;
+ VkImageLayout stencilFinalLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
if (m_config.separateDepthStencilLayouts)
{
if (m_config.verifyBuffer == VB_DEPTH)
{
layout = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR;
- stencilLayout.stencilLayout = VK_IMAGE_LAYOUT_GENERAL;
- finalLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
- multisampleStencilFinalLayout.stencilFinalLayout = VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR; // This aspect should be unused.
- singlesampleStencilFinalLayout.stencilFinalLayout = VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR; // This aspect should be unused.
+ stencilLayout = VK_IMAGE_LAYOUT_GENERAL;
}
else
{
- layout = m_config.sampleMask ? VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR : VK_IMAGE_LAYOUT_GENERAL;
- stencilLayout.stencilLayout = VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR;
- finalLayout = VK_IMAGE_LAYOUT_GENERAL; // This aspect should be unused.
- multisampleStencilFinalLayout.stencilFinalLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
- singlesampleStencilFinalLayout.stencilFinalLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
+ layout = VK_IMAGE_LAYOUT_GENERAL;
+ stencilLayout = VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR;
}
- attachmentRefStencil = &stencilLayout;
- multisampleAttachmentDescriptionStencil = &multisampleStencilFinalLayout;
- singlesampleAttachmentDescriptionStencil = &singlesampleStencilFinalLayout;
- }
-
- if (renderPassNo != 0)
- {
- multisampleStencilFinalLayout.stencilInitialLayout = stencilLayout.stencilLayout;
- singlesampleStencilFinalLayout.stencilInitialLayout = stencilLayout.stencilLayout;
}
if (renderPassNo != m_numRenderPasses - 1)
{
finalLayout = layout;
- multisampleStencilFinalLayout.stencilFinalLayout = layout;
- singlesampleStencilFinalLayout.stencilFinalLayout = layout;
+ stencilFinalLayout = stencilLayout;
}
+ const VkAttachmentDescriptionStencilLayoutKHR multisampleAttachmentStencilLayout =
+ {
+ VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ (renderPassNo == 0) ? VK_IMAGE_LAYOUT_UNDEFINED : stencilLayout, // VkImageLayout initialLayout;
+ stencilFinalLayout,
+ };
const AttachmentDescription2 multisampleAttachment // VkAttachmentDescription2
(
// VkStructureType sType;
- multisampleAttachmentDescriptionStencil, // const void* pNext;
+ m_config.separateDepthStencilLayouts ? &multisampleAttachmentStencilLayout : DE_NULL, // const void* pNext;
0u, // VkAttachmentDescriptionFlags flags;
m_config.format, // VkFormat format;
samples, // VkSampleCountFlagBits samples;
(renderPassNo == 0) ? VK_IMAGE_LAYOUT_UNDEFINED : layout, // VkImageLayout initialLayout;
finalLayout // VkImageLayout finalLayout;
);
+ const VkAttachmentReferenceStencilLayoutKHR multisampleAttachmentRefStencilLayout =
+ {
+ VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ stencilLayout // VkImageLayout stencilLayout;
+ };
const AttachmentReference2 multisampleAttachmentRef // VkAttachmentReference2
(
// VkStructureType sType;
- attachmentRefStencil, // const void* pNext;
+ m_config.separateDepthStencilLayouts ? &multisampleAttachmentRefStencilLayout : DE_NULL, // const void* pNext;
0u, // deUint32 attachment;
layout, // VkImageLayout layout;
m_config.aspectFlag // VkImageAspectFlags aspectMask;
);
vk::VkImageLayout singleSampleInitialLayout = (m_config.unusedResolve ? VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL : VK_IMAGE_LAYOUT_UNDEFINED);
+ vk::VkImageLayout singleSampleStencilInitialLayout = (m_config.unusedResolve ? VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL : VK_IMAGE_LAYOUT_UNDEFINED);
if (renderPassNo != 0)
+ {
singleSampleInitialLayout = layout;
- if (m_config.separateDepthStencilLayouts && m_config.verifyBuffer == VB_STENCIL)
- singlesampleStencilFinalLayout.stencilInitialLayout = singleSampleInitialLayout;
-
- const tcu::TextureFormat format (mapVkFormat(vkformat));
- VkImageAspectFlags aspectFlags =
- ((tcu::hasDepthComponent(format.order) ? static_cast<vk::VkImageAspectFlags>(vk::VK_IMAGE_ASPECT_DEPTH_BIT) : 0u) |
- (tcu::hasStencilComponent(format.order) ? static_cast<vk::VkImageAspectFlags>(vk::VK_IMAGE_ASPECT_STENCIL_BIT) : 0u));
+ singleSampleStencilInitialLayout = stencilLayout;
+ }
+ const VkAttachmentDescriptionStencilLayoutKHR singlesampleAttachmentStencilLayout =
+ {
+ VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ singleSampleStencilInitialLayout, // VkImageLayout initialLayout;
+ stencilFinalLayout,
+ };
const AttachmentDescription2 singlesampleAttachment // VkAttachmentDescription2
(
// VkStructureType sType;
- singlesampleAttachmentDescriptionStencil, // const void* pNext;
+ m_config.separateDepthStencilLayouts ? &singlesampleAttachmentStencilLayout : DE_NULL, // const void* pNext;
0u, // VkAttachmentDescriptionFlags flags;
vkformat, // VkFormat format;
VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
singleSampleInitialLayout, // VkImageLayout initialLayout;
finalLayout // VkImageLayout finalLayout;
);
- AttachmentReference2 singlesampleAttachmentRef // VkAttachmentReference2
+
+ const VkAttachmentReferenceStencilLayoutKHR singlesampleAttachmentRefStencilLayout =
+ {
+ VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ stencilLayout // VkImageLayout stencilLayout;
+ };
+ const AttachmentReference2 singlesampleAttachmentRef // VkAttachmentReference2
(
// VkStructureType sType;
- attachmentRefStencil, // const void* pNext;
+ m_config.separateDepthStencilLayouts ? &singlesampleAttachmentRefStencilLayout : DE_NULL, // const void* pNext;
((m_config.unusedResolve || renderPassNo != m_numRenderPasses - 1) ? VK_ATTACHMENT_UNUSED : 1u), // deUint32 attachment;
layout, // VkImageLayout layout;
- aspectFlags // VkImageAspectFlags aspectMask;
+ aspectFlagsForFormat(vkformat) // VkImageAspectFlags aspectMask;
);
std::vector<AttachmentDescription2> attachments;
// the render pass so it has the expected values.
if (m_config.unusedResolve)
{
- const tcu::TextureFormat format (mapVkFormat(m_config.format));
const Unique<VkCommandBuffer> commandBuffer (allocateCommandBuffer(m_vkd, m_device, *m_commandPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
const vk::VkImageSubresourceRange imageRange =
{
- ((tcu::hasDepthComponent(format.order) ? static_cast<vk::VkImageAspectFlags>(vk::VK_IMAGE_ASPECT_DEPTH_BIT) : 0u) |
- (tcu::hasStencilComponent(format.order) ? static_cast<vk::VkImageAspectFlags>(vk::VK_IMAGE_ASPECT_STENCIL_BIT) : 0u)),
+ m_config.resolveAspectFlags(),
0u,
VK_REMAINING_MIP_LEVELS,
0u,
**m_singlesampleImage,
{
- (m_config.separateDepthStencilLayouts) ? VkImageAspectFlags(testingDepth ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_STENCIL_BIT) : m_config.aspectFlag,
+ (m_config.separateDepthStencilLayouts) ? VkImageAspectFlags(testingDepth ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_STENCIL_BIT) : m_config.resolveAspectFlags(),
0u,
1u,
0u,