yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

video_core: Add S8_UINT stencil format

This commit is contained in:
Morph 2021-11-17 15:04:38 -05:00
parent 71313509f7
commit 2348eb41f3
4 changed files with 21 additions and 3 deletions

View File

@ -83,6 +83,7 @@ enum class DepthFormat : u32 {
S8_UINT_Z24_UNORM = 0x14, S8_UINT_Z24_UNORM = 0x14,
D24X8_UNORM = 0x15, D24X8_UNORM = 0x15,
D24S8_UNORM = 0x16, D24S8_UNORM = 0x16,
S8_UINT = 0x17,
D24C8_UNORM = 0x18, D24C8_UNORM = 0x18,
D32_FLOAT_S8X24_UINT = 0x19, D32_FLOAT_S8X24_UINT = 0x19,
}; };

View File

@ -82,6 +82,8 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) {
return PixelFormat::D32_FLOAT; return PixelFormat::D32_FLOAT;
case Tegra::DepthFormat::D16_UNORM: case Tegra::DepthFormat::D16_UNORM:
return PixelFormat::D16_UNORM; return PixelFormat::D16_UNORM;
case Tegra::DepthFormat::S8_UINT:
return PixelFormat::S8_UINT;
case Tegra::DepthFormat::D32_FLOAT_S8X24_UINT: case Tegra::DepthFormat::D32_FLOAT_S8X24_UINT:
return PixelFormat::D32_FLOAT_S8_UINT; return PixelFormat::D32_FLOAT_S8_UINT;
default: default:
@ -213,6 +215,11 @@ SurfaceType GetFormatType(PixelFormat pixel_format) {
return SurfaceType::Depth; return SurfaceType::Depth;
} }
if (static_cast<std::size_t>(pixel_format) <
static_cast<std::size_t>(PixelFormat::MaxStencilFormat)) {
return SurfaceType::Stencil;
}
if (static_cast<std::size_t>(pixel_format) < if (static_cast<std::size_t>(pixel_format) <
static_cast<std::size_t>(PixelFormat::MaxDepthStencilFormat)) { static_cast<std::size_t>(PixelFormat::MaxDepthStencilFormat)) {
return SurfaceType::DepthStencil; return SurfaceType::DepthStencil;

View File

@ -110,8 +110,12 @@ enum class PixelFormat {
MaxDepthFormat, MaxDepthFormat,
// Stencil formats
S8_UINT = MaxDepthFormat,
MaxStencilFormat,
// DepthStencil formats // DepthStencil formats
D24_UNORM_S8_UINT = MaxDepthFormat, D24_UNORM_S8_UINT = MaxStencilFormat,
S8_UINT_D24_UNORM, S8_UINT_D24_UNORM,
D32_FLOAT_S8_UINT, D32_FLOAT_S8_UINT,
@ -125,8 +129,9 @@ constexpr std::size_t MaxPixelFormat = static_cast<std::size_t>(PixelFormat::Max
enum class SurfaceType { enum class SurfaceType {
ColorTexture = 0, ColorTexture = 0,
Depth = 1, Depth = 1,
DepthStencil = 2, Stencil = 2,
Invalid = 3, DepthStencil = 3,
Invalid = 4,
}; };
enum class SurfaceTarget { enum class SurfaceTarget {
@ -229,6 +234,7 @@ constexpr std::array<u32, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{
1, // E5B9G9R9_FLOAT 1, // E5B9G9R9_FLOAT
1, // D32_FLOAT 1, // D32_FLOAT
1, // D16_UNORM 1, // D16_UNORM
1, // S8_UINT
1, // D24_UNORM_S8_UINT 1, // D24_UNORM_S8_UINT
1, // S8_UINT_D24_UNORM 1, // S8_UINT_D24_UNORM
1, // D32_FLOAT_S8_UINT 1, // D32_FLOAT_S8_UINT
@ -328,6 +334,7 @@ constexpr std::array<u32, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{
1, // E5B9G9R9_FLOAT 1, // E5B9G9R9_FLOAT
1, // D32_FLOAT 1, // D32_FLOAT
1, // D16_UNORM 1, // D16_UNORM
1, // S8_UINT
1, // D24_UNORM_S8_UINT 1, // D24_UNORM_S8_UINT
1, // S8_UINT_D24_UNORM 1, // S8_UINT_D24_UNORM
1, // D32_FLOAT_S8_UINT 1, // D32_FLOAT_S8_UINT
@ -427,6 +434,7 @@ constexpr std::array<u32, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{
32, // E5B9G9R9_FLOAT 32, // E5B9G9R9_FLOAT
32, // D32_FLOAT 32, // D32_FLOAT
16, // D16_UNORM 16, // D16_UNORM
8, // S8_UINT
32, // D24_UNORM_S8_UINT 32, // D24_UNORM_S8_UINT
32, // S8_UINT_D24_UNORM 32, // S8_UINT_D24_UNORM
64, // D32_FLOAT_S8_UINT 64, // D32_FLOAT_S8_UINT

View File

@ -194,6 +194,8 @@ struct fmt::formatter<VideoCore::Surface::PixelFormat> : fmt::formatter<fmt::str
return "D32_FLOAT"; return "D32_FLOAT";
case PixelFormat::D16_UNORM: case PixelFormat::D16_UNORM:
return "D16_UNORM"; return "D16_UNORM";
case PixelFormat::S8_UINT:
return "S8_UINT";
case PixelFormat::D24_UNORM_S8_UINT: case PixelFormat::D24_UNORM_S8_UINT:
return "D24_UNORM_S8_UINT"; return "D24_UNORM_S8_UINT";
case PixelFormat::S8_UINT_D24_UNORM: case PixelFormat::S8_UINT_D24_UNORM: