summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2018-08-13 12:31:39 -0400
committerGravatar GitHub2018-08-13 12:31:39 -0400
commit46fbf6dd92f37866f6ff58ec9d7d705d2a25cbab (patch)
tree34b7eaf166c5650bc633d1cf45b2bf59a1d48d5e
parentMerge pull request #1033 from MerryMage/interp (diff)
parentImplement RG32UI and R32UI (diff)
downloadyuzu-46fbf6dd92f37866f6ff58ec9d7d705d2a25cbab.tar.gz
yuzu-46fbf6dd92f37866f6ff58ec9d7d705d2a25cbab.tar.xz
yuzu-46fbf6dd92f37866f6ff58ec9d7d705d2a25cbab.zip
Merge pull request #1052 from ogniK5377/xeno
Implement RG32UI and R32UI
-rw-r--r--src/video_core/gpu.cpp2
-rw-r--r--src/video_core/gpu.h2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h42
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) {
49 case RenderTargetFormat::RGBA16_UINT: 49 case RenderTargetFormat::RGBA16_UINT:
50 case RenderTargetFormat::RGBA16_FLOAT: 50 case RenderTargetFormat::RGBA16_FLOAT:
51 case RenderTargetFormat::RG32_FLOAT: 51 case RenderTargetFormat::RG32_FLOAT:
52 case RenderTargetFormat::RG32_UINT:
52 return 8; 53 return 8;
53 case RenderTargetFormat::RGBA8_UNORM: 54 case RenderTargetFormat::RGBA8_UNORM:
54 case RenderTargetFormat::RGBA8_SNORM: 55 case RenderTargetFormat::RGBA8_SNORM:
@@ -62,6 +63,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
62 case RenderTargetFormat::RG16_FLOAT: 63 case RenderTargetFormat::RG16_FLOAT:
63 case RenderTargetFormat::R32_FLOAT: 64 case RenderTargetFormat::R32_FLOAT:
64 case RenderTargetFormat::R11G11B10_FLOAT: 65 case RenderTargetFormat::R11G11B10_FLOAT:
66 case RenderTargetFormat::R32_UINT:
65 return 4; 67 return 4;
66 case RenderTargetFormat::R16_UNORM: 68 case RenderTargetFormat::R16_UNORM:
67 case RenderTargetFormat::R16_SNORM: 69 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 {
23 RGBA16_UINT = 0xC9, 23 RGBA16_UINT = 0xC9,
24 RGBA16_FLOAT = 0xCA, 24 RGBA16_FLOAT = 0xCA,
25 RG32_FLOAT = 0xCB, 25 RG32_FLOAT = 0xCB,
26 RG32_UINT = 0xCD,
26 BGRA8_UNORM = 0xCF, 27 BGRA8_UNORM = 0xCF,
27 RGB10_A2_UNORM = 0xD1, 28 RGB10_A2_UNORM = 0xD1,
28 RGBA8_UNORM = 0xD5, 29 RGBA8_UNORM = 0xD5,
@@ -34,6 +35,7 @@ enum class RenderTargetFormat : u32 {
34 RG16_UINT = 0xDD, 35 RG16_UINT = 0xDD,
35 RG16_FLOAT = 0xDE, 36 RG16_FLOAT = 0xDE,
36 R11G11B10_FLOAT = 0xE0, 37 R11G11B10_FLOAT = 0xE0,
38 R32_UINT = 0xE4,
37 R32_FLOAT = 0xE5, 39 R32_FLOAT = 0xE5,
38 B5G6R5_UNORM = 0xE8, 40 B5G6R5_UNORM = 0xE8,
39 RG8_UNORM = 0xEA, 41 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
137 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8 137 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8
138 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // RG8U 138 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // RG8U
139 {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S 139 {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S
140 {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RG32UI
141 {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // R32UI
140 142
141 // DepthStencil formats 143 // DepthStencil formats
142 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 144 {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
275 MortonCopy<true, PixelFormat::SRGBA8>, 277 MortonCopy<true, PixelFormat::SRGBA8>,
276 MortonCopy<true, PixelFormat::RG8U>, 278 MortonCopy<true, PixelFormat::RG8U>,
277 MortonCopy<true, PixelFormat::RG8S>, 279 MortonCopy<true, PixelFormat::RG8S>,
280 MortonCopy<true, PixelFormat::RG32UI>,
281 MortonCopy<true, PixelFormat::R32UI>,
278 MortonCopy<true, PixelFormat::Z24S8>, 282 MortonCopy<true, PixelFormat::Z24S8>,
279 MortonCopy<true, PixelFormat::S8Z24>, 283 MortonCopy<true, PixelFormat::S8Z24>,
280 MortonCopy<true, PixelFormat::Z32F>, 284 MortonCopy<true, PixelFormat::Z32F>,
@@ -327,6 +331,8 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
327 MortonCopy<false, PixelFormat::SRGBA8>, 331 MortonCopy<false, PixelFormat::SRGBA8>,
328 MortonCopy<false, PixelFormat::RG8U>, 332 MortonCopy<false, PixelFormat::RG8U>,
329 MortonCopy<false, PixelFormat::RG8S>, 333 MortonCopy<false, PixelFormat::RG8S>,
334 MortonCopy<false, PixelFormat::RG32UI>,
335 MortonCopy<false, PixelFormat::R32UI>,
330 MortonCopy<false, PixelFormat::Z24S8>, 336 MortonCopy<false, PixelFormat::Z24S8>,
331 MortonCopy<false, PixelFormat::S8Z24>, 337 MortonCopy<false, PixelFormat::S8Z24>,
332 MortonCopy<false, PixelFormat::Z32F>, 338 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 {
61 SRGBA8 = 35, 61 SRGBA8 = 35,
62 RG8U = 36, 62 RG8U = 36,
63 RG8S = 37, 63 RG8S = 37,
64 RG32UI = 38,
65 R32UI = 39,
64 66
65 MaxColorFormat, 67 MaxColorFormat,
66 68
67 // DepthStencil formats 69 // DepthStencil formats
68 Z24S8 = 38, 70 Z24S8 = 40,
69 S8Z24 = 39, 71 S8Z24 = 41,
70 Z32F = 40, 72 Z32F = 42,
71 Z16 = 41, 73 Z16 = 43,
72 Z32FS8 = 42, 74 Z32FS8 = 44,
73 75
74 MaxDepthStencilFormat, 76 MaxDepthStencilFormat,
75 77
@@ -145,6 +147,8 @@ struct SurfaceParams {
145 1, // SRGBA8 147 1, // SRGBA8
146 1, // RG8U 148 1, // RG8U
147 1, // RG8S 149 1, // RG8S
150 1, // RG32UI
151 1, // R32UI
148 1, // Z24S8 152 1, // Z24S8
149 1, // S8Z24 153 1, // S8Z24
150 1, // Z32F 154 1, // Z32F
@@ -199,6 +203,8 @@ struct SurfaceParams {
199 32, // SRGBA8 203 32, // SRGBA8
200 16, // RG8U 204 16, // RG8U
201 16, // RG8S 205 16, // RG8S
206 64, // RG32UI
207 32, // R32UI
202 32, // Z24S8 208 32, // Z24S8
203 32, // S8Z24 209 32, // S8Z24
204 32, // Z32F 210 32, // Z32F
@@ -289,6 +295,10 @@ struct SurfaceParams {
289 return PixelFormat::R16I; 295 return PixelFormat::R16I;
290 case Tegra::RenderTargetFormat::R32_FLOAT: 296 case Tegra::RenderTargetFormat::R32_FLOAT:
291 return PixelFormat::R32F; 297 return PixelFormat::R32F;
298 case Tegra::RenderTargetFormat::R32_UINT:
299 return PixelFormat::R32UI;
300 case Tegra::RenderTargetFormat::RG32_UINT:
301 return PixelFormat::RG32UI;
292 default: 302 default:
293 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 303 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
294 UNREACHABLE(); 304 UNREACHABLE();
@@ -342,7 +352,15 @@ struct SurfaceParams {
342 static_cast<u32>(component_type)); 352 static_cast<u32>(component_type));
343 UNREACHABLE(); 353 UNREACHABLE();
344 case Tegra::Texture::TextureFormat::R32_G32: 354 case Tegra::Texture::TextureFormat::R32_G32:
345 return PixelFormat::RG32F; 355 switch (component_type) {
356 case Tegra::Texture::ComponentType::FLOAT:
357 return PixelFormat::RG32F;
358 case Tegra::Texture::ComponentType::UINT:
359 return PixelFormat::RG32UI;
360 }
361 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
362 static_cast<u32>(component_type));
363 UNREACHABLE();
346 case Tegra::Texture::TextureFormat::R32_G32_B32: 364 case Tegra::Texture::TextureFormat::R32_G32_B32:
347 return PixelFormat::RGB32F; 365 return PixelFormat::RGB32F;
348 case Tegra::Texture::TextureFormat::R16: 366 case Tegra::Texture::TextureFormat::R16:
@@ -362,7 +380,15 @@ struct SurfaceParams {
362 static_cast<u32>(component_type)); 380 static_cast<u32>(component_type));
363 UNREACHABLE(); 381 UNREACHABLE();
364 case Tegra::Texture::TextureFormat::R32: 382 case Tegra::Texture::TextureFormat::R32:
365 return PixelFormat::R32F; 383 switch (component_type) {
384 case Tegra::Texture::ComponentType::FLOAT:
385 return PixelFormat::R32F;
386 case Tegra::Texture::ComponentType::UINT:
387 return PixelFormat::R32UI;
388 }
389 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
390 static_cast<u32>(component_type));
391 UNREACHABLE();
366 case Tegra::Texture::TextureFormat::ZF32: 392 case Tegra::Texture::TextureFormat::ZF32:
367 return PixelFormat::Z32F; 393 return PixelFormat::Z32F;
368 case Tegra::Texture::TextureFormat::Z24S8: 394 case Tegra::Texture::TextureFormat::Z24S8:
@@ -462,6 +488,8 @@ struct SurfaceParams {
462 case Tegra::RenderTargetFormat::RG16_UINT: 488 case Tegra::RenderTargetFormat::RG16_UINT:
463 case Tegra::RenderTargetFormat::R8_UINT: 489 case Tegra::RenderTargetFormat::R8_UINT:
464 case Tegra::RenderTargetFormat::R16_UINT: 490 case Tegra::RenderTargetFormat::R16_UINT:
491 case Tegra::RenderTargetFormat::RG32_UINT:
492 case Tegra::RenderTargetFormat::R32_UINT:
465 return ComponentType::UInt; 493 return ComponentType::UInt;
466 case Tegra::RenderTargetFormat::RG16_SINT: 494 case Tegra::RenderTargetFormat::RG16_SINT:
467 case Tegra::RenderTargetFormat::R16_SINT: 495 case Tegra::RenderTargetFormat::R16_SINT: