diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 13 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 4 |
3 files changed, 18 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index e652bd9ed..5bb34037b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -48,6 +48,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 48 | {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false}, // B5G6R5 | 48 | {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false}, // B5G6R5 |
| 49 | {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false}, // A2B10G10R10 | 49 | {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false}, // A2B10G10R10 |
| 50 | {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false}, // A1B5G5R5 | 50 | {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false}, // A1B5G5R5 |
| 51 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE, false}, // R8 | ||
| 51 | {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT1 | 52 | {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT1 |
| 52 | {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT23 | 53 | {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT23 |
| 53 | {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT45 | 54 | {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT45 |
| @@ -109,8 +110,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr, Tegra: | |||
| 109 | morton_to_gl_fns = { | 110 | morton_to_gl_fns = { |
| 110 | MortonCopy<true, PixelFormat::ABGR8>, MortonCopy<true, PixelFormat::B5G6R5>, | 111 | MortonCopy<true, PixelFormat::ABGR8>, MortonCopy<true, PixelFormat::B5G6R5>, |
| 111 | MortonCopy<true, PixelFormat::A2B10G10R10>, MortonCopy<true, PixelFormat::A1B5G5R5>, | 112 | MortonCopy<true, PixelFormat::A2B10G10R10>, MortonCopy<true, PixelFormat::A1B5G5R5>, |
| 112 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, | 113 | MortonCopy<true, PixelFormat::R8>, MortonCopy<true, PixelFormat::DXT1>, |
| 113 | MortonCopy<true, PixelFormat::DXT45>, | 114 | MortonCopy<true, PixelFormat::DXT23>, MortonCopy<true, PixelFormat::DXT45>, |
| 114 | }; | 115 | }; |
| 115 | 116 | ||
| 116 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr, Tegra::GPUVAddr, | 117 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr, Tegra::GPUVAddr, |
| @@ -121,6 +122,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr, Tegra: | |||
| 121 | MortonCopy<false, PixelFormat::B5G6R5>, | 122 | MortonCopy<false, PixelFormat::B5G6R5>, |
| 122 | MortonCopy<false, PixelFormat::A2B10G10R10>, | 123 | MortonCopy<false, PixelFormat::A2B10G10R10>, |
| 123 | MortonCopy<false, PixelFormat::A1B5G5R5>, | 124 | MortonCopy<false, PixelFormat::A1B5G5R5>, |
| 125 | MortonCopy<false, PixelFormat::R8>, | ||
| 124 | // TODO(Subv): Swizzling the DXT1/DXT23/DXT45 formats is not yet supported | 126 | // TODO(Subv): Swizzling the DXT1/DXT23/DXT45 formats is not yet supported |
| 125 | nullptr, | 127 | nullptr, |
| 126 | nullptr, | 128 | nullptr, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 03e28f64a..fc09f108c 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -58,9 +58,10 @@ struct SurfaceParams { | |||
| 58 | B5G6R5 = 1, | 58 | B5G6R5 = 1, |
| 59 | A2B10G10R10 = 2, | 59 | A2B10G10R10 = 2, |
| 60 | A1B5G5R5 = 3, | 60 | A1B5G5R5 = 3, |
| 61 | DXT1 = 4, | 61 | R8 = 4, |
| 62 | DXT23 = 5, | 62 | DXT1 = 5, |
| 63 | DXT45 = 6, | 63 | DXT23 = 6, |
| 64 | DXT45 = 7, | ||
| 64 | 65 | ||
| 65 | Max, | 66 | Max, |
| 66 | Invalid = 255, | 67 | Invalid = 255, |
| @@ -100,6 +101,7 @@ struct SurfaceParams { | |||
| 100 | 1, // B5G6R5 | 101 | 1, // B5G6R5 |
| 101 | 1, // A2B10G10R10 | 102 | 1, // A2B10G10R10 |
| 102 | 1, // A1B5G5R5 | 103 | 1, // A1B5G5R5 |
| 104 | 1, // R8 | ||
| 103 | 4, // DXT1 | 105 | 4, // DXT1 |
| 104 | 4, // DXT23 | 106 | 4, // DXT23 |
| 105 | 4, // DXT45 | 107 | 4, // DXT45 |
| @@ -121,6 +123,7 @@ struct SurfaceParams { | |||
| 121 | 16, // B5G6R5 | 123 | 16, // B5G6R5 |
| 122 | 32, // A2B10G10R10 | 124 | 32, // A2B10G10R10 |
| 123 | 16, // A1B5G5R5 | 125 | 16, // A1B5G5R5 |
| 126 | 8, // R8 | ||
| 124 | 64, // DXT1 | 127 | 64, // DXT1 |
| 125 | 128, // DXT23 | 128 | 128, // DXT23 |
| 126 | 128, // DXT45 | 129 | 128, // DXT45 |
| @@ -167,6 +170,8 @@ struct SurfaceParams { | |||
| 167 | return PixelFormat::A2B10G10R10; | 170 | return PixelFormat::A2B10G10R10; |
| 168 | case Tegra::Texture::TextureFormat::A1B5G5R5: | 171 | case Tegra::Texture::TextureFormat::A1B5G5R5: |
| 169 | return PixelFormat::A1B5G5R5; | 172 | return PixelFormat::A1B5G5R5; |
| 173 | case Tegra::Texture::TextureFormat::R8: | ||
| 174 | return PixelFormat::R8; | ||
| 170 | case Tegra::Texture::TextureFormat::DXT1: | 175 | case Tegra::Texture::TextureFormat::DXT1: |
| 171 | return PixelFormat::DXT1; | 176 | return PixelFormat::DXT1; |
| 172 | case Tegra::Texture::TextureFormat::DXT23: | 177 | case Tegra::Texture::TextureFormat::DXT23: |
| @@ -190,6 +195,8 @@ struct SurfaceParams { | |||
| 190 | return Tegra::Texture::TextureFormat::A2B10G10R10; | 195 | return Tegra::Texture::TextureFormat::A2B10G10R10; |
| 191 | case PixelFormat::A1B5G5R5: | 196 | case PixelFormat::A1B5G5R5: |
| 192 | return Tegra::Texture::TextureFormat::A1B5G5R5; | 197 | return Tegra::Texture::TextureFormat::A1B5G5R5; |
| 198 | case PixelFormat::R8: | ||
| 199 | return Tegra::Texture::TextureFormat::R8; | ||
| 193 | case PixelFormat::DXT1: | 200 | case PixelFormat::DXT1: |
| 194 | return Tegra::Texture::TextureFormat::DXT1; | 201 | return Tegra::Texture::TextureFormat::DXT1; |
| 195 | case PixelFormat::DXT23: | 202 | case PixelFormat::DXT23: |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index ceb760e0f..9d7b73b73 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -58,6 +58,8 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 58 | case TextureFormat::A1B5G5R5: | 58 | case TextureFormat::A1B5G5R5: |
| 59 | case TextureFormat::B5G6R5: | 59 | case TextureFormat::B5G6R5: |
| 60 | return 2; | 60 | return 2; |
| 61 | case TextureFormat::R8: | ||
| 62 | return 1; | ||
| 61 | default: | 63 | default: |
| 62 | UNIMPLEMENTED_MSG("Format not implemented"); | 64 | UNIMPLEMENTED_MSG("Format not implemented"); |
| 63 | break; | 65 | break; |
| @@ -83,6 +85,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width, | |||
| 83 | case TextureFormat::A2B10G10R10: | 85 | case TextureFormat::A2B10G10R10: |
| 84 | case TextureFormat::A1B5G5R5: | 86 | case TextureFormat::A1B5G5R5: |
| 85 | case TextureFormat::B5G6R5: | 87 | case TextureFormat::B5G6R5: |
| 88 | case TextureFormat::R8: | ||
| 86 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 89 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| 87 | unswizzled_data.data(), true, block_height); | 90 | unswizzled_data.data(), true, block_height); |
| 88 | break; | 91 | break; |
| @@ -107,6 +110,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 107 | case TextureFormat::A2B10G10R10: | 110 | case TextureFormat::A2B10G10R10: |
| 108 | case TextureFormat::A1B5G5R5: | 111 | case TextureFormat::A1B5G5R5: |
| 109 | case TextureFormat::B5G6R5: | 112 | case TextureFormat::B5G6R5: |
| 113 | case TextureFormat::R8: | ||
| 110 | // TODO(Subv): For the time being just forward the same data without any decoding. | 114 | // TODO(Subv): For the time being just forward the same data without any decoding. |
| 111 | rgba_data = texture_data; | 115 | rgba_data = texture_data; |
| 112 | break; | 116 | break; |