diff options
| -rw-r--r-- | src/video_core/gpu.cpp | 32 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 21 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 51 |
4 files changed, 92 insertions, 19 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 4ff4d71c5..b90937d17 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -34,19 +34,51 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { | |||
| 34 | 34 | ||
| 35 | switch (format) { | 35 | switch (format) { |
| 36 | case RenderTargetFormat::RGBA32_FLOAT: | 36 | case RenderTargetFormat::RGBA32_FLOAT: |
| 37 | case RenderTargetFormat::RGBA32_UINT: | ||
| 37 | return 16; | 38 | return 16; |
| 38 | case RenderTargetFormat::RGBA16_FLOAT: | 39 | case RenderTargetFormat::RGBA16_FLOAT: |
| 39 | case RenderTargetFormat::RG32_FLOAT: | 40 | case RenderTargetFormat::RG32_FLOAT: |
| 40 | return 8; | 41 | return 8; |
| 41 | case RenderTargetFormat::RGBA8_UNORM: | 42 | case RenderTargetFormat::RGBA8_UNORM: |
| 43 | case RenderTargetFormat::RGBA8_SRGB: | ||
| 42 | case RenderTargetFormat::RGB10_A2_UNORM: | 44 | case RenderTargetFormat::RGB10_A2_UNORM: |
| 43 | case RenderTargetFormat::BGRA8_UNORM: | 45 | case RenderTargetFormat::BGRA8_UNORM: |
| 46 | case RenderTargetFormat::RG16_UNORM: | ||
| 47 | case RenderTargetFormat::RG16_SNORM: | ||
| 48 | case RenderTargetFormat::RG16_UINT: | ||
| 49 | case RenderTargetFormat::RG16_SINT: | ||
| 50 | case RenderTargetFormat::RG16_FLOAT: | ||
| 44 | case RenderTargetFormat::R32_FLOAT: | 51 | case RenderTargetFormat::R32_FLOAT: |
| 45 | case RenderTargetFormat::R11G11B10_FLOAT: | 52 | case RenderTargetFormat::R11G11B10_FLOAT: |
| 46 | return 4; | 53 | return 4; |
| 54 | case RenderTargetFormat::R16_UNORM: | ||
| 55 | case RenderTargetFormat::R16_SNORM: | ||
| 56 | case RenderTargetFormat::R16_UINT: | ||
| 57 | case RenderTargetFormat::R16_SINT: | ||
| 58 | case RenderTargetFormat::R16_FLOAT: | ||
| 59 | return 2; | ||
| 60 | case RenderTargetFormat::R8_UNORM: | ||
| 61 | return 1; | ||
| 47 | default: | 62 | default: |
| 48 | UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); | 63 | UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); |
| 49 | } | 64 | } |
| 50 | } | 65 | } |
| 51 | 66 | ||
| 67 | u32 DepthFormatBytesPerPixel(DepthFormat format) { | ||
| 68 | switch (format) { | ||
| 69 | case DepthFormat::Z32_S8_X24_FLOAT: | ||
| 70 | return 8; | ||
| 71 | case DepthFormat::Z32_FLOAT: | ||
| 72 | case DepthFormat::S8_Z24_UNORM: | ||
| 73 | case DepthFormat::Z24_X8_UNORM: | ||
| 74 | case DepthFormat::Z24_S8_UNORM: | ||
| 75 | case DepthFormat::Z24_C8_UNORM: | ||
| 76 | return 4; | ||
| 77 | case DepthFormat::Z16_UNORM: | ||
| 78 | return 2; | ||
| 79 | default: | ||
| 80 | UNIMPLEMENTED_MSG("Unimplemented Depth format {}", static_cast<u32>(format)); | ||
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 52 | } // namespace Tegra | 84 | } // namespace Tegra |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 874eddd78..0164c747a 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -35,6 +35,10 @@ enum class RenderTargetFormat : u32 { | |||
| 35 | R11G11B10_FLOAT = 0xE0, | 35 | R11G11B10_FLOAT = 0xE0, |
| 36 | R32_FLOAT = 0xE5, | 36 | R32_FLOAT = 0xE5, |
| 37 | B5G6R5_UNORM = 0xE8, | 37 | B5G6R5_UNORM = 0xE8, |
| 38 | R16_UNORM = 0xEE, | ||
| 39 | R16_SNORM = 0xEF, | ||
| 40 | R16_SINT = 0xF0, | ||
| 41 | R16_UINT = 0xF1, | ||
| 38 | R16_FLOAT = 0xF2, | 42 | R16_FLOAT = 0xF2, |
| 39 | R8_UNORM = 0xF3, | 43 | R8_UNORM = 0xF3, |
| 40 | }; | 44 | }; |
| @@ -52,6 +56,9 @@ enum class DepthFormat : u32 { | |||
| 52 | /// Returns the number of bytes per pixel of each rendertarget format. | 56 | /// Returns the number of bytes per pixel of each rendertarget format. |
| 53 | u32 RenderTargetBytesPerPixel(RenderTargetFormat format); | 57 | u32 RenderTargetBytesPerPixel(RenderTargetFormat format); |
| 54 | 58 | ||
| 59 | /// Returns the number of bytes per pixel of each depth format. | ||
| 60 | u32 DepthFormatBytesPerPixel(DepthFormat format); | ||
| 61 | |||
| 55 | class DebugContext; | 62 | class DebugContext; |
| 56 | 63 | ||
| 57 | /** | 64 | /** |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 9fb734b77..15a33ed9b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -122,6 +122,9 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 122 | {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F | 122 | {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F |
| 123 | {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F | 123 | {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F |
| 124 | {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM | 124 | {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM |
| 125 | {GL_R16_SNORM, GL_RED, GL_SHORT, ComponentType::SNorm, false}, // R16S | ||
| 126 | {GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // R16UI | ||
| 127 | {GL_R16I, GL_RED_INTEGER, GL_SHORT, ComponentType::SInt, false}, // R16I | ||
| 125 | {GL_RG16, GL_RG, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // RG16 | 128 | {GL_RG16, GL_RG, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // RG16 |
| 126 | {GL_RG16F, GL_RG, GL_HALF_FLOAT, ComponentType::Float, false}, // RG16F | 129 | {GL_RG16F, GL_RG, GL_HALF_FLOAT, ComponentType::Float, false}, // RG16F |
| 127 | {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI | 130 | {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI |
| @@ -239,13 +242,14 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU | |||
| 239 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, | 242 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, |
| 240 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, | 243 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, |
| 241 | MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, | 244 | MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, |
| 242 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>, | 245 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::R16S>, |
| 243 | MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, | 246 | MortonCopy<true, PixelFormat::R16UI>, MortonCopy<true, PixelFormat::R16I>, |
| 244 | MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, | 247 | MortonCopy<true, PixelFormat::RG16>, MortonCopy<true, PixelFormat::RG16F>, |
| 245 | MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>, | 248 | MortonCopy<true, PixelFormat::RG16UI>, MortonCopy<true, PixelFormat::RG16I>, |
| 246 | MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, | 249 | MortonCopy<true, PixelFormat::RG16S>, MortonCopy<true, PixelFormat::RGB32F>, |
| 247 | MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, | 250 | MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::Z24S8>, |
| 248 | MortonCopy<true, PixelFormat::Z32FS8>, | 251 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, |
| 252 | MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>, | ||
| 249 | }; | 253 | }; |
| 250 | 254 | ||
| 251 | static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), | 255 | static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), |
| @@ -276,6 +280,9 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU | |||
| 276 | MortonCopy<false, PixelFormat::R32F>, | 280 | MortonCopy<false, PixelFormat::R32F>, |
| 277 | MortonCopy<false, PixelFormat::R16F>, | 281 | MortonCopy<false, PixelFormat::R16F>, |
| 278 | MortonCopy<false, PixelFormat::R16UNORM>, | 282 | MortonCopy<false, PixelFormat::R16UNORM>, |
| 283 | MortonCopy<false, PixelFormat::R16S>, | ||
| 284 | MortonCopy<false, PixelFormat::R16UI>, | ||
| 285 | MortonCopy<false, PixelFormat::R16I>, | ||
| 279 | MortonCopy<false, PixelFormat::RG16>, | 286 | MortonCopy<false, PixelFormat::RG16>, |
| 280 | MortonCopy<false, PixelFormat::RG16F>, | 287 | MortonCopy<false, PixelFormat::RG16F>, |
| 281 | MortonCopy<false, PixelFormat::RG16UI>, | 288 | MortonCopy<false, PixelFormat::RG16UI>, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 829a76dfe..e24ba8cfe 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -46,22 +46,25 @@ struct SurfaceParams { | |||
| 46 | R32F = 20, | 46 | R32F = 20, |
| 47 | R16F = 21, | 47 | R16F = 21, |
| 48 | R16UNORM = 22, | 48 | R16UNORM = 22, |
| 49 | RG16 = 23, | 49 | R16S = 23, |
| 50 | RG16F = 24, | 50 | R16UI = 24, |
| 51 | RG16UI = 25, | 51 | R16I = 25, |
| 52 | RG16I = 26, | 52 | RG16 = 26, |
| 53 | RG16S = 27, | 53 | RG16F = 27, |
| 54 | RGB32F = 28, | 54 | RG16UI = 28, |
| 55 | SRGBA8 = 29, | 55 | RG16I = 29, |
| 56 | RG16S = 30, | ||
| 57 | RGB32F = 31, | ||
| 58 | SRGBA8 = 32, | ||
| 56 | 59 | ||
| 57 | MaxColorFormat, | 60 | MaxColorFormat, |
| 58 | 61 | ||
| 59 | // DepthStencil formats | 62 | // DepthStencil formats |
| 60 | Z24S8 = 30, | 63 | Z24S8 = 33, |
| 61 | S8Z24 = 31, | 64 | S8Z24 = 34, |
| 62 | Z32F = 32, | 65 | Z32F = 35, |
| 63 | Z16 = 33, | 66 | Z16 = 36, |
| 64 | Z32FS8 = 34, | 67 | Z32FS8 = 37, |
| 65 | 68 | ||
| 66 | MaxDepthStencilFormat, | 69 | MaxDepthStencilFormat, |
| 67 | 70 | ||
| @@ -122,6 +125,9 @@ struct SurfaceParams { | |||
| 122 | 1, // R32F | 125 | 1, // R32F |
| 123 | 1, // R16F | 126 | 1, // R16F |
| 124 | 1, // R16UNORM | 127 | 1, // R16UNORM |
| 128 | 1, // R16S | ||
| 129 | 1, // R16UI | ||
| 130 | 1, // R16I | ||
| 125 | 1, // RG16 | 131 | 1, // RG16 |
| 126 | 1, // RG16F | 132 | 1, // RG16F |
| 127 | 1, // RG16UI | 133 | 1, // RG16UI |
| @@ -168,6 +174,9 @@ struct SurfaceParams { | |||
| 168 | 32, // R32F | 174 | 32, // R32F |
| 169 | 16, // R16F | 175 | 16, // R16F |
| 170 | 16, // R16UNORM | 176 | 16, // R16UNORM |
| 177 | 16, // R16S | ||
| 178 | 16, // R16UI | ||
| 179 | 16, // R16I | ||
| 171 | 32, // RG16 | 180 | 32, // RG16 |
| 172 | 32, // RG16F | 181 | 32, // RG16F |
| 173 | 32, // RG16UI | 182 | 32, // RG16UI |
| @@ -245,6 +254,14 @@ struct SurfaceParams { | |||
| 245 | return PixelFormat::RG16S; | 254 | return PixelFormat::RG16S; |
| 246 | case Tegra::RenderTargetFormat::R16_FLOAT: | 255 | case Tegra::RenderTargetFormat::R16_FLOAT: |
| 247 | return PixelFormat::R16F; | 256 | return PixelFormat::R16F; |
| 257 | case Tegra::RenderTargetFormat::R16_UNORM: | ||
| 258 | return PixelFormat::R16UNORM; | ||
| 259 | case Tegra::RenderTargetFormat::R16_SNORM: | ||
| 260 | return PixelFormat::R16S; | ||
| 261 | case Tegra::RenderTargetFormat::R16_UINT: | ||
| 262 | return PixelFormat::R16UI; | ||
| 263 | case Tegra::RenderTargetFormat::R16_SINT: | ||
| 264 | return PixelFormat::R16I; | ||
| 248 | case Tegra::RenderTargetFormat::R32_FLOAT: | 265 | case Tegra::RenderTargetFormat::R32_FLOAT: |
| 249 | return PixelFormat::R32F; | 266 | return PixelFormat::R32F; |
| 250 | default: | 267 | default: |
| @@ -293,6 +310,12 @@ struct SurfaceParams { | |||
| 293 | return PixelFormat::R16F; | 310 | return PixelFormat::R16F; |
| 294 | case Tegra::Texture::ComponentType::UNORM: | 311 | case Tegra::Texture::ComponentType::UNORM: |
| 295 | return PixelFormat::R16UNORM; | 312 | return PixelFormat::R16UNORM; |
| 313 | case Tegra::Texture::ComponentType::SNORM: | ||
| 314 | return PixelFormat::R16S; | ||
| 315 | case Tegra::Texture::ComponentType::UINT: | ||
| 316 | return PixelFormat::R16UI; | ||
| 317 | case Tegra::Texture::ComponentType::SINT: | ||
| 318 | return PixelFormat::R16I; | ||
| 296 | } | 319 | } |
| 297 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", | 320 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", |
| 298 | static_cast<u32>(component_type)); | 321 | static_cast<u32>(component_type)); |
| @@ -376,9 +399,11 @@ struct SurfaceParams { | |||
| 376 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: | 399 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: |
| 377 | case Tegra::RenderTargetFormat::R8_UNORM: | 400 | case Tegra::RenderTargetFormat::R8_UNORM: |
| 378 | case Tegra::RenderTargetFormat::RG16_UNORM: | 401 | case Tegra::RenderTargetFormat::RG16_UNORM: |
| 402 | case Tegra::RenderTargetFormat::R16_UNORM: | ||
| 379 | case Tegra::RenderTargetFormat::B5G6R5_UNORM: | 403 | case Tegra::RenderTargetFormat::B5G6R5_UNORM: |
| 380 | return ComponentType::UNorm; | 404 | return ComponentType::UNorm; |
| 381 | case Tegra::RenderTargetFormat::RG16_SNORM: | 405 | case Tegra::RenderTargetFormat::RG16_SNORM: |
| 406 | case Tegra::RenderTargetFormat::R16_SNORM: | ||
| 382 | return ComponentType::SNorm; | 407 | return ComponentType::SNorm; |
| 383 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: | 408 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: |
| 384 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 409 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: |
| @@ -390,8 +415,10 @@ struct SurfaceParams { | |||
| 390 | return ComponentType::Float; | 415 | return ComponentType::Float; |
| 391 | case Tegra::RenderTargetFormat::RGBA32_UINT: | 416 | case Tegra::RenderTargetFormat::RGBA32_UINT: |
| 392 | case Tegra::RenderTargetFormat::RG16_UINT: | 417 | case Tegra::RenderTargetFormat::RG16_UINT: |
| 418 | case Tegra::RenderTargetFormat::R16_UINT: | ||
| 393 | return ComponentType::UInt; | 419 | return ComponentType::UInt; |
| 394 | case Tegra::RenderTargetFormat::RG16_SINT: | 420 | case Tegra::RenderTargetFormat::RG16_SINT: |
| 421 | case Tegra::RenderTargetFormat::R16_SINT: | ||
| 395 | return ComponentType::SInt; | 422 | return ComponentType::SInt; |
| 396 | default: | 423 | default: |
| 397 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 424 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |