summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp7
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h15
-rw-r--r--src/video_core/textures/decoders.cpp3
-rw-r--r--src/video_core/textures/texture.h1
4 files changed, 21 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 501d15e98..e652bd9ed 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -47,6 +47,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
47 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false}, // ABGR8 47 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false}, // ABGR8
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_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT1 51 {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT1
51 {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT23 52 {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT23
52 {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT45 53 {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, true}, // DXT45
@@ -107,8 +108,9 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr, Tegra:
107 SurfaceParams::MaxPixelFormat> 108 SurfaceParams::MaxPixelFormat>
108 morton_to_gl_fns = { 109 morton_to_gl_fns = {
109 MortonCopy<true, PixelFormat::ABGR8>, MortonCopy<true, PixelFormat::B5G6R5>, 110 MortonCopy<true, PixelFormat::ABGR8>, MortonCopy<true, PixelFormat::B5G6R5>,
110 MortonCopy<true, PixelFormat::A2B10G10R10>, MortonCopy<true, PixelFormat::DXT1>, 111 MortonCopy<true, PixelFormat::A2B10G10R10>, MortonCopy<true, PixelFormat::A1B5G5R5>,
111 MortonCopy<true, PixelFormat::DXT23>, MortonCopy<true, PixelFormat::DXT45>, 112 MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>,
113 MortonCopy<true, PixelFormat::DXT45>,
112}; 114};
113 115
114static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr, Tegra::GPUVAddr, 116static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr, Tegra::GPUVAddr,
@@ -118,6 +120,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr, Tegra:
118 MortonCopy<false, PixelFormat::ABGR8>, 120 MortonCopy<false, PixelFormat::ABGR8>,
119 MortonCopy<false, PixelFormat::B5G6R5>, 121 MortonCopy<false, PixelFormat::B5G6R5>,
120 MortonCopy<false, PixelFormat::A2B10G10R10>, 122 MortonCopy<false, PixelFormat::A2B10G10R10>,
123 MortonCopy<false, PixelFormat::A1B5G5R5>,
121 // TODO(Subv): Swizzling the DXT1/DXT23/DXT45 formats is not yet supported 124 // TODO(Subv): Swizzling the DXT1/DXT23/DXT45 formats is not yet supported
122 nullptr, 125 nullptr,
123 nullptr, 126 nullptr,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 55f1bdee8..03e28f64a 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -57,9 +57,10 @@ struct SurfaceParams {
57 ABGR8 = 0, 57 ABGR8 = 0,
58 B5G6R5 = 1, 58 B5G6R5 = 1,
59 A2B10G10R10 = 2, 59 A2B10G10R10 = 2,
60 DXT1 = 3, 60 A1B5G5R5 = 3,
61 DXT23 = 4, 61 DXT1 = 4,
62 DXT45 = 5, 62 DXT23 = 5,
63 DXT45 = 6,
63 64
64 Max, 65 Max,
65 Invalid = 255, 66 Invalid = 255,
@@ -98,6 +99,7 @@ struct SurfaceParams {
98 1, // ABGR8 99 1, // ABGR8
99 1, // B5G6R5 100 1, // B5G6R5
100 1, // A2B10G10R10 101 1, // A2B10G10R10
102 1, // A1B5G5R5
101 4, // DXT1 103 4, // DXT1
102 4, // DXT23 104 4, // DXT23
103 4, // DXT45 105 4, // DXT45
@@ -118,6 +120,7 @@ struct SurfaceParams {
118 32, // ABGR8 120 32, // ABGR8
119 16, // B5G6R5 121 16, // B5G6R5
120 32, // A2B10G10R10 122 32, // A2B10G10R10
123 16, // A1B5G5R5
121 64, // DXT1 124 64, // DXT1
122 128, // DXT23 125 128, // DXT23
123 128, // DXT45 126 128, // DXT45
@@ -133,6 +136,7 @@ struct SurfaceParams {
133 static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { 136 static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) {
134 switch (format) { 137 switch (format) {
135 case Tegra::RenderTargetFormat::RGBA8_UNORM: 138 case Tegra::RenderTargetFormat::RGBA8_UNORM:
139 case Tegra::RenderTargetFormat::RGBA8_SRGB:
136 return PixelFormat::ABGR8; 140 return PixelFormat::ABGR8;
137 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 141 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
138 return PixelFormat::A2B10G10R10; 142 return PixelFormat::A2B10G10R10;
@@ -161,6 +165,8 @@ struct SurfaceParams {
161 return PixelFormat::B5G6R5; 165 return PixelFormat::B5G6R5;
162 case Tegra::Texture::TextureFormat::A2B10G10R10: 166 case Tegra::Texture::TextureFormat::A2B10G10R10:
163 return PixelFormat::A2B10G10R10; 167 return PixelFormat::A2B10G10R10;
168 case Tegra::Texture::TextureFormat::A1B5G5R5:
169 return PixelFormat::A1B5G5R5;
164 case Tegra::Texture::TextureFormat::DXT1: 170 case Tegra::Texture::TextureFormat::DXT1:
165 return PixelFormat::DXT1; 171 return PixelFormat::DXT1;
166 case Tegra::Texture::TextureFormat::DXT23: 172 case Tegra::Texture::TextureFormat::DXT23:
@@ -182,6 +188,8 @@ struct SurfaceParams {
182 return Tegra::Texture::TextureFormat::B5G6R5; 188 return Tegra::Texture::TextureFormat::B5G6R5;
183 case PixelFormat::A2B10G10R10: 189 case PixelFormat::A2B10G10R10:
184 return Tegra::Texture::TextureFormat::A2B10G10R10; 190 return Tegra::Texture::TextureFormat::A2B10G10R10;
191 case PixelFormat::A1B5G5R5:
192 return Tegra::Texture::TextureFormat::A1B5G5R5;
185 case PixelFormat::DXT1: 193 case PixelFormat::DXT1:
186 return Tegra::Texture::TextureFormat::DXT1; 194 return Tegra::Texture::TextureFormat::DXT1;
187 case PixelFormat::DXT23: 195 case PixelFormat::DXT23:
@@ -208,6 +216,7 @@ struct SurfaceParams {
208 // TODO(Subv): Implement more render targets 216 // TODO(Subv): Implement more render targets
209 switch (format) { 217 switch (format) {
210 case Tegra::RenderTargetFormat::RGBA8_UNORM: 218 case Tegra::RenderTargetFormat::RGBA8_UNORM:
219 case Tegra::RenderTargetFormat::RGBA8_SRGB:
211 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 220 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
212 return ComponentType::UNorm; 221 return ComponentType::UNorm;
213 default: 222 default:
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index 8b39b2bdf..ceb760e0f 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -55,6 +55,7 @@ u32 BytesPerPixel(TextureFormat format) {
55 case TextureFormat::A8R8G8B8: 55 case TextureFormat::A8R8G8B8:
56 case TextureFormat::A2B10G10R10: 56 case TextureFormat::A2B10G10R10:
57 return 4; 57 return 4;
58 case TextureFormat::A1B5G5R5:
58 case TextureFormat::B5G6R5: 59 case TextureFormat::B5G6R5:
59 return 2; 60 return 2;
60 default: 61 default:
@@ -80,6 +81,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
80 break; 81 break;
81 case TextureFormat::A8R8G8B8: 82 case TextureFormat::A8R8G8B8:
82 case TextureFormat::A2B10G10R10: 83 case TextureFormat::A2B10G10R10:
84 case TextureFormat::A1B5G5R5:
83 case TextureFormat::B5G6R5: 85 case TextureFormat::B5G6R5:
84 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 86 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
85 unswizzled_data.data(), true, block_height); 87 unswizzled_data.data(), true, block_height);
@@ -103,6 +105,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
103 case TextureFormat::DXT45: 105 case TextureFormat::DXT45:
104 case TextureFormat::A8R8G8B8: 106 case TextureFormat::A8R8G8B8:
105 case TextureFormat::A2B10G10R10: 107 case TextureFormat::A2B10G10R10:
108 case TextureFormat::A1B5G5R5:
106 case TextureFormat::B5G6R5: 109 case TextureFormat::B5G6R5:
107 // TODO(Subv): For the time being just forward the same data without any decoding. 110 // TODO(Subv): For the time being just forward the same data without any decoding.
108 rgba_data = texture_data; 111 rgba_data = texture_data;
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h
index dc004d361..b33e9bab3 100644
--- a/src/video_core/textures/texture.h
+++ b/src/video_core/textures/texture.h
@@ -16,6 +16,7 @@ namespace Texture {
16enum class TextureFormat : u32 { 16enum class TextureFormat : u32 {
17 A8R8G8B8 = 0x8, 17 A8R8G8B8 = 0x8,
18 A2B10G10R10 = 0x9, 18 A2B10G10R10 = 0x9,
19 A1B5G5R5 = 0x14,
19 B5G6R5 = 0x15, 20 B5G6R5 = 0x15,
20 DXT1 = 0x24, 21 DXT1 = 0x24,
21 DXT23 = 0x25, 22 DXT23 = 0x25,