Skip to content

Commit 0f6964a

Browse files
ziga-lunargspencer-lunarg
authored andcommitted
tests: Fix maintenance 10 copy tests
1 parent 28c47dd commit 0f6964a

File tree

1 file changed

+79
-19
lines changed

1 file changed

+79
-19
lines changed

tests/unit/copy_buffer_image.cpp

Lines changed: 79 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* Copyright (c) 2015-2025 The Khronos Group Inc.
3-
* Copyright (c) 2015-2025 Valve Corporation
4-
* Copyright (c) 2015-2025 LunarG, Inc.
2+
* Copyright (c) 2015-2026 The Khronos Group Inc.
3+
* Copyright (c) 2015-2026 Valve Corporation
4+
* Copyright (c) 2015-2026 LunarG, Inc.
55
* Copyright (c) 2015-2025 Google, Inc.
66
* Modifications Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.
77
*
@@ -3461,9 +3461,7 @@ TEST_F(NegativeCopyBufferImage, MissingQueueGraphicsSupport) {
34613461
if (!ds_supports_copy_on_transfer_queue && !is_compute_queue) {
34623462
m_errorMonitor->SetDesiredError("VUID-vkCmdCopyBufferToImage-commandBuffer-11779");
34633463
}
3464-
if (!(depth_format_properties2.formatProperties.optimalTilingFeatures &
3465-
VK_FORMAT_FEATURE_2_DEPTH_COPY_ON_COMPUTE_QUEUE_BIT_KHR) &&
3466-
is_compute_queue) {
3464+
if (!ds_supports_copy_on_compute_queue && is_compute_queue) {
34673465
m_errorMonitor->SetDesiredError("VUID-vkCmdCopyBufferToImage-commandBuffer-11778");
34683466
}
34693467
vk::CmdCopyImageToBuffer(command_buffer, src_ds_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, buffer, 1u, &buffer_image_copy);
@@ -3477,10 +3475,10 @@ TEST_F(NegativeCopyBufferImage, MissingQueueGraphicsSupport) {
34773475
image_copy.extent = extent;
34783476

34793477
m_errorMonitor->SetDesiredError("VUID-vkCmdCopyImage-commandBuffer-10218");
3480-
if (!ds_supports_copy_on_compute_queue && !is_compute_queue) {
3478+
if (!ds_supports_copy_on_transfer_queue && !is_compute_queue) {
34813479
m_errorMonitor->SetDesiredError("VUID-vkCmdCopyImage-commandBuffer-11787");
34823480
}
3483-
if (is_compute_queue) {
3481+
if (!ds_supports_copy_on_compute_queue && is_compute_queue) {
34843482
m_errorMonitor->SetDesiredError("VUID-vkCmdCopyImage-commandBuffer-11786");
34853483
}
34863484
vk::CmdCopyImage(command_buffer, src_ds_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_color_image,
@@ -3494,7 +3492,7 @@ TEST_F(NegativeCopyBufferImage, MissingQueueGraphicsSupport) {
34943492
if (!ds_supports_copy_on_compute_queue && !is_compute_queue) {
34953493
m_errorMonitor->SetDesiredError("VUID-vkCmdCopyImage-commandBuffer-11783");
34963494
}
3497-
if (is_compute_queue) {
3495+
if (!ds_supports_copy_on_compute_queue && is_compute_queue) {
34983496
m_errorMonitor->SetDesiredError("VUID-vkCmdCopyImage-commandBuffer-11782");
34993497
}
35003498
vk::CmdCopyImage(command_buffer, src_color_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_ds_image,
@@ -4985,12 +4983,27 @@ TEST_F(NegativeCopyBufferImage, CopyDepthOnComputeQueue) {
49854983
if (!compute_without_graphics_queue_i.has_value()) {
49864984
GTEST_SKIP() << "Need a queue that supports compute but not graphics";
49874985
}
4986+
std::vector<VkFormat> depth_formats = {VK_FORMAT_D16_UNORM, VK_FORMAT_X8_D24_UNORM_PACK32,
4987+
VK_FORMAT_D32_SFLOAT, VK_FORMAT_D16_UNORM_S8_UINT,
4988+
VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT};
4989+
VkFormat depth_format = VK_FORMAT_UNDEFINED;
4990+
for (const auto& format : depth_formats) {
4991+
if (!FormatFeatures2AreSupported(Gpu(), format, VK_IMAGE_TILING_OPTIMAL,
4992+
VK_FORMAT_FEATURE_2_DEPTH_COPY_ON_COMPUTE_QUEUE_BIT_KHR) &&
4993+
FormatIsSupported(gpu_, format, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT)) {
4994+
depth_format = format;
4995+
break;
4996+
}
4997+
}
4998+
if (depth_format == VK_FORMAT_UNDEFINED) {
4999+
GTEST_SKIP() << "Suitable format not found";
5000+
}
49885001
vkt::CommandPool pool(*m_device, *compute_without_graphics_queue_i);
49895002
vkt::CommandBuffer cb(*m_device, pool);
49905003

49915004
VkImageCreateInfo image_create_info = vku::InitStructHelper();
49925005
image_create_info.imageType = VK_IMAGE_TYPE_2D;
4993-
image_create_info.format = VK_FORMAT_D16_UNORM;
5006+
image_create_info.format = depth_format;
49945007
image_create_info.extent = {32, 32, 1};
49955008
image_create_info.mipLevels = 1;
49965009
image_create_info.arrayLayers = 4;
@@ -5034,16 +5047,33 @@ TEST_F(NegativeCopyBufferImage, CopyDepthToBufferOnTransferQueue) {
50345047
AddRequiredFeature(vkt::Feature::maintenance10);
50355048
RETURN_IF_SKIP(Init());
50365049

5037-
auto compute_without_graphics_queue_i = m_device->QueueFamily(VK_QUEUE_TRANSFER_BIT, VK_QUEUE_GRAPHICS_BIT);
5050+
auto compute_without_graphics_queue_i =
5051+
m_device->QueueFamily(VK_QUEUE_TRANSFER_BIT, VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT);
50385052
if (!compute_without_graphics_queue_i.has_value()) {
50395053
GTEST_SKIP() << "Need a queue that supports compute but not graphics";
50405054
}
50415055
vkt::CommandPool pool(*m_device, *compute_without_graphics_queue_i);
50425056
vkt::CommandBuffer cb(*m_device, pool);
50435057

5058+
std::vector<VkFormat> depth_formats = {VK_FORMAT_D16_UNORM, VK_FORMAT_X8_D24_UNORM_PACK32,
5059+
VK_FORMAT_D32_SFLOAT, VK_FORMAT_D16_UNORM_S8_UINT,
5060+
VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT};
5061+
VkFormat depth_format = VK_FORMAT_UNDEFINED;
5062+
for (const auto& format : depth_formats) {
5063+
if (!FormatFeatures2AreSupported(Gpu(), format, VK_IMAGE_TILING_OPTIMAL,
5064+
VK_FORMAT_FEATURE_2_DEPTH_COPY_ON_TRANSFER_QUEUE_BIT_KHR) &&
5065+
FormatIsSupported(gpu_, format, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT)) {
5066+
depth_format = format;
5067+
break;
5068+
}
5069+
}
5070+
if (depth_format == VK_FORMAT_UNDEFINED) {
5071+
GTEST_SKIP() << "Suitable format not found";
5072+
}
5073+
50445074
VkImageCreateInfo image_create_info = vku::InitStructHelper();
50455075
image_create_info.imageType = VK_IMAGE_TYPE_2D;
5046-
image_create_info.format = VK_FORMAT_D16_UNORM;
5076+
image_create_info.format = depth_format;
50475077
image_create_info.extent = {32, 32, 1};
50485078
image_create_info.mipLevels = 1;
50495079
image_create_info.arrayLayers = 4;
@@ -5091,18 +5121,33 @@ TEST_F(NegativeCopyBufferImage, CopyBufferToDepthOnComputeQueue) {
50915121
if (!compute_without_graphics_queue_i.has_value()) {
50925122
GTEST_SKIP() << "Need a queue that supports compute but not graphics";
50935123
}
5124+
std::vector<VkFormat> depth_formats = {VK_FORMAT_D16_UNORM, VK_FORMAT_X8_D24_UNORM_PACK32,
5125+
VK_FORMAT_D32_SFLOAT, VK_FORMAT_D16_UNORM_S8_UINT,
5126+
VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT};
5127+
VkFormat depth_format = VK_FORMAT_UNDEFINED;
5128+
for (const auto& format : depth_formats) {
5129+
if (!FormatFeatures2AreSupported(Gpu(), format, VK_IMAGE_TILING_OPTIMAL,
5130+
VK_FORMAT_FEATURE_2_DEPTH_COPY_ON_COMPUTE_QUEUE_BIT_KHR) &&
5131+
FormatIsSupported(gpu_, format, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT)) {
5132+
depth_format = format;
5133+
break;
5134+
}
5135+
}
5136+
if (depth_format == VK_FORMAT_UNDEFINED) {
5137+
GTEST_SKIP() << "Suitable format not found";
5138+
}
50945139
vkt::CommandPool pool(*m_device, *compute_without_graphics_queue_i);
50955140
vkt::CommandBuffer cb(*m_device, pool);
50965141

50975142
VkImageCreateInfo image_create_info = vku::InitStructHelper();
50985143
image_create_info.imageType = VK_IMAGE_TYPE_2D;
5099-
image_create_info.format = VK_FORMAT_D16_UNORM;
5144+
image_create_info.format = depth_format;
51005145
image_create_info.extent = {32, 32, 1};
51015146
image_create_info.mipLevels = 1;
51025147
image_create_info.arrayLayers = 4;
51035148
image_create_info.samples = VK_SAMPLE_COUNT_1_BIT;
51045149
image_create_info.tiling = VK_IMAGE_TILING_OPTIMAL;
5105-
image_create_info.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
5150+
image_create_info.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT;
51065151
image_create_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
51075152
image_create_info.flags = 0;
51085153

@@ -5144,16 +5189,31 @@ TEST_F(NegativeCopyBufferImage, CopyBufferToDepthOnTransferQueue) {
51445189
AddRequiredFeature(vkt::Feature::maintenance10);
51455190
RETURN_IF_SKIP(Init());
51465191

5147-
auto compute_without_graphics_queue_i = m_device->QueueFamily(VK_QUEUE_TRANSFER_BIT, VK_QUEUE_GRAPHICS_BIT);
5148-
if (!compute_without_graphics_queue_i.has_value()) {
5149-
GTEST_SKIP() << "Need a queue that supports compute but not graphics";
5192+
auto transfer_queue = m_device->QueueFamily(VK_QUEUE_TRANSFER_BIT, VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT);
5193+
if (!transfer_queue.has_value()) {
5194+
GTEST_SKIP() << "Need a queue that supports transfer but not graphics or compute";
51505195
}
5151-
vkt::CommandPool pool(*m_device, *compute_without_graphics_queue_i);
5196+
std::vector<VkFormat> depth_formats = {VK_FORMAT_D16_UNORM, VK_FORMAT_X8_D24_UNORM_PACK32,
5197+
VK_FORMAT_D32_SFLOAT, VK_FORMAT_D16_UNORM_S8_UINT,
5198+
VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT};
5199+
VkFormat depth_format = VK_FORMAT_UNDEFINED;
5200+
for (const auto& format : depth_formats) {
5201+
if (!FormatFeatures2AreSupported(Gpu(), format, VK_IMAGE_TILING_OPTIMAL,
5202+
VK_FORMAT_FEATURE_2_DEPTH_COPY_ON_TRANSFER_QUEUE_BIT_KHR) &&
5203+
FormatIsSupported(gpu_, format, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT)) {
5204+
depth_format = format;
5205+
break;
5206+
}
5207+
}
5208+
if (depth_format == VK_FORMAT_UNDEFINED) {
5209+
GTEST_SKIP() << "Suitable format not found";
5210+
}
5211+
vkt::CommandPool pool(*m_device, *transfer_queue);
51525212
vkt::CommandBuffer cb(*m_device, pool);
51535213

51545214
VkImageCreateInfo image_create_info = vku::InitStructHelper();
51555215
image_create_info.imageType = VK_IMAGE_TYPE_2D;
5156-
image_create_info.format = VK_FORMAT_D16_UNORM;
5216+
image_create_info.format = depth_format;
51575217
image_create_info.extent = {32, 32, 1};
51585218
image_create_info.mipLevels = 1;
51595219
image_create_info.arrayLayers = 4;

0 commit comments

Comments
 (0)