summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/gpu.h5
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp38
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h73
-rw-r--r--src/video_core/textures/decoders.cpp3
4 files changed, 100 insertions, 19 deletions
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index e9d87efb4..de276c559 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -23,6 +23,11 @@ enum class RenderTargetFormat : u32 {
23 RGB10_A2_UNORM = 0xD1, 23 RGB10_A2_UNORM = 0xD1,
24 RGBA8_UNORM = 0xD5, 24 RGBA8_UNORM = 0xD5,
25 RGBA8_SRGB = 0xD6, 25 RGBA8_SRGB = 0xD6,
26 RG16_UNORM = 0xDA,
27 RG16_SNORM = 0xDB,
28 RG16_SINT = 0xDC,
29 RG16_UINT = 0xDD,
30 RG16_FLOAT = 0xDE,
26 R11G11B10_FLOAT = 0xE0, 31 R11G11B10_FLOAT = 0xE0,
27 R8_UNORM = 0xF3, 32 R8_UNORM = 0xF3,
28}; 33};
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index f52ac23f1..a4d9707cb 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -104,15 +104,20 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
104 true}, // DXT45 104 true}, // DXT45
105 {GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN1 105 {GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN1
106 {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, 106 {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
107 true}, // BC7U 107 true}, // BC7U
108 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 108 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
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 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F 113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
114 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F 114 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
115 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM 115 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM
116 {GL_RG16, GL_RG, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // RG16
117 {GL_RG16F, GL_RG, GL_HALF_FLOAT, ComponentType::Float, false}, // RG16F
118 {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI
119 {GL_RG16I, GL_RG_INTEGER, GL_SHORT, ComponentType::SInt, false}, // RG16I
120 {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S
116 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8 121 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8
117 122
118 // DepthStencil formats 123 // DepthStencil formats
@@ -210,10 +215,12 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
210 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, 215 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
211 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, 216 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
212 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, 217 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
213 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::SRGBA8>, 218 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>,
214 MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, 219 MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>,
215 MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, 220 MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>,
216 MortonCopy<true, PixelFormat::Z32FS8>, 221 MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::Z24S8>,
222 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
223 MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
217}; 224};
218 225
219static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), 226static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -241,6 +248,11 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
241 MortonCopy<false, PixelFormat::R32F>, 248 MortonCopy<false, PixelFormat::R32F>,
242 MortonCopy<false, PixelFormat::R16F>, 249 MortonCopy<false, PixelFormat::R16F>,
243 MortonCopy<false, PixelFormat::R16UNORM>, 250 MortonCopy<false, PixelFormat::R16UNORM>,
251 MortonCopy<false, PixelFormat::RG16>,
252 MortonCopy<false, PixelFormat::RG16F>,
253 MortonCopy<false, PixelFormat::RG16UI>,
254 MortonCopy<false, PixelFormat::RG16I>,
255 MortonCopy<false, PixelFormat::RG16S>,
244 MortonCopy<false, PixelFormat::SRGBA8>, 256 MortonCopy<false, PixelFormat::SRGBA8>,
245 MortonCopy<false, PixelFormat::Z24S8>, 257 MortonCopy<false, PixelFormat::Z24S8>,
246 MortonCopy<false, PixelFormat::S8Z24>, 258 MortonCopy<false, PixelFormat::S8Z24>,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index ffa2019f7..bb39c0a6f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -43,16 +43,21 @@ struct SurfaceParams {
43 R32F = 18, 43 R32F = 18,
44 R16F = 19, 44 R16F = 19,
45 R16UNORM = 20, 45 R16UNORM = 20,
46 SRGBA8 = 21, 46 RG16 = 21,
47 RG16F = 22,
48 RG16UI = 23,
49 RG16I = 24,
50 RG16S = 25,
51 SRGBA8 = 26,
47 52
48 MaxColorFormat, 53 MaxColorFormat,
49 54
50 // DepthStencil formats 55 // DepthStencil formats
51 Z24S8 = 22, 56 Z24S8 = 27,
52 S8Z24 = 23, 57 S8Z24 = 28,
53 Z32F = 24, 58 Z32F = 29,
54 Z16 = 25, 59 Z16 = 30,
55 Z32FS8 = 26, 60 Z32FS8 = 31,
56 61
57 MaxDepthStencilFormat, 62 MaxDepthStencilFormat,
58 63
@@ -111,6 +116,11 @@ struct SurfaceParams {
111 1, // R32F 116 1, // R32F
112 1, // R16F 117 1, // R16F
113 1, // R16UNORM 118 1, // R16UNORM
119 1, // RG16
120 1, // RG16F
121 1, // RG16UI
122 1, // RG16I
123 1, // RG16S
114 1, // SRGBA8 124 1, // SRGBA8
115 1, // Z24S8 125 1, // Z24S8
116 1, // S8Z24 126 1, // S8Z24
@@ -149,6 +159,11 @@ struct SurfaceParams {
149 32, // R32F 159 32, // R32F
150 16, // R16F 160 16, // R16F
151 16, // R16UNORM 161 16, // R16UNORM
162 32, // RG16
163 32, // RG16F
164 32, // RG16UI
165 32, // RG16I
166 32, // RG16S
152 32, // SRGBA8 167 32, // SRGBA8
153 32, // Z24S8 168 32, // Z24S8
154 32, // S8Z24 169 32, // S8Z24
@@ -205,6 +220,17 @@ struct SurfaceParams {
205 return PixelFormat::RGBA32UI; 220 return PixelFormat::RGBA32UI;
206 case Tegra::RenderTargetFormat::R8_UNORM: 221 case Tegra::RenderTargetFormat::R8_UNORM:
207 return PixelFormat::R8; 222 return PixelFormat::R8;
223 case Tegra::RenderTargetFormat::RG16_FLOAT:
224 return PixelFormat::RG16F;
225 case Tegra::RenderTargetFormat::RG16_UINT:
226 return PixelFormat::RG16UI;
227 case Tegra::RenderTargetFormat::RG16_SINT:
228 return PixelFormat::RG16I;
229 case Tegra::RenderTargetFormat::RG16_UNORM:
230 return PixelFormat::RG16;
231 case Tegra::RenderTargetFormat::RG16_SNORM:
232 return PixelFormat::RG16S;
233
208 default: 234 default:
209 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 235 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
210 UNREACHABLE(); 236 UNREACHABLE();
@@ -271,6 +297,22 @@ struct SurfaceParams {
271 return PixelFormat::BC7U; 297 return PixelFormat::BC7U;
272 case Tegra::Texture::TextureFormat::ASTC_2D_4X4: 298 case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
273 return PixelFormat::ASTC_2D_4X4; 299 return PixelFormat::ASTC_2D_4X4;
300 case Tegra::Texture::TextureFormat::R16_G16:
301 switch (component_type) {
302 case Tegra::Texture::ComponentType::FLOAT:
303 return PixelFormat::RG16F;
304 case Tegra::Texture::ComponentType::UNORM:
305 return PixelFormat::RG16;
306 case Tegra::Texture::ComponentType::SNORM:
307 return PixelFormat::RG16S;
308 case Tegra::Texture::ComponentType::UINT:
309 return PixelFormat::RG16UI;
310 case Tegra::Texture::ComponentType::SINT:
311 return PixelFormat::RG16I;
312 }
313 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
314 static_cast<u32>(component_type));
315 UNREACHABLE();
274 default: 316 default:
275 LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}", 317 LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}",
276 static_cast<u32>(format), static_cast<u32>(component_type)); 318 static_cast<u32>(format), static_cast<u32>(component_type));
@@ -329,6 +371,12 @@ struct SurfaceParams {
329 return Tegra::Texture::TextureFormat::ZF32; 371 return Tegra::Texture::TextureFormat::ZF32;
330 case PixelFormat::Z24S8: 372 case PixelFormat::Z24S8:
331 return Tegra::Texture::TextureFormat::Z24S8; 373 return Tegra::Texture::TextureFormat::Z24S8;
374 case PixelFormat::RG16F:
375 case PixelFormat::RG16:
376 case PixelFormat::RG16UI:
377 case PixelFormat::RG16I:
378 case PixelFormat::RG16S:
379 return Tegra::Texture::TextureFormat::R16_G16;
332 default: 380 default:
333 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 381 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
334 UNREACHABLE(); 382 UNREACHABLE();
@@ -360,6 +408,12 @@ struct SurfaceParams {
360 return ComponentType::UNorm; 408 return ComponentType::UNorm;
361 case Tegra::Texture::ComponentType::FLOAT: 409 case Tegra::Texture::ComponentType::FLOAT:
362 return ComponentType::Float; 410 return ComponentType::Float;
411 case Tegra::Texture::ComponentType::SNORM:
412 return ComponentType::SNorm;
413 case Tegra::Texture::ComponentType::UINT:
414 return ComponentType::UInt;
415 case Tegra::Texture::ComponentType::SINT:
416 return ComponentType::SInt;
363 default: 417 default:
364 LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type)); 418 LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type));
365 UNREACHABLE(); 419 UNREACHABLE();
@@ -374,14 +428,21 @@ struct SurfaceParams {
374 case Tegra::RenderTargetFormat::BGRA8_UNORM: 428 case Tegra::RenderTargetFormat::BGRA8_UNORM:
375 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 429 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
376 case Tegra::RenderTargetFormat::R8_UNORM: 430 case Tegra::RenderTargetFormat::R8_UNORM:
431 case Tegra::RenderTargetFormat::RG16_UNORM:
377 return ComponentType::UNorm; 432 return ComponentType::UNorm;
433 case Tegra::RenderTargetFormat::RG16_SNORM:
434 return ComponentType::SNorm;
378 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 435 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
379 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 436 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
380 case Tegra::RenderTargetFormat::RGBA32_FLOAT: 437 case Tegra::RenderTargetFormat::RGBA32_FLOAT:
381 case Tegra::RenderTargetFormat::RG32_FLOAT: 438 case Tegra::RenderTargetFormat::RG32_FLOAT:
439 case Tegra::RenderTargetFormat::RG16_FLOAT:
382 return ComponentType::Float; 440 return ComponentType::Float;
383 case Tegra::RenderTargetFormat::RGBA32_UINT: 441 case Tegra::RenderTargetFormat::RGBA32_UINT:
442 case Tegra::RenderTargetFormat::RG16_UINT:
384 return ComponentType::UInt; 443 return ComponentType::UInt;
444 case Tegra::RenderTargetFormat::RG16_SINT:
445 return ComponentType::SInt;
385 default: 446 default:
386 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 447 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
387 UNREACHABLE(); 448 UNREACHABLE();
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index 50c5a56f6..d794f8402 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -62,6 +62,7 @@ u32 BytesPerPixel(TextureFormat format) {
62 case TextureFormat::A2B10G10R10: 62 case TextureFormat::A2B10G10R10:
63 case TextureFormat::BF10GF11RF11: 63 case TextureFormat::BF10GF11RF11:
64 case TextureFormat::R32: 64 case TextureFormat::R32:
65 case TextureFormat::R16_G16:
65 return 4; 66 return 4;
66 case TextureFormat::A1B5G5R5: 67 case TextureFormat::A1B5G5R5:
67 case TextureFormat::B5G6R5: 68 case TextureFormat::B5G6R5:
@@ -127,6 +128,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
127 case TextureFormat::R32_G32: 128 case TextureFormat::R32_G32:
128 case TextureFormat::R32: 129 case TextureFormat::R32:
129 case TextureFormat::R16: 130 case TextureFormat::R16:
131 case TextureFormat::R16_G16:
130 case TextureFormat::BF10GF11RF11: 132 case TextureFormat::BF10GF11RF11:
131 case TextureFormat::ASTC_2D_4X4: 133 case TextureFormat::ASTC_2D_4X4:
132 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 134 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
@@ -187,6 +189,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
187 case TextureFormat::R32_G32: 189 case TextureFormat::R32_G32:
188 case TextureFormat::R32: 190 case TextureFormat::R32:
189 case TextureFormat::R16: 191 case TextureFormat::R16:
192 case TextureFormat::R16_G16:
190 // TODO(Subv): For the time being just forward the same data without any decoding. 193 // TODO(Subv): For the time being just forward the same data without any decoding.
191 rgba_data = texture_data; 194 rgba_data = texture_data;
192 break; 195 break;