diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/gpu.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 67 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 18 |
4 files changed, 61 insertions, 26 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 19e7f1161..9c73d7546 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -67,6 +67,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { | |||
| 67 | case RenderTargetFormat::R16_UINT: | 67 | case RenderTargetFormat::R16_UINT: |
| 68 | case RenderTargetFormat::R16_SINT: | 68 | case RenderTargetFormat::R16_SINT: |
| 69 | case RenderTargetFormat::R16_FLOAT: | 69 | case RenderTargetFormat::R16_FLOAT: |
| 70 | case RenderTargetFormat::RG8_UNORM: | ||
| 70 | case RenderTargetFormat::RG8_SNORM: | 71 | case RenderTargetFormat::RG8_SNORM: |
| 71 | return 2; | 72 | return 2; |
| 72 | case RenderTargetFormat::R8_UNORM: | 73 | case RenderTargetFormat::R8_UNORM: |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index e008d8f26..0b6521985 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -35,6 +35,7 @@ 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 | RG8_UNORM = 0xEA, | ||
| 38 | RG8_SNORM = 0xEB, | 39 | RG8_SNORM = 0xEB, |
| 39 | R16_UNORM = 0xEE, | 40 | R16_UNORM = 0xEE, |
| 40 | R16_SNORM = 0xEF, | 41 | R16_SNORM = 0xEF, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 84c250c63..a74ca3595 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -134,6 +134,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 134 | {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S | 134 | {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S |
| 135 | {GL_RGB32F, GL_RGB, GL_FLOAT, ComponentType::Float, false}, // RGB32F | 135 | {GL_RGB32F, GL_RGB, GL_FLOAT, ComponentType::Float, false}, // RGB32F |
| 136 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8 | 136 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8 |
| 137 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // RG8U | ||
| 137 | {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S | 138 | {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S |
| 138 | 139 | ||
| 139 | // DepthStencil formats | 140 | // DepthStencil formats |
| @@ -234,32 +235,56 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, std::vector<u8>& gl_bu | |||
| 234 | static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), | 235 | static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), |
| 235 | SurfaceParams::MaxPixelFormat> | 236 | SurfaceParams::MaxPixelFormat> |
| 236 | morton_to_gl_fns = { | 237 | morton_to_gl_fns = { |
| 237 | MortonCopy<true, PixelFormat::ABGR8U>, MortonCopy<true, PixelFormat::ABGR8S>, | 238 | // clang-format off |
| 238 | MortonCopy<true, PixelFormat::B5G6R5>, MortonCopy<true, PixelFormat::A2B10G10R10>, | 239 | MortonCopy<true, PixelFormat::ABGR8U>, |
| 239 | MortonCopy<true, PixelFormat::A1B5G5R5>, MortonCopy<true, PixelFormat::R8>, | 240 | MortonCopy<true, PixelFormat::ABGR8S>, |
| 240 | MortonCopy<true, PixelFormat::R8UI>, MortonCopy<true, PixelFormat::RGBA16F>, | 241 | MortonCopy<true, PixelFormat::B5G6R5>, |
| 241 | MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>, | 242 | MortonCopy<true, PixelFormat::A2B10G10R10>, |
| 242 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, | 243 | MortonCopy<true, PixelFormat::A1B5G5R5>, |
| 243 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, | 244 | MortonCopy<true, PixelFormat::R8>, |
| 244 | MortonCopy<true, PixelFormat::DXN2UNORM>, MortonCopy<true, PixelFormat::DXN2SNORM>, | 245 | MortonCopy<true, PixelFormat::R8UI>, |
| 245 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, | 246 | MortonCopy<true, PixelFormat::RGBA16F>, |
| 246 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, | 247 | MortonCopy<true, PixelFormat::R11FG11FB10F>, |
| 247 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, | 248 | MortonCopy<true, PixelFormat::RGBA32UI>, |
| 248 | MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, | 249 | MortonCopy<true, PixelFormat::DXT1>, |
| 249 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::R16S>, | 250 | MortonCopy<true, PixelFormat::DXT23>, |
| 250 | MortonCopy<true, PixelFormat::R16UI>, MortonCopy<true, PixelFormat::R16I>, | 251 | MortonCopy<true, PixelFormat::DXT45>, |
| 251 | MortonCopy<true, PixelFormat::RG16>, MortonCopy<true, PixelFormat::RG16F>, | 252 | MortonCopy<true, PixelFormat::DXN1>, |
| 252 | MortonCopy<true, PixelFormat::RG16UI>, MortonCopy<true, PixelFormat::RG16I>, | 253 | MortonCopy<true, PixelFormat::DXN2UNORM>, |
| 253 | MortonCopy<true, PixelFormat::RG16S>, MortonCopy<true, PixelFormat::RGB32F>, | 254 | MortonCopy<true, PixelFormat::DXN2SNORM>, |
| 254 | MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::RG8S>, | 255 | MortonCopy<true, PixelFormat::BC7U>, |
| 255 | MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, | 256 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, |
| 256 | MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, | 257 | MortonCopy<true, PixelFormat::G8R8>, |
| 258 | MortonCopy<true, PixelFormat::BGRA8>, | ||
| 259 | MortonCopy<true, PixelFormat::RGBA32F>, | ||
| 260 | MortonCopy<true, PixelFormat::RG32F>, | ||
| 261 | MortonCopy<true, PixelFormat::R32F>, | ||
| 262 | MortonCopy<true, PixelFormat::R16F>, | ||
| 263 | MortonCopy<true, PixelFormat::R16UNORM>, | ||
| 264 | MortonCopy<true, PixelFormat::R16S>, | ||
| 265 | MortonCopy<true, PixelFormat::R16UI>, | ||
| 266 | MortonCopy<true, PixelFormat::R16I>, | ||
| 267 | MortonCopy<true, PixelFormat::RG16>, | ||
| 268 | MortonCopy<true, PixelFormat::RG16F>, | ||
| 269 | MortonCopy<true, PixelFormat::RG16UI>, | ||
| 270 | MortonCopy<true, PixelFormat::RG16I>, | ||
| 271 | MortonCopy<true, PixelFormat::RG16S>, | ||
| 272 | MortonCopy<true, PixelFormat::RGB32F>, | ||
| 273 | MortonCopy<true, PixelFormat::SRGBA8>, | ||
| 274 | MortonCopy<true, PixelFormat::RG8U>, | ||
| 275 | MortonCopy<true, PixelFormat::RG8S>, | ||
| 276 | MortonCopy<true, PixelFormat::Z24S8>, | ||
| 277 | MortonCopy<true, PixelFormat::S8Z24>, | ||
| 278 | MortonCopy<true, PixelFormat::Z32F>, | ||
| 279 | MortonCopy<true, PixelFormat::Z16>, | ||
| 257 | MortonCopy<true, PixelFormat::Z32FS8>, | 280 | MortonCopy<true, PixelFormat::Z32FS8>, |
| 281 | // clang-format on | ||
| 258 | }; | 282 | }; |
| 259 | 283 | ||
| 260 | static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), | 284 | static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), |
| 261 | SurfaceParams::MaxPixelFormat> | 285 | SurfaceParams::MaxPixelFormat> |
| 262 | gl_to_morton_fns = { | 286 | gl_to_morton_fns = { |
| 287 | // clang-format off | ||
| 263 | MortonCopy<false, PixelFormat::ABGR8U>, | 288 | MortonCopy<false, PixelFormat::ABGR8U>, |
| 264 | MortonCopy<false, PixelFormat::ABGR8S>, | 289 | MortonCopy<false, PixelFormat::ABGR8S>, |
| 265 | MortonCopy<false, PixelFormat::B5G6R5>, | 290 | MortonCopy<false, PixelFormat::B5G6R5>, |
| @@ -297,12 +322,14 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU | |||
| 297 | MortonCopy<false, PixelFormat::RG16S>, | 322 | MortonCopy<false, PixelFormat::RG16S>, |
| 298 | MortonCopy<false, PixelFormat::RGB32F>, | 323 | MortonCopy<false, PixelFormat::RGB32F>, |
| 299 | MortonCopy<false, PixelFormat::SRGBA8>, | 324 | MortonCopy<false, PixelFormat::SRGBA8>, |
| 325 | MortonCopy<false, PixelFormat::RG8U>, | ||
| 300 | MortonCopy<false, PixelFormat::RG8S>, | 326 | MortonCopy<false, PixelFormat::RG8S>, |
| 301 | MortonCopy<false, PixelFormat::Z24S8>, | 327 | MortonCopy<false, PixelFormat::Z24S8>, |
| 302 | MortonCopy<false, PixelFormat::S8Z24>, | 328 | MortonCopy<false, PixelFormat::S8Z24>, |
| 303 | MortonCopy<false, PixelFormat::Z32F>, | 329 | MortonCopy<false, PixelFormat::Z32F>, |
| 304 | MortonCopy<false, PixelFormat::Z16>, | 330 | MortonCopy<false, PixelFormat::Z16>, |
| 305 | MortonCopy<false, PixelFormat::Z32FS8>, | 331 | MortonCopy<false, PixelFormat::Z32FS8>, |
| 332 | // clang-format on | ||
| 306 | }; | 333 | }; |
| 307 | 334 | ||
| 308 | // Allocate an uninitialized texture of appropriate size and format for the surface | 335 | // Allocate an uninitialized texture of appropriate size and format for the surface |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 202257b58..ffed66394 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -58,16 +58,17 @@ struct SurfaceParams { | |||
| 58 | RG16S = 32, | 58 | RG16S = 32, |
| 59 | RGB32F = 33, | 59 | RGB32F = 33, |
| 60 | SRGBA8 = 34, | 60 | SRGBA8 = 34, |
| 61 | RG8S = 35, | 61 | RG8U = 35, |
| 62 | RG8S = 36, | ||
| 62 | 63 | ||
| 63 | MaxColorFormat, | 64 | MaxColorFormat, |
| 64 | 65 | ||
| 65 | // DepthStencil formats | 66 | // DepthStencil formats |
| 66 | Z24S8 = 36, | 67 | Z24S8 = 37, |
| 67 | S8Z24 = 37, | 68 | S8Z24 = 38, |
| 68 | Z32F = 38, | 69 | Z32F = 39, |
| 69 | Z16 = 39, | 70 | Z16 = 40, |
| 70 | Z32FS8 = 40, | 71 | Z32FS8 = 41, |
| 71 | 72 | ||
| 72 | MaxDepthStencilFormat, | 73 | MaxDepthStencilFormat, |
| 73 | 74 | ||
| @@ -140,6 +141,7 @@ struct SurfaceParams { | |||
| 140 | 1, // RG16S | 141 | 1, // RG16S |
| 141 | 1, // RGB32F | 142 | 1, // RGB32F |
| 142 | 1, // SRGBA8 | 143 | 1, // SRGBA8 |
| 144 | 1, // RG8U | ||
| 143 | 1, // RG8S | 145 | 1, // RG8S |
| 144 | 1, // Z24S8 | 146 | 1, // Z24S8 |
| 145 | 1, // S8Z24 | 147 | 1, // S8Z24 |
| @@ -192,6 +194,7 @@ struct SurfaceParams { | |||
| 192 | 32, // RG16S | 194 | 32, // RG16S |
| 193 | 96, // RGB32F | 195 | 96, // RGB32F |
| 194 | 32, // SRGBA8 | 196 | 32, // SRGBA8 |
| 197 | 16, // RG8U | ||
| 195 | 16, // RG8S | 198 | 16, // RG8S |
| 196 | 32, // Z24S8 | 199 | 32, // Z24S8 |
| 197 | 32, // S8Z24 | 200 | 32, // S8Z24 |
| @@ -265,6 +268,8 @@ struct SurfaceParams { | |||
| 265 | return PixelFormat::RG16; | 268 | return PixelFormat::RG16; |
| 266 | case Tegra::RenderTargetFormat::RG16_SNORM: | 269 | case Tegra::RenderTargetFormat::RG16_SNORM: |
| 267 | return PixelFormat::RG16S; | 270 | return PixelFormat::RG16S; |
| 271 | case Tegra::RenderTargetFormat::RG8_UNORM: | ||
| 272 | return PixelFormat::RG8U; | ||
| 268 | case Tegra::RenderTargetFormat::RG8_SNORM: | 273 | case Tegra::RenderTargetFormat::RG8_SNORM: |
| 269 | return PixelFormat::RG8S; | 274 | return PixelFormat::RG8S; |
| 270 | case Tegra::RenderTargetFormat::R16_FLOAT: | 275 | case Tegra::RenderTargetFormat::R16_FLOAT: |
| @@ -432,6 +437,7 @@ struct SurfaceParams { | |||
| 432 | case Tegra::RenderTargetFormat::RG16_UNORM: | 437 | case Tegra::RenderTargetFormat::RG16_UNORM: |
| 433 | case Tegra::RenderTargetFormat::R16_UNORM: | 438 | case Tegra::RenderTargetFormat::R16_UNORM: |
| 434 | case Tegra::RenderTargetFormat::B5G6R5_UNORM: | 439 | case Tegra::RenderTargetFormat::B5G6R5_UNORM: |
| 440 | case Tegra::RenderTargetFormat::RG8_UNORM: | ||
| 435 | return ComponentType::UNorm; | 441 | return ComponentType::UNorm; |
| 436 | case Tegra::RenderTargetFormat::RGBA8_SNORM: | 442 | case Tegra::RenderTargetFormat::RGBA8_SNORM: |
| 437 | case Tegra::RenderTargetFormat::RG16_SNORM: | 443 | case Tegra::RenderTargetFormat::RG16_SNORM: |