diff --git a/include/vkcv/Image.hpp b/include/vkcv/Image.hpp index dc74a011bdb56f0ceaeffd985a2442c7d8cd7a61..5e5e76454556a6c020d38d72894705ee1d4a3317 100644 --- a/include/vkcv/Image.hpp +++ b/include/vkcv/Image.hpp @@ -23,6 +23,15 @@ namespace vkcv { * otherwise false. */ bool isDepthFormat(const vk::Format format); + + /** + * @brief Returns whether an image format is usable as stencil buffer. + * + * @param format Vulkan image format + * @return True, if the format is valid to use as stencil buffer, + * otherwise false. + */ + bool isStencilFormat(const vk::Format format); /** * @brief Class for image handling and filling data. diff --git a/src/vkcv/Image.cpp b/src/vkcv/Image.cpp index 84a706f83a8f256b976f7b58546fbd7f2580f9f5..8b40604551ab9bedc42dae9f96eb4e9bd5c44867 100644 --- a/src/vkcv/Image.cpp +++ b/src/vkcv/Image.cpp @@ -12,12 +12,26 @@ namespace vkcv{ bool isDepthFormat(const vk::Format format) { switch (format) { - case(vk::Format::eD16Unorm): return true; - case(vk::Format::eD16UnormS8Uint): return true; - case(vk::Format::eD24UnormS8Uint): return true; - case(vk::Format::eD32Sfloat): return true; - case(vk::Format::eD32SfloatS8Uint): return true; - default: return false; + case(vk::Format::eD16Unorm): + case(vk::Format::eD16UnormS8Uint): + case(vk::Format::eD24UnormS8Uint): + case(vk::Format::eD32Sfloat): + case(vk::Format::eD32SfloatS8Uint): + return true; + default: + return false; + } + } + + bool isStencilFormat(const vk::Format format) { + switch (format) { + case(vk::Format::eS8Uint): + case(vk::Format::eD16UnormS8Uint): + case(vk::Format::eD24UnormS8Uint): + case(vk::Format::eD32SfloatS8Uint): + return true; + default: + return false; } }