diff options
| author | 2023-10-07 10:55:14 -0400 | |
|---|---|---|
| committer | 2023-10-07 10:55:14 -0400 | |
| commit | ff3859d48209c4931993c0f2d14994145b0e81f8 (patch) | |
| tree | 4de2a9bd8614958fbf1055e08b70892611f045a8 /src | |
| parent | Merge pull request #11684 from Kelebek1/disable_push_descriptor_maxwell (diff) | |
| parent | Implement X8_D24 format (diff) | |
| download | yuzu-ff3859d48209c4931993c0f2d14994145b0e81f8.tar.gz yuzu-ff3859d48209c4931993c0f2d14994145b0e81f8.tar.xz yuzu-ff3859d48209c4931993c0f2d14994145b0e81f8.zip | |
Merge pull request #11688 from Kelebek1/x8d42
Implement X8_D24 pixel format
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/maxwell_to_gl.h | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/maxwell_to_vk.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/surface.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/surface.h | 4 | ||||
| -rw-r--r-- | src/video_core/texture_cache/format_lookup_table.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/texture_cache/formatter.h | 2 | ||||
| -rw-r--r-- | src/video_core/texture_cache/image_view_base.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 1 |
10 files changed, 21 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index c7dc7e0a1..5ea9e2378 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h | |||
| @@ -116,6 +116,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB | |||
| 116 | {GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT | 116 | {GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT |
| 117 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT | 117 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT |
| 118 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM | 118 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM |
| 119 | {GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT_24_8}, // X8_D24_UNORM | ||
| 119 | {GL_STENCIL_INDEX8, GL_STENCIL, GL_UNSIGNED_BYTE}, // S8_UINT | 120 | {GL_STENCIL_INDEX8, GL_STENCIL, GL_UNSIGNED_BYTE}, // S8_UINT |
| 120 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT | 121 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT |
| 121 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM | 122 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM |
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index 208e88533..a08f2f67f 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp | |||
| @@ -214,8 +214,9 @@ struct FormatTuple { | |||
| 214 | {VK_FORMAT_E5B9G9R9_UFLOAT_PACK32}, // E5B9G9R9_FLOAT | 214 | {VK_FORMAT_E5B9G9R9_UFLOAT_PACK32}, // E5B9G9R9_FLOAT |
| 215 | 215 | ||
| 216 | // Depth formats | 216 | // Depth formats |
| 217 | {VK_FORMAT_D32_SFLOAT, Attachable}, // D32_FLOAT | 217 | {VK_FORMAT_D32_SFLOAT, Attachable}, // D32_FLOAT |
| 218 | {VK_FORMAT_D16_UNORM, Attachable}, // D16_UNORM | 218 | {VK_FORMAT_D16_UNORM, Attachable}, // D16_UNORM |
| 219 | {VK_FORMAT_X8_D24_UNORM_PACK32, Attachable}, // X8_D24_UNORM | ||
| 219 | 220 | ||
| 220 | // Stencil formats | 221 | // Stencil formats |
| 221 | {VK_FORMAT_S8_UINT, Attachable}, // S8_UINT | 222 | {VK_FORMAT_S8_UINT, Attachable}, // S8_UINT |
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index 31928bb94..52fc142d1 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp | |||
| @@ -96,6 +96,7 @@ std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) { | |||
| 96 | VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { | 96 | VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { |
| 97 | switch (framebuffer.pixel_format) { | 97 | switch (framebuffer.pixel_format) { |
| 98 | case Service::android::PixelFormat::Rgba8888: | 98 | case Service::android::PixelFormat::Rgba8888: |
| 99 | case Service::android::PixelFormat::Rgbx8888: | ||
| 99 | return VK_FORMAT_A8B8G8R8_UNORM_PACK32; | 100 | return VK_FORMAT_A8B8G8R8_UNORM_PACK32; |
| 100 | case Service::android::PixelFormat::Rgb565: | 101 | case Service::android::PixelFormat::Rgb565: |
| 101 | return VK_FORMAT_R5G6B5_UNORM_PACK16; | 102 | return VK_FORMAT_R5G6B5_UNORM_PACK16; |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 71fdec809..e266c1dbe 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -238,6 +238,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { | |||
| 238 | return any_r ? VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; | 238 | return any_r ? VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; |
| 239 | case PixelFormat::D16_UNORM: | 239 | case PixelFormat::D16_UNORM: |
| 240 | case PixelFormat::D32_FLOAT: | 240 | case PixelFormat::D32_FLOAT: |
| 241 | case PixelFormat::X8_D24_UNORM: | ||
| 241 | return VK_IMAGE_ASPECT_DEPTH_BIT; | 242 | return VK_IMAGE_ASPECT_DEPTH_BIT; |
| 242 | case PixelFormat::S8_UINT: | 243 | case PixelFormat::S8_UINT: |
| 243 | return VK_IMAGE_ASPECT_STENCIL_BIT; | 244 | return VK_IMAGE_ASPECT_STENCIL_BIT; |
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index e16cd5e73..5b3c7aa5a 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -85,6 +85,8 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) { | |||
| 85 | return PixelFormat::S8_UINT; | 85 | return PixelFormat::S8_UINT; |
| 86 | case Tegra::DepthFormat::Z32_FLOAT_X24S8_UINT: | 86 | case Tegra::DepthFormat::Z32_FLOAT_X24S8_UINT: |
| 87 | return PixelFormat::D32_FLOAT_S8_UINT; | 87 | return PixelFormat::D32_FLOAT_S8_UINT; |
| 88 | case Tegra::DepthFormat::X8Z24_UNORM: | ||
| 89 | return PixelFormat::X8_D24_UNORM; | ||
| 88 | default: | 90 | default: |
| 89 | UNIMPLEMENTED_MSG("Unimplemented format={}", format); | 91 | UNIMPLEMENTED_MSG("Unimplemented format={}", format); |
| 90 | return PixelFormat::S8_UINT_D24_UNORM; | 92 | return PixelFormat::S8_UINT_D24_UNORM; |
| @@ -202,6 +204,7 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) | |||
| 202 | PixelFormat PixelFormatFromGPUPixelFormat(Service::android::PixelFormat format) { | 204 | PixelFormat PixelFormatFromGPUPixelFormat(Service::android::PixelFormat format) { |
| 203 | switch (format) { | 205 | switch (format) { |
| 204 | case Service::android::PixelFormat::Rgba8888: | 206 | case Service::android::PixelFormat::Rgba8888: |
| 207 | case Service::android::PixelFormat::Rgbx8888: | ||
| 205 | return PixelFormat::A8B8G8R8_UNORM; | 208 | return PixelFormat::A8B8G8R8_UNORM; |
| 206 | case Service::android::PixelFormat::Rgb565: | 209 | case Service::android::PixelFormat::Rgb565: |
| 207 | return PixelFormat::R5G6B5_UNORM; | 210 | return PixelFormat::R5G6B5_UNORM; |
diff --git a/src/video_core/surface.h b/src/video_core/surface.h index 9b9c4d9bc..a5e8e2f62 100644 --- a/src/video_core/surface.h +++ b/src/video_core/surface.h | |||
| @@ -115,6 +115,7 @@ enum class PixelFormat { | |||
| 115 | // Depth formats | 115 | // Depth formats |
| 116 | D32_FLOAT = MaxColorFormat, | 116 | D32_FLOAT = MaxColorFormat, |
| 117 | D16_UNORM, | 117 | D16_UNORM, |
| 118 | X8_D24_UNORM, | ||
| 118 | 119 | ||
| 119 | MaxDepthFormat, | 120 | MaxDepthFormat, |
| 120 | 121 | ||
| @@ -251,6 +252,7 @@ constexpr std::array<u8, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{ | |||
| 251 | 1, // E5B9G9R9_FLOAT | 252 | 1, // E5B9G9R9_FLOAT |
| 252 | 1, // D32_FLOAT | 253 | 1, // D32_FLOAT |
| 253 | 1, // D16_UNORM | 254 | 1, // D16_UNORM |
| 255 | 1, // X8_D24_UNORM | ||
| 254 | 1, // S8_UINT | 256 | 1, // S8_UINT |
| 255 | 1, // D24_UNORM_S8_UINT | 257 | 1, // D24_UNORM_S8_UINT |
| 256 | 1, // S8_UINT_D24_UNORM | 258 | 1, // S8_UINT_D24_UNORM |
| @@ -360,6 +362,7 @@ constexpr std::array<u8, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{ | |||
| 360 | 1, // E5B9G9R9_FLOAT | 362 | 1, // E5B9G9R9_FLOAT |
| 361 | 1, // D32_FLOAT | 363 | 1, // D32_FLOAT |
| 362 | 1, // D16_UNORM | 364 | 1, // D16_UNORM |
| 365 | 1, // X8_D24_UNORM | ||
| 363 | 1, // S8_UINT | 366 | 1, // S8_UINT |
| 364 | 1, // D24_UNORM_S8_UINT | 367 | 1, // D24_UNORM_S8_UINT |
| 365 | 1, // S8_UINT_D24_UNORM | 368 | 1, // S8_UINT_D24_UNORM |
| @@ -469,6 +472,7 @@ constexpr std::array<u8, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{ | |||
| 469 | 32, // E5B9G9R9_FLOAT | 472 | 32, // E5B9G9R9_FLOAT |
| 470 | 32, // D32_FLOAT | 473 | 32, // D32_FLOAT |
| 471 | 16, // D16_UNORM | 474 | 16, // D16_UNORM |
| 475 | 32, // X8_D24_UNORM | ||
| 472 | 8, // S8_UINT | 476 | 8, // S8_UINT |
| 473 | 32, // D24_UNORM_S8_UINT | 477 | 32, // D24_UNORM_S8_UINT |
| 474 | 32, // S8_UINT_D24_UNORM | 478 | 32, // S8_UINT_D24_UNORM |
diff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cpp index 56307d030..3162c8f5e 100644 --- a/src/video_core/texture_cache/format_lookup_table.cpp +++ b/src/video_core/texture_cache/format_lookup_table.cpp | |||
| @@ -142,6 +142,10 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red, | |||
| 142 | return PixelFormat::D16_UNORM; | 142 | return PixelFormat::D16_UNORM; |
| 143 | case Hash(TextureFormat::Z16, UNORM, UINT, UINT, UINT, LINEAR): | 143 | case Hash(TextureFormat::Z16, UNORM, UINT, UINT, UINT, LINEAR): |
| 144 | return PixelFormat::D16_UNORM; | 144 | return PixelFormat::D16_UNORM; |
| 145 | case Hash(TextureFormat::X8Z24, UNORM): | ||
| 146 | return PixelFormat::X8_D24_UNORM; | ||
| 147 | case Hash(TextureFormat::X8Z24, UNORM, UINT, UINT, UINT, LINEAR): | ||
| 148 | return PixelFormat::X8_D24_UNORM; | ||
| 145 | case Hash(TextureFormat::Z24S8, UINT, UNORM, UNORM, UNORM, LINEAR): | 149 | case Hash(TextureFormat::Z24S8, UINT, UNORM, UNORM, UNORM, LINEAR): |
| 146 | return PixelFormat::S8_UINT_D24_UNORM; | 150 | return PixelFormat::S8_UINT_D24_UNORM; |
| 147 | case Hash(TextureFormat::Z24S8, UINT, UNORM, UINT, UINT, LINEAR): | 151 | case Hash(TextureFormat::Z24S8, UINT, UNORM, UINT, UINT, LINEAR): |
diff --git a/src/video_core/texture_cache/formatter.h b/src/video_core/texture_cache/formatter.h index 9ee57a076..cabbfcb2d 100644 --- a/src/video_core/texture_cache/formatter.h +++ b/src/video_core/texture_cache/formatter.h | |||
| @@ -211,6 +211,8 @@ struct fmt::formatter<VideoCore::Surface::PixelFormat> : fmt::formatter<fmt::str | |||
| 211 | return "D32_FLOAT"; | 211 | return "D32_FLOAT"; |
| 212 | case PixelFormat::D16_UNORM: | 212 | case PixelFormat::D16_UNORM: |
| 213 | return "D16_UNORM"; | 213 | return "D16_UNORM"; |
| 214 | case PixelFormat::X8_D24_UNORM: | ||
| 215 | return "X8_D24_UNORM"; | ||
| 214 | case PixelFormat::S8_UINT: | 216 | case PixelFormat::S8_UINT: |
| 215 | return "S8_UINT"; | 217 | return "S8_UINT"; |
| 216 | case PixelFormat::D24_UNORM_S8_UINT: | 218 | case PixelFormat::D24_UNORM_S8_UINT: |
diff --git a/src/video_core/texture_cache/image_view_base.cpp b/src/video_core/texture_cache/image_view_base.cpp index 0c5f4450d..18b9250f9 100644 --- a/src/video_core/texture_cache/image_view_base.cpp +++ b/src/video_core/texture_cache/image_view_base.cpp | |||
| @@ -85,6 +85,7 @@ bool ImageViewBase::SupportsAnisotropy() const noexcept { | |||
| 85 | // Depth formats | 85 | // Depth formats |
| 86 | case PixelFormat::D32_FLOAT: | 86 | case PixelFormat::D32_FLOAT: |
| 87 | case PixelFormat::D16_UNORM: | 87 | case PixelFormat::D16_UNORM: |
| 88 | case PixelFormat::X8_D24_UNORM: | ||
| 88 | // Stencil formats | 89 | // Stencil formats |
| 89 | case PixelFormat::S8_UINT: | 90 | case PixelFormat::S8_UINT: |
| 90 | // DepthStencil formats | 91 | // DepthStencil formats |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index e7ce28dd4..876cec2e8 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -203,6 +203,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(vk::Physica | |||
| 203 | VK_FORMAT_BC7_UNORM_BLOCK, | 203 | VK_FORMAT_BC7_UNORM_BLOCK, |
| 204 | VK_FORMAT_D16_UNORM, | 204 | VK_FORMAT_D16_UNORM, |
| 205 | VK_FORMAT_D16_UNORM_S8_UINT, | 205 | VK_FORMAT_D16_UNORM_S8_UINT, |
| 206 | VK_FORMAT_X8_D24_UNORM_PACK32, | ||
| 206 | VK_FORMAT_D24_UNORM_S8_UINT, | 207 | VK_FORMAT_D24_UNORM_S8_UINT, |
| 207 | VK_FORMAT_D32_SFLOAT, | 208 | VK_FORMAT_D32_SFLOAT, |
| 208 | VK_FORMAT_D32_SFLOAT_S8_UINT, | 209 | VK_FORMAT_D32_SFLOAT_S8_UINT, |