summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp30
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h82
2 files changed, 71 insertions, 41 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 05f153599..b6947b97b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -94,11 +94,11 @@ struct FormatTuple {
94static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{ 94static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{
95 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // ABGR8U 95 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // ABGR8U
96 {GL_RGBA8, GL_RGBA, GL_BYTE, ComponentType::SNorm, false}, // ABGR8S 96 {GL_RGBA8, GL_RGBA, GL_BYTE, ComponentType::SNorm, false}, // ABGR8S
97 {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, ComponentType::UNorm, false}, // B5G6R5 97 {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, ComponentType::UNorm, false}, // B5G6R5U
98 {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, ComponentType::UNorm, 98 {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, ComponentType::UNorm,
99 false}, // A2B10G10R10 99 false}, // A2B10G10R10U
100 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, ComponentType::UNorm, false}, // A1B5G5R5 100 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, ComponentType::UNorm, false}, // A1B5G5R5U
101 {GL_R8, GL_RED, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // R8 101 {GL_R8, GL_RED, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // R8U
102 {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, ComponentType::UInt, false}, // R8UI 102 {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, ComponentType::UInt, false}, // R8UI
103 {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, ComponentType::Float, false}, // RGBA16F 103 {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, ComponentType::Float, false}, // RGBA16F
104 {GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // RGBA16U 104 {GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // RGBA16U
@@ -126,7 +126,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
126 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F 126 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
127 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F 127 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
128 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F 128 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
129 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM 129 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16U
130 {GL_R16_SNORM, GL_RED, GL_SHORT, ComponentType::SNorm, false}, // R16S 130 {GL_R16_SNORM, GL_RED, GL_SHORT, ComponentType::SNorm, false}, // R16S
131 {GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // R16UI 131 {GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // R16UI
132 {GL_R16I, GL_RED_INTEGER, GL_SHORT, ComponentType::SInt, false}, // R16I 132 {GL_R16I, GL_RED_INTEGER, GL_SHORT, ComponentType::SInt, false}, // R16I
@@ -243,10 +243,10 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
243 // clang-format off 243 // clang-format off
244 MortonCopy<true, PixelFormat::ABGR8U>, 244 MortonCopy<true, PixelFormat::ABGR8U>,
245 MortonCopy<true, PixelFormat::ABGR8S>, 245 MortonCopy<true, PixelFormat::ABGR8S>,
246 MortonCopy<true, PixelFormat::B5G6R5>, 246 MortonCopy<true, PixelFormat::B5G6R5U>,
247 MortonCopy<true, PixelFormat::A2B10G10R10>, 247 MortonCopy<true, PixelFormat::A2B10G10R10U>,
248 MortonCopy<true, PixelFormat::A1B5G5R5>, 248 MortonCopy<true, PixelFormat::A1B5G5R5U>,
249 MortonCopy<true, PixelFormat::R8>, 249 MortonCopy<true, PixelFormat::R8U>,
250 MortonCopy<true, PixelFormat::R8UI>, 250 MortonCopy<true, PixelFormat::R8UI>,
251 MortonCopy<true, PixelFormat::RGBA16F>, 251 MortonCopy<true, PixelFormat::RGBA16F>,
252 MortonCopy<true, PixelFormat::RGBA16U>, 252 MortonCopy<true, PixelFormat::RGBA16U>,
@@ -268,7 +268,7 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
268 MortonCopy<true, PixelFormat::RG32F>, 268 MortonCopy<true, PixelFormat::RG32F>,
269 MortonCopy<true, PixelFormat::R32F>, 269 MortonCopy<true, PixelFormat::R32F>,
270 MortonCopy<true, PixelFormat::R16F>, 270 MortonCopy<true, PixelFormat::R16F>,
271 MortonCopy<true, PixelFormat::R16UNORM>, 271 MortonCopy<true, PixelFormat::R16U>,
272 MortonCopy<true, PixelFormat::R16S>, 272 MortonCopy<true, PixelFormat::R16S>,
273 MortonCopy<true, PixelFormat::R16UI>, 273 MortonCopy<true, PixelFormat::R16UI>,
274 MortonCopy<true, PixelFormat::R16I>, 274 MortonCopy<true, PixelFormat::R16I>,
@@ -297,10 +297,10 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
297 // clang-format off 297 // clang-format off
298 MortonCopy<false, PixelFormat::ABGR8U>, 298 MortonCopy<false, PixelFormat::ABGR8U>,
299 MortonCopy<false, PixelFormat::ABGR8S>, 299 MortonCopy<false, PixelFormat::ABGR8S>,
300 MortonCopy<false, PixelFormat::B5G6R5>, 300 MortonCopy<false, PixelFormat::B5G6R5U>,
301 MortonCopy<false, PixelFormat::A2B10G10R10>, 301 MortonCopy<false, PixelFormat::A2B10G10R10U>,
302 MortonCopy<false, PixelFormat::A1B5G5R5>, 302 MortonCopy<false, PixelFormat::A1B5G5R5U>,
303 MortonCopy<false, PixelFormat::R8>, 303 MortonCopy<false, PixelFormat::R8U>,
304 MortonCopy<false, PixelFormat::R8UI>, 304 MortonCopy<false, PixelFormat::R8UI>,
305 MortonCopy<false, PixelFormat::RGBA16F>, 305 MortonCopy<false, PixelFormat::RGBA16F>,
306 MortonCopy<false, PixelFormat::RGBA16U>, 306 MortonCopy<false, PixelFormat::RGBA16U>,
@@ -324,7 +324,7 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
324 MortonCopy<false, PixelFormat::RG32F>, 324 MortonCopy<false, PixelFormat::RG32F>,
325 MortonCopy<false, PixelFormat::R32F>, 325 MortonCopy<false, PixelFormat::R32F>,
326 MortonCopy<false, PixelFormat::R16F>, 326 MortonCopy<false, PixelFormat::R16F>,
327 MortonCopy<false, PixelFormat::R16UNORM>, 327 MortonCopy<false, PixelFormat::R16U>,
328 MortonCopy<false, PixelFormat::R16S>, 328 MortonCopy<false, PixelFormat::R16S>,
329 MortonCopy<false, PixelFormat::R16UI>, 329 MortonCopy<false, PixelFormat::R16UI>,
330 MortonCopy<false, PixelFormat::R16I>, 330 MortonCopy<false, PixelFormat::R16I>,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index dbacb7f3d..55cf3782c 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -25,10 +25,10 @@ struct SurfaceParams {
25 enum class PixelFormat { 25 enum class PixelFormat {
26 ABGR8U = 0, 26 ABGR8U = 0,
27 ABGR8S = 1, 27 ABGR8S = 1,
28 B5G6R5 = 2, 28 B5G6R5U = 2,
29 A2B10G10R10 = 3, 29 A2B10G10R10U = 3,
30 A1B5G5R5 = 4, 30 A1B5G5R5U = 4,
31 R8 = 5, 31 R8U = 5,
32 R8UI = 6, 32 R8UI = 6,
33 RGBA16F = 7, 33 RGBA16F = 7,
34 RGBA16U = 8, 34 RGBA16U = 8,
@@ -50,7 +50,7 @@ struct SurfaceParams {
50 RG32F = 24, 50 RG32F = 24,
51 R32F = 25, 51 R32F = 25,
52 R16F = 26, 52 R16F = 26,
53 R16UNORM = 27, 53 R16U = 27,
54 R16S = 28, 54 R16S = 28,
55 R16UI = 29, 55 R16UI = 29,
56 R16I = 30, 56 R16I = 30,
@@ -113,10 +113,10 @@ struct SurfaceParams {
113 constexpr std::array<u32, MaxPixelFormat> compression_factor_table = {{ 113 constexpr std::array<u32, MaxPixelFormat> compression_factor_table = {{
114 1, // ABGR8U 114 1, // ABGR8U
115 1, // ABGR8S 115 1, // ABGR8S
116 1, // B5G6R5 116 1, // B5G6R5U
117 1, // A2B10G10R10 117 1, // A2B10G10R10U
118 1, // A1B5G5R5 118 1, // A1B5G5R5U
119 1, // R8 119 1, // R8U
120 1, // R8UI 120 1, // R8UI
121 1, // RGBA16F 121 1, // RGBA16F
122 1, // RGBA16U 122 1, // RGBA16U
@@ -138,7 +138,7 @@ struct SurfaceParams {
138 1, // RG32F 138 1, // RG32F
139 1, // R32F 139 1, // R32F
140 1, // R16F 140 1, // R16F
141 1, // R16UNORM 141 1, // R16U
142 1, // R16S 142 1, // R16S
143 1, // R16UI 143 1, // R16UI
144 1, // R16I 144 1, // R16I
@@ -171,10 +171,10 @@ struct SurfaceParams {
171 constexpr std::array<u32, MaxPixelFormat> bpp_table = {{ 171 constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
172 32, // ABGR8U 172 32, // ABGR8U
173 32, // ABGR8S 173 32, // ABGR8S
174 16, // B5G6R5 174 16, // B5G6R5U
175 32, // A2B10G10R10 175 32, // A2B10G10R10U
176 16, // A1B5G5R5 176 16, // A1B5G5R5U
177 8, // R8 177 8, // R8U
178 8, // R8UI 178 8, // R8UI
179 64, // RGBA16F 179 64, // RGBA16F
180 64, // RGBA16U 180 64, // RGBA16U
@@ -196,7 +196,7 @@ struct SurfaceParams {
196 64, // RG32F 196 64, // RG32F
197 32, // R32F 197 32, // R32F
198 16, // R16F 198 16, // R16F
199 16, // R16UNORM 199 16, // R16U
200 16, // R16S 200 16, // R16S
201 16, // R16UI 201 16, // R16UI
202 16, // R16I 202 16, // R16I
@@ -256,7 +256,7 @@ struct SurfaceParams {
256 case Tegra::RenderTargetFormat::BGRA8_UNORM: 256 case Tegra::RenderTargetFormat::BGRA8_UNORM:
257 return PixelFormat::BGRA8; 257 return PixelFormat::BGRA8;
258 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 258 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
259 return PixelFormat::A2B10G10R10; 259 return PixelFormat::A2B10G10R10U;
260 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 260 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
261 return PixelFormat::RGBA16F; 261 return PixelFormat::RGBA16F;
262 case Tegra::RenderTargetFormat::RGBA16_UNORM: 262 case Tegra::RenderTargetFormat::RGBA16_UNORM:
@@ -270,11 +270,11 @@ struct SurfaceParams {
270 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 270 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
271 return PixelFormat::R11FG11FB10F; 271 return PixelFormat::R11FG11FB10F;
272 case Tegra::RenderTargetFormat::B5G6R5_UNORM: 272 case Tegra::RenderTargetFormat::B5G6R5_UNORM:
273 return PixelFormat::B5G6R5; 273 return PixelFormat::B5G6R5U;
274 case Tegra::RenderTargetFormat::RGBA32_UINT: 274 case Tegra::RenderTargetFormat::RGBA32_UINT:
275 return PixelFormat::RGBA32UI; 275 return PixelFormat::RGBA32UI;
276 case Tegra::RenderTargetFormat::R8_UNORM: 276 case Tegra::RenderTargetFormat::R8_UNORM:
277 return PixelFormat::R8; 277 return PixelFormat::R8U;
278 case Tegra::RenderTargetFormat::R8_UINT: 278 case Tegra::RenderTargetFormat::R8_UINT:
279 return PixelFormat::R8UI; 279 return PixelFormat::R8UI;
280 case Tegra::RenderTargetFormat::RG16_FLOAT: 280 case Tegra::RenderTargetFormat::RG16_FLOAT:
@@ -294,7 +294,7 @@ struct SurfaceParams {
294 case Tegra::RenderTargetFormat::R16_FLOAT: 294 case Tegra::RenderTargetFormat::R16_FLOAT:
295 return PixelFormat::R16F; 295 return PixelFormat::R16F;
296 case Tegra::RenderTargetFormat::R16_UNORM: 296 case Tegra::RenderTargetFormat::R16_UNORM:
297 return PixelFormat::R16UNORM; 297 return PixelFormat::R16U;
298 case Tegra::RenderTargetFormat::R16_SNORM: 298 case Tegra::RenderTargetFormat::R16_SNORM:
299 return PixelFormat::R16S; 299 return PixelFormat::R16S;
300 case Tegra::RenderTargetFormat::R16_UINT: 300 case Tegra::RenderTargetFormat::R16_UINT:
@@ -328,15 +328,33 @@ struct SurfaceParams {
328 static_cast<u32>(component_type)); 328 static_cast<u32>(component_type));
329 UNREACHABLE(); 329 UNREACHABLE();
330 case Tegra::Texture::TextureFormat::B5G6R5: 330 case Tegra::Texture::TextureFormat::B5G6R5:
331 return PixelFormat::B5G6R5; 331 switch (component_type) {
332 case Tegra::Texture::ComponentType::UNORM:
333 return PixelFormat::B5G6R5U;
334 }
335 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
336 static_cast<u32>(component_type));
337 UNREACHABLE();
332 case Tegra::Texture::TextureFormat::A2B10G10R10: 338 case Tegra::Texture::TextureFormat::A2B10G10R10:
333 return PixelFormat::A2B10G10R10; 339 switch (component_type) {
340 case Tegra::Texture::ComponentType::UNORM:
341 return PixelFormat::A2B10G10R10U;
342 }
343 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
344 static_cast<u32>(component_type));
345 UNREACHABLE();
334 case Tegra::Texture::TextureFormat::A1B5G5R5: 346 case Tegra::Texture::TextureFormat::A1B5G5R5:
335 return PixelFormat::A1B5G5R5; 347 switch (component_type) {
348 case Tegra::Texture::ComponentType::UNORM:
349 return PixelFormat::A1B5G5R5U;
350 }
351 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
352 static_cast<u32>(component_type));
353 UNREACHABLE();
336 case Tegra::Texture::TextureFormat::R8: 354 case Tegra::Texture::TextureFormat::R8:
337 switch (component_type) { 355 switch (component_type) {
338 case Tegra::Texture::ComponentType::UNORM: 356 case Tegra::Texture::ComponentType::UNORM:
339 return PixelFormat::R8; 357 return PixelFormat::R8U;
340 case Tegra::Texture::ComponentType::UINT: 358 case Tegra::Texture::ComponentType::UINT:
341 return PixelFormat::R8UI; 359 return PixelFormat::R8UI;
342 } 360 }
@@ -364,7 +382,13 @@ struct SurfaceParams {
364 static_cast<u32>(component_type)); 382 static_cast<u32>(component_type));
365 UNREACHABLE(); 383 UNREACHABLE();
366 case Tegra::Texture::TextureFormat::BF10GF11RF11: 384 case Tegra::Texture::TextureFormat::BF10GF11RF11:
367 return PixelFormat::R11FG11FB10F; 385 switch (component_type) {
386 case Tegra::Texture::ComponentType::FLOAT:
387 return PixelFormat::R11FG11FB10F;
388 }
389 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
390 static_cast<u32>(component_type));
391 UNREACHABLE();
368 case Tegra::Texture::TextureFormat::R32_G32_B32_A32: 392 case Tegra::Texture::TextureFormat::R32_G32_B32_A32:
369 switch (component_type) { 393 switch (component_type) {
370 case Tegra::Texture::ComponentType::FLOAT: 394 case Tegra::Texture::ComponentType::FLOAT:
@@ -386,13 +410,19 @@ struct SurfaceParams {
386 static_cast<u32>(component_type)); 410 static_cast<u32>(component_type));
387 UNREACHABLE(); 411 UNREACHABLE();
388 case Tegra::Texture::TextureFormat::R32_G32_B32: 412 case Tegra::Texture::TextureFormat::R32_G32_B32:
389 return PixelFormat::RGB32F; 413 switch (component_type) {
414 case Tegra::Texture::ComponentType::FLOAT:
415 return PixelFormat::RGB32F;
416 }
417 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
418 static_cast<u32>(component_type));
419 UNREACHABLE();
390 case Tegra::Texture::TextureFormat::R16: 420 case Tegra::Texture::TextureFormat::R16:
391 switch (component_type) { 421 switch (component_type) {
392 case Tegra::Texture::ComponentType::FLOAT: 422 case Tegra::Texture::ComponentType::FLOAT:
393 return PixelFormat::R16F; 423 return PixelFormat::R16F;
394 case Tegra::Texture::ComponentType::UNORM: 424 case Tegra::Texture::ComponentType::UNORM:
395 return PixelFormat::R16UNORM; 425 return PixelFormat::R16U;
396 case Tegra::Texture::ComponentType::SNORM: 426 case Tegra::Texture::ComponentType::SNORM:
397 return PixelFormat::R16S; 427 return PixelFormat::R16S;
398 case Tegra::Texture::ComponentType::UINT: 428 case Tegra::Texture::ComponentType::UINT: