diff options
author | David Marcec <dmarcecguzman@gmail.com> | 2018-08-13 14:55:16 +0200 |
---|---|---|
committer | David Marcec <dmarcecguzman@gmail.com> | 2018-08-13 14:55:16 +0200 |
commit | 45cc022ea9ce4547f31c4139f9594918b5dc807b (patch) | |
tree | 1da014c6449861198a2d825ad67ab289279bf4a5 | |
parent | Merge pull request #1032 from lioncash/sanitize (diff) | |
download | yuzu-45cc022ea9ce4547f31c4139f9594918b5dc807b.tar yuzu-45cc022ea9ce4547f31c4139f9594918b5dc807b.tar.gz yuzu-45cc022ea9ce4547f31c4139f9594918b5dc807b.tar.bz2 yuzu-45cc022ea9ce4547f31c4139f9594918b5dc807b.tar.lz yuzu-45cc022ea9ce4547f31c4139f9594918b5dc807b.tar.xz yuzu-45cc022ea9ce4547f31c4139f9594918b5dc807b.tar.zst yuzu-45cc022ea9ce4547f31c4139f9594918b5dc807b.zip |
-rw-r--r-- | src/video_core/gpu.cpp | 2 | ||||
-rw-r--r-- | src/video_core/gpu.h | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 6 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 42 |
4 files changed, 45 insertions, 7 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 6f0343888..c9f6b82b7 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -49,6 +49,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { case RenderTargetFormat::RGBA16_UINT: case RenderTargetFormat::RGBA16_FLOAT: case RenderTargetFormat::RG32_FLOAT: + case RenderTargetFormat::RG32_UINT: return 8; case RenderTargetFormat::RGBA8_UNORM: case RenderTargetFormat::RGBA8_SNORM: @@ -62,6 +63,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { case RenderTargetFormat::RG16_FLOAT: case RenderTargetFormat::R32_FLOAT: case RenderTargetFormat::R11G11B10_FLOAT: + case RenderTargetFormat::R32_UINT: return 4; case RenderTargetFormat::R16_UNORM: case RenderTargetFormat::R16_SNORM: diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 73abb7a18..8a90a3a66 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -23,6 +23,7 @@ enum class RenderTargetFormat : u32 { RGBA16_UINT = 0xC9, RGBA16_FLOAT = 0xCA, RG32_FLOAT = 0xCB, + RG32_UINT = 0xCD, BGRA8_UNORM = 0xCF, RGB10_A2_UNORM = 0xD1, RGBA8_UNORM = 0xD5, @@ -34,6 +35,7 @@ enum class RenderTargetFormat : u32 { RG16_UINT = 0xDD, RG16_FLOAT = 0xDE, R11G11B10_FLOAT = 0xE0, + R32_UINT = 0xE4, R32_FLOAT = 0xE5, B5G6R5_UNORM = 0xE8, RG8_UNORM = 0xEA, diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index d635550d2..4b48ab8e2 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -137,6 +137,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // RG8U {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S + {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RG32UI + {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // R32UI // DepthStencil formats {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, @@ -275,6 +277,8 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::RG8U>, MortonCopy<true, PixelFormat::RG8S>, + MortonCopy<true, PixelFormat::RG32UI>, + MortonCopy<true, PixelFormat::R32UI>, MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, @@ -327,6 +331,8 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU MortonCopy<false, PixelFormat::SRGBA8>, MortonCopy<false, PixelFormat::RG8U>, MortonCopy<false, PixelFormat::RG8S>, + MortonCopy<false, PixelFormat::RG32UI>, + MortonCopy<false, PixelFormat::R32UI>, MortonCopy<false, PixelFormat::Z24S8>, MortonCopy<false, PixelFormat::S8Z24>, MortonCopy<false, PixelFormat::Z32F>, diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 4ab74342e..630b40e77 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -61,15 +61,17 @@ struct SurfaceParams { SRGBA8 = 35, RG8U = 36, RG8S = 37, + RG32UI = 38, + R32UI = 39, MaxColorFormat, // DepthStencil formats - Z24S8 = 38, - S8Z24 = 39, - Z32F = 40, - Z16 = 41, - Z32FS8 = 42, + Z24S8 = 40, + S8Z24 = 41, + Z32F = 42, + Z16 = 43, + Z32FS8 = 44, MaxDepthStencilFormat, @@ -145,6 +147,8 @@ struct SurfaceParams { 1, // SRGBA8 1, // RG8U 1, // RG8S + 1, // RG32UI + 1, // R32UI 1, // Z24S8 1, // S8Z24 1, // Z32F @@ -199,6 +203,8 @@ struct SurfaceParams { 32, // SRGBA8 16, // RG8U 16, // RG8S + 64, // RG32UI + 32, // R32UI 32, // Z24S8 32, // S8Z24 32, // Z32F @@ -289,6 +295,10 @@ struct SurfaceParams { return PixelFormat::R16I; case Tegra::RenderTargetFormat::R32_FLOAT: return PixelFormat::R32F; + case Tegra::RenderTargetFormat::R32_UINT: + return PixelFormat::R32UI; + case Tegra::RenderTargetFormat::RG32_UINT: + return PixelFormat::RG32UI; default: LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); UNREACHABLE(); @@ -342,7 +352,15 @@ struct SurfaceParams { static_cast<u32>(component_type)); UNREACHABLE(); case Tegra::Texture::TextureFormat::R32_G32: - return PixelFormat::RG32F; + switch (component_type) { + case Tegra::Texture::ComponentType::FLOAT: + return PixelFormat::RG32F; + case Tegra::Texture::ComponentType::UINT: + return PixelFormat::RG32UI; + } + LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", + static_cast<u32>(component_type)); + UNREACHABLE(); case Tegra::Texture::TextureFormat::R32_G32_B32: return PixelFormat::RGB32F; case Tegra::Texture::TextureFormat::R16: @@ -362,7 +380,15 @@ struct SurfaceParams { static_cast<u32>(component_type)); UNREACHABLE(); case Tegra::Texture::TextureFormat::R32: - return PixelFormat::R32F; + switch (component_type) { + case Tegra::Texture::ComponentType::FLOAT: + return PixelFormat::R32F; + case Tegra::Texture::ComponentType::UINT: + return PixelFormat::R32UI; + } + LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", + static_cast<u32>(component_type)); + UNREACHABLE(); case Tegra::Texture::TextureFormat::ZF32: return PixelFormat::Z32F; case Tegra::Texture::TextureFormat::Z24S8: @@ -462,6 +488,8 @@ struct SurfaceParams { case Tegra::RenderTargetFormat::RG16_UINT: case Tegra::RenderTargetFormat::R8_UINT: case Tegra::RenderTargetFormat::R16_UINT: + case Tegra::RenderTargetFormat::RG32_UINT: + case Tegra::RenderTargetFormat::R32_UINT: return ComponentType::UInt; case Tegra::RenderTargetFormat::RG16_SINT: case Tegra::RenderTargetFormat::R16_SINT: |