aboutsummaryrefslogtreecommitdiff
path: root/layers/image.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-05-19 10:10:09 -0600
committerTobin Ehlis <tobine@google.com>2016-05-19 13:09:50 -0600
commit3abddc22e46db5f09e6f4f90e1addb8e9d651765 (patch)
treec5e7bc61b2d64b2a124c9d69bb26d1761794679f /layers/image.cpp
parentf67c311f6232b1904f7ac9b6d289ab7563e902a7 (diff)
downloadusermoji-3abddc22e46db5f09e6f4f90e1addb8e9d651765.tar.xz
layers: Replace is_depth() in image layer with util function
vk_layer_utils has function vk_format_is_depth_or_stencil() that is exactly the same as local is_depth() function so kill local function and use utility function.
Diffstat (limited to 'layers/image.cpp')
-rw-r--r--layers/image.cpp23
1 files changed, 2 insertions, 21 deletions
diff --git a/layers/image.cpp b/layers/image.cpp
index 43b6452a..88ae5ba1 100644
--- a/layers/image.cpp
+++ b/layers/image.cpp
@@ -214,25 +214,6 @@ static const VkLayerProperties global_layer = {
// Start of the Image layer proper
-// Returns TRUE if a format is a depth-compatible format
-bool is_depth_format(VkFormat format) {
- bool result = false;
- switch (format) {
- case VK_FORMAT_D16_UNORM:
- case VK_FORMAT_X8_D24_UNORM_PACK32:
- case VK_FORMAT_D32_SFLOAT:
- case VK_FORMAT_S8_UINT:
- case VK_FORMAT_D16_UNORM_S8_UINT:
- case VK_FORMAT_D24_UNORM_S8_UINT:
- case VK_FORMAT_D32_SFLOAT_S8_UINT:
- result = true;
- break;
- default:
- break;
- }
- return result;
-}
-
static inline uint32_t validate_VkImageLayoutKHR(VkImageLayout input_value) {
return ((validate_VkImageLayout(input_value) == 1) || (input_value == VK_IMAGE_LAYOUT_PRESENT_SRC_KHR));
}
@@ -457,7 +438,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderP
// Any depth buffers specified as attachments?
bool depthFormatPresent = false;
for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
- depthFormatPresent |= is_depth_format(pCreateInfo->pAttachments[i].format);
+ depthFormatPresent |= vk_format_is_depth_or_stencil(pCreateInfo->pAttachments[i].format);
}
if (!depthFormatPresent) {
@@ -903,7 +884,7 @@ bool cmd_copy_image_valid_usage(VkCommandBuffer commandBuffer, VkImage srcImage,
// The formats of srcImage and dstImage must be compatible. Formats are considered compatible if their texel size in bytes
// is the same between both formats. For example, VK_FORMAT_R8G8B8A8_UNORM is compatible with VK_FORMAT_R32_UINT because
// because both texels are 4 bytes in size. Depth/stencil formats must match exactly.
- if (is_depth_format(srcImageEntry->format) || is_depth_format(dstImageEntry->format)) {
+ if (vk_format_is_depth_or_stencil(srcImageEntry->format) || vk_format_is_depth_or_stencil(dstImageEntry->format)) {
if (srcImageEntry->format != dstImageEntry->format) {
char const str[] = "vkCmdCopyImage called with unmatched source and dest image depth/stencil formats.";
skipCall |=