Skip to content

Commit

Permalink
layers: Add misc host-image-copy VUIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyBarbour committed Jul 31, 2023
1 parent 977e7c2 commit 6f0baae
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
21 changes: 21 additions & 0 deletions layers/core_checks/cc_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,32 @@ bool CoreChecks::PreCallValidateGetDeviceQueue2(VkDevice device, const VkDeviceQ
}
return skip;
}
bool CoreChecks::ValidateGetPhysicalDeviceImageFormatProperties2(const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
VkImageFormatProperties2 *pImageFormatProperties) const {
bool skip = false;
const auto *copy_perf_query = LvlFindInChain<VkHostImageCopyDevicePerformanceQueryEXT>(pImageFormatProperties->pNext);
if (nullptr != copy_perf_query) {
if (!(enabled_features.host_image_copy_features.hostImageCopy)) {
skip |= LogError(device, "VUID-VkImageFormatProperties2-pNext-09005",
"vkGetPhysicalDeviceImageFormatProperties2(): pImageFormatProperties includes a chained "
"VkHostImageCopyDevicePerformanceQueryEXT struct when the hostImageCopy feature was not enabled");
}
if ((pImageFormatInfo->usage & VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT) == 0) {
skip |= LogError(physical_device, "VUID-vkGetPhysicalDeviceImageFormatProperties2-pNext-09004",
"vkGetPhysicalDeviceImageFormatProperties2: pImageFormatProperties includes a chained "
"VkHostImageCopyDevicePerformanceQueryEXT struct, but pImageFormatInfo->usage does not contain "
"VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT");
}
}
return skip;
}

bool CoreChecks::PreCallValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
VkImageFormatProperties2 *pImageFormatProperties) const {
// Can't wrap AHB-specific validation in a device extension check here, but no harm
bool skip = ValidateGetPhysicalDeviceImageFormatProperties2ANDROID(pImageFormatInfo, pImageFormatProperties);
skip |= ValidateGetPhysicalDeviceImageFormatProperties2(pImageFormatInfo, pImageFormatProperties);
return skip;
}

Expand All @@ -615,6 +635,7 @@ bool CoreChecks::PreCallValidateGetPhysicalDeviceImageFormatProperties2KHR(VkPhy
VkImageFormatProperties2 *pImageFormatProperties) const {
// Can't wrap AHB-specific validation in a device extension check here, but no harm
bool skip = ValidateGetPhysicalDeviceImageFormatProperties2ANDROID(pImageFormatInfo, pImageFormatProperties);
skip |= ValidateGetPhysicalDeviceImageFormatProperties2(pImageFormatInfo, pImageFormatProperties);
return skip;
}

Expand Down
9 changes: 9 additions & 0 deletions layers/core_checks/cc_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ bool CoreChecks::ValidateImageFormatFeatures(const VkImageCreateInfo *pCreateInf
string_VkFormat(pCreateInfo->format), string_VkFormatFeatureFlags2(tiling_features).c_str());
}

if (((tiling_features & VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT) == 0) &&
(pCreateInfo->usage & VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT)) {
skip |=
LogError(device, "VUID-VkImageCreateInfo-imageCreateFormatFeatures-09048",
"vkCreateImage(): usage cannot contain VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT because %s doesn't support "
"VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT based on imageCreateFormatFeatures (supported features: %s).",
string_VkFormat(pCreateInfo->format), string_VkFormatFeatureFlags2(tiling_features).c_str());
}

return skip;
}

Expand Down
2 changes: 2 additions & 0 deletions layers/core_checks/core_validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,8 @@ class CoreChecks : public ValidationStateTracker {
VkMemoryRequirements2* pMemoryRequirements) const override;
bool PreCallValidateGetImageMemoryRequirements2KHR(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo,
VkMemoryRequirements2* pMemoryRequirements) const override;
bool ValidateGetPhysicalDeviceImageFormatProperties2(const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo,
VkImageFormatProperties2* pImageFormatProperties) const;
bool PreCallValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo,
VkImageFormatProperties2* pImageFormatProperties) const override;
Expand Down

0 comments on commit 6f0baae

Please sign in to comment.