renderer_vulkan: Implement S8_UINT stencil format
It should be noted that on Windows, only nvidia gpus support this format natively as of this commit.
This commit is contained in:
parent
6dd6dc046c
commit
dc61b7045b
|
@ -208,6 +208,9 @@ struct FormatTuple {
|
||||||
{VK_FORMAT_D32_SFLOAT, Attachable}, // D32_FLOAT
|
{VK_FORMAT_D32_SFLOAT, Attachable}, // D32_FLOAT
|
||||||
{VK_FORMAT_D16_UNORM, Attachable}, // D16_UNORM
|
{VK_FORMAT_D16_UNORM, Attachable}, // D16_UNORM
|
||||||
|
|
||||||
|
// Stencil formats
|
||||||
|
{VK_FORMAT_S8_UINT, Attachable}, // S8_UINT
|
||||||
|
|
||||||
// DepthStencil formats
|
// DepthStencil formats
|
||||||
{VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // D24_UNORM_S8_UINT
|
{VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // D24_UNORM_S8_UINT
|
||||||
{VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // S8_UINT_D24_UNORM (emulated)
|
{VK_FORMAT_D24_UNORM_S8_UINT, Attachable}, // S8_UINT_D24_UNORM (emulated)
|
||||||
|
|
|
@ -102,6 +102,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
|
||||||
usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||||
break;
|
break;
|
||||||
case VideoCore::Surface::SurfaceType::Depth:
|
case VideoCore::Surface::SurfaceType::Depth:
|
||||||
|
case VideoCore::Surface::SurfaceType::Stencil:
|
||||||
case VideoCore::Surface::SurfaceType::DepthStencil:
|
case VideoCore::Surface::SurfaceType::DepthStencil:
|
||||||
usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||||
break;
|
break;
|
||||||
|
@ -173,6 +174,8 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
|
||||||
return VK_IMAGE_ASPECT_COLOR_BIT;
|
return VK_IMAGE_ASPECT_COLOR_BIT;
|
||||||
case VideoCore::Surface::SurfaceType::Depth:
|
case VideoCore::Surface::SurfaceType::Depth:
|
||||||
return VK_IMAGE_ASPECT_DEPTH_BIT;
|
return VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||||
|
case VideoCore::Surface::SurfaceType::Stencil:
|
||||||
|
return VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||||
case VideoCore::Surface::SurfaceType::DepthStencil:
|
case VideoCore::Surface::SurfaceType::DepthStencil:
|
||||||
return VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
|
return VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||||
default:
|
default:
|
||||||
|
@ -195,6 +198,8 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
|
||||||
case PixelFormat::D16_UNORM:
|
case PixelFormat::D16_UNORM:
|
||||||
case PixelFormat::D32_FLOAT:
|
case PixelFormat::D32_FLOAT:
|
||||||
return VK_IMAGE_ASPECT_DEPTH_BIT;
|
return VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||||
|
case PixelFormat::S8_UINT:
|
||||||
|
return VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||||
default:
|
default:
|
||||||
return VK_IMAGE_ASPECT_COLOR_BIT;
|
return VK_IMAGE_ASPECT_COLOR_BIT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,13 @@
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
namespace {
|
namespace {
|
||||||
namespace Alternatives {
|
namespace Alternatives {
|
||||||
|
constexpr std::array STENCIL8_UINT{
|
||||||
|
VK_FORMAT_D16_UNORM_S8_UINT,
|
||||||
|
VK_FORMAT_D24_UNORM_S8_UINT,
|
||||||
|
VK_FORMAT_D32_SFLOAT_S8_UINT,
|
||||||
|
VK_FORMAT_UNDEFINED,
|
||||||
|
};
|
||||||
|
|
||||||
constexpr std::array DEPTH24_UNORM_STENCIL8_UINT{
|
constexpr std::array DEPTH24_UNORM_STENCIL8_UINT{
|
||||||
VK_FORMAT_D32_SFLOAT_S8_UINT,
|
VK_FORMAT_D32_SFLOAT_S8_UINT,
|
||||||
VK_FORMAT_D16_UNORM_S8_UINT,
|
VK_FORMAT_D16_UNORM_S8_UINT,
|
||||||
|
@ -74,6 +81,8 @@ void SetNext(void**& next, T& data) {
|
||||||
|
|
||||||
constexpr const VkFormat* GetFormatAlternatives(VkFormat format) {
|
constexpr const VkFormat* GetFormatAlternatives(VkFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
case VK_FORMAT_S8_UINT:
|
||||||
|
return Alternatives::STENCIL8_UINT.data();
|
||||||
case VK_FORMAT_D24_UNORM_S8_UINT:
|
case VK_FORMAT_D24_UNORM_S8_UINT:
|
||||||
return Alternatives::DEPTH24_UNORM_STENCIL8_UINT.data();
|
return Alternatives::DEPTH24_UNORM_STENCIL8_UINT.data();
|
||||||
case VK_FORMAT_D16_UNORM_S8_UINT:
|
case VK_FORMAT_D16_UNORM_S8_UINT:
|
||||||
|
@ -145,6 +154,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(vk::Physica
|
||||||
VK_FORMAT_R4G4B4A4_UNORM_PACK16,
|
VK_FORMAT_R4G4B4A4_UNORM_PACK16,
|
||||||
VK_FORMAT_D32_SFLOAT,
|
VK_FORMAT_D32_SFLOAT,
|
||||||
VK_FORMAT_D16_UNORM,
|
VK_FORMAT_D16_UNORM,
|
||||||
|
VK_FORMAT_S8_UINT,
|
||||||
VK_FORMAT_D16_UNORM_S8_UINT,
|
VK_FORMAT_D16_UNORM_S8_UINT,
|
||||||
VK_FORMAT_D24_UNORM_S8_UINT,
|
VK_FORMAT_D24_UNORM_S8_UINT,
|
||||||
VK_FORMAT_D32_SFLOAT_S8_UINT,
|
VK_FORMAT_D32_SFLOAT_S8_UINT,
|
||||||
|
|
Reference in New Issue