summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-23 19:10:00 -0400
committerGravatar bunnei2018-07-23 21:22:54 -0400
commita27c0099ededac2d1fb1745a437a446450dfea10 (patch)
treef50d597af8bec5e7403217945d061f3e6ecaff4f /src
parentgl_rasterizer_cache: Implement RenderTargetFormat RGBA32_FLOAT. (diff)
downloadyuzu-a27c0099ededac2d1fb1745a437a446450dfea10.tar.gz
yuzu-a27c0099ededac2d1fb1745a437a446450dfea10.tar.xz
yuzu-a27c0099ededac2d1fb1745a437a446450dfea10.zip
gl_rasterizer_cache: Implement RenderTargetFormat RG32_FLOAT.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/gpu.cpp1
-rw-r--r--src/video_core/gpu.h1
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h18
-rw-r--r--src/video_core/textures/decoders.cpp4
5 files changed, 25 insertions, 7 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index b094d48c3..60c49d672 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -35,6 +35,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
35 case RenderTargetFormat::RGBA32_FLOAT: 35 case RenderTargetFormat::RGBA32_FLOAT:
36 return 16; 36 return 16;
37 case RenderTargetFormat::RGBA16_FLOAT: 37 case RenderTargetFormat::RGBA16_FLOAT:
38 case RenderTargetFormat::RG32_FLOAT:
38 return 8; 39 return 8;
39 case RenderTargetFormat::RGBA8_UNORM: 40 case RenderTargetFormat::RGBA8_UNORM:
40 case RenderTargetFormat::RGB10_A2_UNORM: 41 case RenderTargetFormat::RGB10_A2_UNORM:
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 9c74cfac3..58501ca8b 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -18,6 +18,7 @@ enum class RenderTargetFormat : u32 {
18 RGBA32_FLOAT = 0xC0, 18 RGBA32_FLOAT = 0xC0,
19 RGBA32_UINT = 0xC2, 19 RGBA32_UINT = 0xC2,
20 RGBA16_FLOAT = 0xCA, 20 RGBA16_FLOAT = 0xCA,
21 RG32_FLOAT = 0xCB,
21 BGRA8_UNORM = 0xCF, 22 BGRA8_UNORM = 0xCF,
22 RGB10_A2_UNORM = 0xD1, 23 RGB10_A2_UNORM = 0xD1,
23 RGBA8_UNORM = 0xD5, 24 RGBA8_UNORM = 0xD5,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 133a15a12..8f99864a0 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -109,6 +109,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
109 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8 109 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8
110 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 110 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
111 {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F 111 {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
112 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
112 113
113 // DepthStencil formats 114 // DepthStencil formats
114 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 115 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
@@ -201,9 +202,9 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
201 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, 202 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>,
202 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, 203 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
203 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, 204 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
204 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::Z24S8>, 205 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
205 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, 206 MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
206 MortonCopy<true, PixelFormat::Z16>, 207 MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
207}; 208};
208 209
209static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), 210static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -227,6 +228,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
227 MortonCopy<false, PixelFormat::G8R8>, 228 MortonCopy<false, PixelFormat::G8R8>,
228 MortonCopy<false, PixelFormat::BGRA8>, 229 MortonCopy<false, PixelFormat::BGRA8>,
229 MortonCopy<false, PixelFormat::RGBA32F>, 230 MortonCopy<false, PixelFormat::RGBA32F>,
231 MortonCopy<false, PixelFormat::RG32F>,
230 MortonCopy<false, PixelFormat::Z24S8>, 232 MortonCopy<false, PixelFormat::Z24S8>,
231 MortonCopy<false, PixelFormat::S8Z24>, 233 MortonCopy<false, PixelFormat::S8Z24>,
232 MortonCopy<false, PixelFormat::Z32F>, 234 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 2feea3d4d..23efbe67c 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -39,14 +39,15 @@ struct SurfaceParams {
39 G8R8 = 14, 39 G8R8 = 14,
40 BGRA8 = 15, 40 BGRA8 = 15,
41 RGBA32F = 16, 41 RGBA32F = 16,
42 RG32F = 17,
42 43
43 MaxColorFormat, 44 MaxColorFormat,
44 45
45 // DepthStencil formats 46 // DepthStencil formats
46 Z24S8 = 17, 47 Z24S8 = 18,
47 S8Z24 = 18, 48 S8Z24 = 19,
48 Z32F = 19, 49 Z32F = 20,
49 Z16 = 20, 50 Z16 = 21,
50 51
51 MaxDepthStencilFormat, 52 MaxDepthStencilFormat,
52 53
@@ -101,6 +102,7 @@ struct SurfaceParams {
101 1, // G8R8 102 1, // G8R8
102 1, // BGRA8 103 1, // BGRA8
103 1, // RGBA32F 104 1, // RGBA32F
105 1, // RG32F
104 1, // Z24S8 106 1, // Z24S8
105 1, // S8Z24 107 1, // S8Z24
106 1, // Z32F 108 1, // Z32F
@@ -133,6 +135,7 @@ struct SurfaceParams {
133 16, // G8R8 135 16, // G8R8
134 32, // BGRA8 136 32, // BGRA8
135 128, // RGBA32F 137 128, // RGBA32F
138 64, // RG32F
136 32, // Z24S8 139 32, // Z24S8
137 32, // S8Z24 140 32, // S8Z24
138 32, // Z32F 141 32, // Z32F
@@ -176,6 +179,8 @@ struct SurfaceParams {
176 return PixelFormat::RGBA16F; 179 return PixelFormat::RGBA16F;
177 case Tegra::RenderTargetFormat::RGBA32_FLOAT: 180 case Tegra::RenderTargetFormat::RGBA32_FLOAT:
178 return PixelFormat::RGBA32F; 181 return PixelFormat::RGBA32F;
182 case Tegra::RenderTargetFormat::RG32_FLOAT:
183 return PixelFormat::RG32F;
179 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 184 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
180 return PixelFormat::R11FG11FB10F; 185 return PixelFormat::R11FG11FB10F;
181 case Tegra::RenderTargetFormat::RGBA32_UINT: 186 case Tegra::RenderTargetFormat::RGBA32_UINT:
@@ -216,6 +221,8 @@ struct SurfaceParams {
216 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", 221 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
217 static_cast<u32>(component_type)); 222 static_cast<u32>(component_type));
218 UNREACHABLE(); 223 UNREACHABLE();
224 case Tegra::Texture::TextureFormat::R32_G32:
225 return PixelFormat::RG32F;
219 case Tegra::Texture::TextureFormat::DXT1: 226 case Tegra::Texture::TextureFormat::DXT1:
220 return PixelFormat::DXT1; 227 return PixelFormat::DXT1;
221 case Tegra::Texture::TextureFormat::DXT23: 228 case Tegra::Texture::TextureFormat::DXT23:
@@ -274,6 +281,8 @@ struct SurfaceParams {
274 return Tegra::Texture::TextureFormat::A8R8G8B8; 281 return Tegra::Texture::TextureFormat::A8R8G8B8;
275 case PixelFormat::RGBA32F: 282 case PixelFormat::RGBA32F:
276 return Tegra::Texture::TextureFormat::R32_G32_B32_A32; 283 return Tegra::Texture::TextureFormat::R32_G32_B32_A32;
284 case PixelFormat::RG32F:
285 return Tegra::Texture::TextureFormat::R32_G32;
277 default: 286 default:
278 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 287 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
279 UNREACHABLE(); 288 UNREACHABLE();
@@ -320,6 +329,7 @@ struct SurfaceParams {
320 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 329 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
321 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 330 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
322 case Tegra::RenderTargetFormat::RGBA32_FLOAT: 331 case Tegra::RenderTargetFormat::RGBA32_FLOAT:
332 case Tegra::RenderTargetFormat::RG32_FLOAT:
323 return ComponentType::Float; 333 return ComponentType::Float;
324 case Tegra::RenderTargetFormat::RGBA32_UINT: 334 case Tegra::RenderTargetFormat::RGBA32_UINT:
325 return ComponentType::UInt; 335 return ComponentType::UInt;
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index a3e67d105..e5e9e1898 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -72,6 +72,8 @@ u32 BytesPerPixel(TextureFormat format) {
72 return 8; 72 return 8;
73 case TextureFormat::R32_G32_B32_A32: 73 case TextureFormat::R32_G32_B32_A32:
74 return 16; 74 return 16;
75 case TextureFormat::R32_G32:
76 return 8;
75 default: 77 default:
76 UNIMPLEMENTED_MSG("Format not implemented"); 78 UNIMPLEMENTED_MSG("Format not implemented");
77 break; 79 break;
@@ -118,6 +120,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
118 case TextureFormat::G8R8: 120 case TextureFormat::G8R8:
119 case TextureFormat::R16_G16_B16_A16: 121 case TextureFormat::R16_G16_B16_A16:
120 case TextureFormat::R32_G32_B32_A32: 122 case TextureFormat::R32_G32_B32_A32:
123 case TextureFormat::R32_G32:
121 case TextureFormat::BF10GF11RF11: 124 case TextureFormat::BF10GF11RF11:
122 case TextureFormat::ASTC_2D_4X4: 125 case TextureFormat::ASTC_2D_4X4:
123 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 126 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
@@ -174,6 +177,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
174 case TextureFormat::G8R8: 177 case TextureFormat::G8R8:
175 case TextureFormat::BF10GF11RF11: 178 case TextureFormat::BF10GF11RF11:
176 case TextureFormat::R32_G32_B32_A32: 179 case TextureFormat::R32_G32_B32_A32:
180 case TextureFormat::R32_G32:
177 // TODO(Subv): For the time being just forward the same data without any decoding. 181 // TODO(Subv): For the time being just forward the same data without any decoding.
178 rgba_data = texture_data; 182 rgba_data = texture_data;
179 break; 183 break;