diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 12 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/textures/texture.h | 1 |
4 files changed, 18 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index ced2b8247..7410471cc 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -49,6 +49,7 @@ struct FormatTuple { | |||
| 49 | static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{ | 49 | static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{ |
| 50 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false, 1}, // ABGR8 | 50 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false, 1}, // ABGR8 |
| 51 | {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false, 1}, // B5G6R5 | 51 | {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false, 1}, // B5G6R5 |
| 52 | {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false, 1}, // A2B10G10R10 | ||
| 52 | {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true, 16}, // DXT1 | 53 | {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true, 16}, // DXT1 |
| 53 | {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true, 16}, // DXT23 | 54 | {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true, 16}, // DXT23 |
| 54 | {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true, 16}, // DXT45 | 55 | {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true, 16}, // DXT45 |
| @@ -104,9 +105,9 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, VAddr b | |||
| 104 | static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr), | 105 | static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr), |
| 105 | SurfaceParams::MaxPixelFormat> | 106 | SurfaceParams::MaxPixelFormat> |
| 106 | morton_to_gl_fns = { | 107 | morton_to_gl_fns = { |
| 107 | MortonCopy<true, PixelFormat::ABGR8>, MortonCopy<true, PixelFormat::B5G6R5>, | 108 | MortonCopy<true, PixelFormat::ABGR8>, MortonCopy<true, PixelFormat::B5G6R5>, |
| 108 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, | 109 | MortonCopy<true, PixelFormat::A2B10G10R10>, MortonCopy<true, PixelFormat::DXT1>, |
| 109 | MortonCopy<true, PixelFormat::DXT45>, | 110 | MortonCopy<true, PixelFormat::DXT23>, MortonCopy<true, PixelFormat::DXT45>, |
| 110 | }; | 111 | }; |
| 111 | 112 | ||
| 112 | static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr), | 113 | static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr), |
| @@ -114,6 +115,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr), | |||
| 114 | gl_to_morton_fns = { | 115 | gl_to_morton_fns = { |
| 115 | MortonCopy<false, PixelFormat::ABGR8>, | 116 | MortonCopy<false, PixelFormat::ABGR8>, |
| 116 | MortonCopy<false, PixelFormat::B5G6R5>, | 117 | MortonCopy<false, PixelFormat::B5G6R5>, |
| 118 | MortonCopy<false, PixelFormat::A2B10G10R10>, | ||
| 117 | // TODO(Subv): Swizzling the DXT1/DXT23/DXT45 formats is not yet supported | 119 | // TODO(Subv): Swizzling the DXT1/DXT23/DXT45 formats is not yet supported |
| 118 | nullptr, | 120 | nullptr, |
| 119 | nullptr, | 121 | nullptr, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 6861efe16..e4cb3390f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -54,9 +54,10 @@ struct SurfaceParams { | |||
| 54 | enum class PixelFormat { | 54 | enum class PixelFormat { |
| 55 | ABGR8 = 0, | 55 | ABGR8 = 0, |
| 56 | B5G6R5 = 1, | 56 | B5G6R5 = 1, |
| 57 | DXT1 = 2, | 57 | A2B10G10R10 = 2, |
| 58 | DXT23 = 3, | 58 | DXT1 = 3, |
| 59 | DXT45 = 4, | 59 | DXT23 = 4, |
| 60 | DXT45 = 5, | ||
| 60 | 61 | ||
| 61 | Max, | 62 | Max, |
| 62 | Invalid = 255, | 63 | Invalid = 255, |
| @@ -88,6 +89,7 @@ struct SurfaceParams { | |||
| 88 | constexpr std::array<unsigned int, MaxPixelFormat> bpp_table = { | 89 | constexpr std::array<unsigned int, MaxPixelFormat> bpp_table = { |
| 89 | 32, // ABGR8 | 90 | 32, // ABGR8 |
| 90 | 16, // B5G6R5 | 91 | 16, // B5G6R5 |
| 92 | 32, // A2B10G10R10 | ||
| 91 | 64, // DXT1 | 93 | 64, // DXT1 |
| 92 | 128, // DXT23 | 94 | 128, // DXT23 |
| 93 | 128, // DXT45 | 95 | 128, // DXT45 |
| @@ -127,6 +129,8 @@ struct SurfaceParams { | |||
| 127 | return PixelFormat::ABGR8; | 129 | return PixelFormat::ABGR8; |
| 128 | case Tegra::Texture::TextureFormat::B5G6R5: | 130 | case Tegra::Texture::TextureFormat::B5G6R5: |
| 129 | return PixelFormat::B5G6R5; | 131 | return PixelFormat::B5G6R5; |
| 132 | case Tegra::Texture::TextureFormat::A2B10G10R10: | ||
| 133 | return PixelFormat::A2B10G10R10; | ||
| 130 | case Tegra::Texture::TextureFormat::DXT1: | 134 | case Tegra::Texture::TextureFormat::DXT1: |
| 131 | return PixelFormat::DXT1; | 135 | return PixelFormat::DXT1; |
| 132 | case Tegra::Texture::TextureFormat::DXT23: | 136 | case Tegra::Texture::TextureFormat::DXT23: |
| @@ -146,6 +150,8 @@ struct SurfaceParams { | |||
| 146 | return Tegra::Texture::TextureFormat::A8R8G8B8; | 150 | return Tegra::Texture::TextureFormat::A8R8G8B8; |
| 147 | case PixelFormat::B5G6R5: | 151 | case PixelFormat::B5G6R5: |
| 148 | return Tegra::Texture::TextureFormat::B5G6R5; | 152 | return Tegra::Texture::TextureFormat::B5G6R5; |
| 153 | case PixelFormat::A2B10G10R10: | ||
| 154 | return Tegra::Texture::TextureFormat::A2B10G10R10; | ||
| 149 | case PixelFormat::DXT1: | 155 | case PixelFormat::DXT1: |
| 150 | return Tegra::Texture::TextureFormat::DXT1; | 156 | return Tegra::Texture::TextureFormat::DXT1; |
| 151 | case PixelFormat::DXT23: | 157 | case PixelFormat::DXT23: |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 4df687786..e0509f0ce 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -53,6 +53,7 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 53 | // In this case a 'pixel' actually refers to a 4x4 tile. | 53 | // In this case a 'pixel' actually refers to a 4x4 tile. |
| 54 | return 16; | 54 | return 16; |
| 55 | case TextureFormat::A8R8G8B8: | 55 | case TextureFormat::A8R8G8B8: |
| 56 | case TextureFormat::A2B10G10R10: | ||
| 56 | return 4; | 57 | return 4; |
| 57 | case TextureFormat::B5G6R5: | 58 | case TextureFormat::B5G6R5: |
| 58 | return 2; | 59 | return 2; |
| @@ -78,6 +79,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width, | |||
| 78 | unswizzled_data.data(), true, block_height); | 79 | unswizzled_data.data(), true, block_height); |
| 79 | break; | 80 | break; |
| 80 | case TextureFormat::A8R8G8B8: | 81 | case TextureFormat::A8R8G8B8: |
| 82 | case TextureFormat::A2B10G10R10: | ||
| 81 | case TextureFormat::B5G6R5: | 83 | case TextureFormat::B5G6R5: |
| 82 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 84 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| 83 | unswizzled_data.data(), true, block_height); | 85 | unswizzled_data.data(), true, block_height); |
| @@ -100,6 +102,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 100 | case TextureFormat::DXT23: | 102 | case TextureFormat::DXT23: |
| 101 | case TextureFormat::DXT45: | 103 | case TextureFormat::DXT45: |
| 102 | case TextureFormat::A8R8G8B8: | 104 | case TextureFormat::A8R8G8B8: |
| 105 | case TextureFormat::A2B10G10R10: | ||
| 103 | case TextureFormat::B5G6R5: | 106 | case TextureFormat::B5G6R5: |
| 104 | // TODO(Subv): For the time being just forward the same data without any decoding. | 107 | // TODO(Subv): For the time being just forward the same data without any decoding. |
| 105 | rgba_data = texture_data; | 108 | rgba_data = texture_data; |
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index 86e45aa88..dc004d361 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h | |||
| @@ -15,6 +15,7 @@ namespace Texture { | |||
| 15 | 15 | ||
| 16 | enum class TextureFormat : u32 { | 16 | enum class TextureFormat : u32 { |
| 17 | A8R8G8B8 = 0x8, | 17 | A8R8G8B8 = 0x8, |
| 18 | A2B10G10R10 = 0x9, | ||
| 18 | B5G6R5 = 0x15, | 19 | B5G6R5 = 0x15, |
| 19 | DXT1 = 0x24, | 20 | DXT1 = 0x24, |
| 20 | DXT23 = 0x25, | 21 | DXT23 = 0x25, |