layers: Rename format utils, strip Vk
Change-Id: I4d192db22c51d2e9224b74487bfd5d6a58405028
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index b4ea72e..99e184f 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -100,6 +100,21 @@
" uFragColor = vec4(0,1,0,1);\n"
"}\n";
+// Format search helper
+VkFormat FindSupportedDepthStencilFormat(VkPhysicalDevice phy) {
+ VkFormat ds_formats[] = { VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT };
+ for (uint32_t i = 0; i < sizeof(ds_formats); i++) {
+ VkFormatProperties format_props;
+ vkGetPhysicalDeviceFormatProperties(phy, ds_formats[i], &format_props);
+
+ if (format_props.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) {
+ return ds_formats[i];
+ }
+ }
+ return (VkFormat)0;
+}
+
+// Validation report callback prototype
static VKAPI_ATTR VkBool32 VKAPI_CALL myDbgFunc(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType, uint64_t srcObject,
size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg,
void *pUserData);
@@ -2169,7 +2184,7 @@
m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Invalid usage flag for image ");
ASSERT_NO_FATAL_FAILURE(Init());
- auto format = FindDepthStencilFormat(gpu());
+ auto format = FindSupportedDepthStencilFormat(gpu());
if (!format) {
printf(" No Depth + Stencil format found. Skipped.\n");
return;
@@ -8758,7 +8773,7 @@
ASSERT_NO_FATAL_FAILURE(Init());
ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
printf(" No Depth + Stencil format found. Skipped.\n");
return;
@@ -8909,7 +8924,7 @@
m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Barriers cannot be set during subpass");
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
printf(" No Depth + Stencil format found. Skipped.\n");
return;
@@ -9985,7 +10000,7 @@
VkResult err;
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
printf(" No Depth + Stencil format found. Skipped.\n");
return;
@@ -11721,7 +11736,7 @@
// * -3 Cmd buf submit of image w/ layout not matching first use w/o subresource
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
printf(" No Depth + Stencil format found. Skipped.\n");
return;
@@ -15954,7 +15969,7 @@
TEST_DESCRIPTION("Passing bad parameters to CreateImageView");
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
return;
}
@@ -17055,7 +17070,7 @@
"vkCmdCopyImage called with unmatched source and dest image depth");
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
return;
}
@@ -17241,7 +17256,7 @@
TEST_F(VkLayerTest, CopyImageAspectMismatch) {
TEST_DESCRIPTION("Image copies with aspect mask errors");
ASSERT_NO_FATAL_FAILURE(Init());
- auto ds_format = FindDepthStencilFormat(gpu());
+ auto ds_format = FindSupportedDepthStencilFormat(gpu());
if (!ds_format) {
return;
}
@@ -17749,7 +17764,7 @@
"Combination depth/stencil image formats can have only the ");
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
return;
}
@@ -17872,7 +17887,7 @@
"ClearDepthStencilImage with a color image.");
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
return;
}
@@ -18363,7 +18378,7 @@
VkResult err;
m_errorMonitor->ExpectSuccess();
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
return;
}
@@ -20310,7 +20325,7 @@
"CLEAR. stencil[Load|Store]Op used to be ignored.");
VkResult result = VK_SUCCESS;
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
printf(" No Depth + Stencil format found. Skipped.\n");
return;
@@ -20484,7 +20499,7 @@
m_errorMonitor->ExpectSuccess();
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
printf(" No Depth + Stencil format found. Skipped.\n");
return;
@@ -21891,7 +21906,7 @@
"valid *READ_ONLY* layout.");
m_errorMonitor->ExpectSuccess();
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
printf(" No Depth + Stencil format found. Skipped.\n");
return;
@@ -21939,7 +21954,7 @@
"transition has correctly occurred at queue submit time with no validation errors.");
ASSERT_NO_FATAL_FAILURE(Init());
- auto depth_format = FindDepthStencilFormat(gpu());
+ auto depth_format = FindSupportedDepthStencilFormat(gpu());
if (!depth_format) {
printf(" No Depth + Stencil format found. Skipped.\n");
return;
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index ff7b50c..548d935 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -30,20 +30,6 @@
assert(fp##entrypoint != NULL); \
}
-// Format search helpers
-VkFormat FindDepthStencilFormat(VkPhysicalDevice phy) {
- VkFormat ds_formats[] = {VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT};
- for (uint32_t i = 0; i < sizeof(ds_formats); i++) {
- VkFormatProperties format_props;
- vkGetPhysicalDeviceFormatProperties(phy, ds_formats[i], &format_props);
-
- if (format_props.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) {
- return ds_formats[i];
- }
- }
- return (VkFormat)0;
-}
-
VkRenderFramework::VkRenderFramework()
: inst(VK_NULL_HANDLE),
m_device(NULL),
@@ -724,11 +710,11 @@
newLayout = m_descriptorImageInfo.imageLayout;
VkImageAspectFlags image_aspect = 0;
- if (VkFormatIsDepthAndStencil(fmt)) {
+ if (FormatIsDepthAndStencil(fmt)) {
image_aspect = VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_DEPTH_BIT;
- } else if (VkFormatIsDepthOnly(fmt)) {
+ } else if (FormatIsDepthOnly(fmt)) {
image_aspect = VK_IMAGE_ASPECT_DEPTH_BIT;
- } else if (VkFormatIsStencilOnly(fmt)) {
+ } else if (FormatIsStencilOnly(fmt)) {
image_aspect = VK_IMAGE_ASPECT_STENCIL_BIT;
} else { // color
image_aspect = VK_IMAGE_ASPECT_COLOR_BIT;
@@ -759,11 +745,11 @@
vk_testing::Image::init(*m_device, *create_info, 0);
VkImageAspectFlags image_aspect = 0;
- if (VkFormatIsDepthAndStencil(create_info->format)) {
+ if (FormatIsDepthAndStencil(create_info->format)) {
image_aspect = VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_DEPTH_BIT;
- } else if (VkFormatIsDepthOnly(create_info->format)) {
+ } else if (FormatIsDepthOnly(create_info->format)) {
image_aspect = VK_IMAGE_ASPECT_DEPTH_BIT;
- } else if (VkFormatIsStencilOnly(create_info->format)) {
+ } else if (FormatIsStencilOnly(create_info->format)) {
image_aspect = VK_IMAGE_ASPECT_STENCIL_BIT;
} else { // color
image_aspect = VK_IMAGE_ASPECT_COLOR_BIT;
@@ -1596,9 +1582,9 @@
init(width, height, m_depth_stencil_fmt, usage, VK_IMAGE_TILING_OPTIMAL);
VkImageAspectFlags aspect = VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_DEPTH_BIT;
- if (VkFormatIsDepthOnly(format))
+ if (FormatIsDepthOnly(format))
aspect = VK_IMAGE_ASPECT_DEPTH_BIT;
- else if (VkFormatIsStencilOnly(format))
+ else if (FormatIsStencilOnly(format))
aspect = VK_IMAGE_ASPECT_STENCIL_BIT;
SetLayout(aspect, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
diff --git a/tests/vkrenderframework.h b/tests/vkrenderframework.h
index f15d19b..9d0b2e6 100644
--- a/tests/vkrenderframework.h
+++ b/tests/vkrenderframework.h
@@ -446,6 +446,4 @@
int m_vertexBufferCount;
};
-VkFormat FindDepthStencilFormat(VkPhysicalDevice);
-
#endif // VKRENDERFRAMEWORK_H