summaryrefslogtreecommitdiff
path: root/src/video_core/shader/decode
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-07-01 02:28:53 -0300
committerGravatar ReinUsesLisp2020-07-13 01:44:23 -0300
commitfbc232426d8ff739b0028fb5b41fb5124f7e1792 (patch)
treef3e99246a2b398151b409a1d331f27780a9a28ef /src/video_core/shader/decode
parentvideo_core: Fix DXT4 and RGB565 (diff)
downloadyuzu-fbc232426d8ff739b0028fb5b41fb5124f7e1792.tar.gz
yuzu-fbc232426d8ff739b0028fb5b41fb5124f7e1792.tar.xz
yuzu-fbc232426d8ff739b0028fb5b41fb5124f7e1792.zip
video_core: Rearrange pixel format names
Normalizes pixel format names to match Vulkan names. Previous to this commit pixel formats had no convention, leading to confusion and potential bugs.
Diffstat (limited to 'src/video_core/shader/decode')
-rw-r--r--src/video_core/shader/decode/image.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/video_core/shader/decode/image.cpp b/src/video_core/shader/decode/image.cpp
index 07778dc3e..e75ca4fdb 100644
--- a/src/video_core/shader/decode/image.cpp
+++ b/src/video_core/shader/decode/image.cpp
@@ -31,11 +31,11 @@ ComponentType GetComponentType(Tegra::Engines::SamplerDescriptor descriptor,
31 std::size_t component) { 31 std::size_t component) {
32 const TextureFormat format{descriptor.format}; 32 const TextureFormat format{descriptor.format};
33 switch (format) { 33 switch (format) {
34 case TextureFormat::R16_G16_B16_A16: 34 case TextureFormat::R16G16B16A16:
35 case TextureFormat::R32_G32_B32_A32: 35 case TextureFormat::R32G32B32A32:
36 case TextureFormat::R32_G32_B32: 36 case TextureFormat::R32G32B32:
37 case TextureFormat::R32_G32: 37 case TextureFormat::R32G32:
38 case TextureFormat::R16_G16: 38 case TextureFormat::R16G16:
39 case TextureFormat::R32: 39 case TextureFormat::R32:
40 case TextureFormat::R16: 40 case TextureFormat::R16:
41 case TextureFormat::R8: 41 case TextureFormat::R8:
@@ -97,7 +97,7 @@ ComponentType GetComponentType(Tegra::Engines::SamplerDescriptor descriptor,
97 break; 97 break;
98 case TextureFormat::B5G6R5: 98 case TextureFormat::B5G6R5:
99 case TextureFormat::B6G5R5: 99 case TextureFormat::B6G5R5:
100 case TextureFormat::BF10GF11RF11: 100 case TextureFormat::B10G11R11:
101 if (component == 0) { 101 if (component == 0) {
102 return descriptor.b_type; 102 return descriptor.b_type;
103 } 103 }
@@ -108,9 +108,9 @@ ComponentType GetComponentType(Tegra::Engines::SamplerDescriptor descriptor,
108 return descriptor.r_type; 108 return descriptor.r_type;
109 } 109 }
110 break; 110 break;
111 case TextureFormat::G8R24: 111 case TextureFormat::R24G8:
112 case TextureFormat::G24R8: 112 case TextureFormat::R8G24:
113 case TextureFormat::G8R8: 113 case TextureFormat::R8G8:
114 case TextureFormat::G4R4: 114 case TextureFormat::G4R4:
115 if (component == 0) { 115 if (component == 0) {
116 return descriptor.g_type; 116 return descriptor.g_type;
@@ -137,15 +137,15 @@ bool IsComponentEnabled(std::size_t component_mask, std::size_t component) {
137 137
138u32 GetComponentSize(TextureFormat format, std::size_t component) { 138u32 GetComponentSize(TextureFormat format, std::size_t component) {
139 switch (format) { 139 switch (format) {
140 case TextureFormat::R32_G32_B32_A32: 140 case TextureFormat::R32G32B32A32:
141 return 32; 141 return 32;
142 case TextureFormat::R16_G16_B16_A16: 142 case TextureFormat::R16G16B16A16:
143 return 16; 143 return 16;
144 case TextureFormat::R32_G32_B32: 144 case TextureFormat::R32G32B32:
145 return component <= 2 ? 32 : 0; 145 return component <= 2 ? 32 : 0;
146 case TextureFormat::R32_G32: 146 case TextureFormat::R32G32:
147 return component <= 1 ? 32 : 0; 147 return component <= 1 ? 32 : 0;
148 case TextureFormat::R16_G16: 148 case TextureFormat::R16G16:
149 return component <= 1 ? 16 : 0; 149 return component <= 1 ? 16 : 0;
150 case TextureFormat::R32: 150 case TextureFormat::R32:
151 return component == 0 ? 32 : 0; 151 return component == 0 ? 32 : 0;
@@ -192,7 +192,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) {
192 return 6; 192 return 6;
193 } 193 }
194 return 0; 194 return 0;
195 case TextureFormat::BF10GF11RF11: 195 case TextureFormat::B10G11R11:
196 if (component == 1 || component == 2) { 196 if (component == 1 || component == 2) {
197 return 11; 197 return 11;
198 } 198 }
@@ -200,7 +200,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) {
200 return 10; 200 return 10;
201 } 201 }
202 return 0; 202 return 0;
203 case TextureFormat::G8R24: 203 case TextureFormat::R24G8:
204 if (component == 0) { 204 if (component == 0) {
205 return 8; 205 return 8;
206 } 206 }
@@ -208,7 +208,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) {
208 return 24; 208 return 24;
209 } 209 }
210 return 0; 210 return 0;
211 case TextureFormat::G24R8: 211 case TextureFormat::R8G24:
212 if (component == 0) { 212 if (component == 0) {
213 return 8; 213 return 8;
214 } 214 }
@@ -216,7 +216,7 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) {
216 return 24; 216 return 24;
217 } 217 }
218 return 0; 218 return 0;
219 case TextureFormat::G8R8: 219 case TextureFormat::R8G8:
220 return (component == 0 || component == 1) ? 8 : 0; 220 return (component == 0 || component == 1) ? 8 : 0;
221 case TextureFormat::G4R4: 221 case TextureFormat::G4R4:
222 return (component == 0 || component == 1) ? 4 : 0; 222 return (component == 0 || component == 1) ? 4 : 0;
@@ -231,25 +231,25 @@ std::size_t GetImageComponentMask(TextureFormat format) {
231 constexpr u8 B = 0b0100; 231 constexpr u8 B = 0b0100;
232 constexpr u8 A = 0b1000; 232 constexpr u8 A = 0b1000;
233 switch (format) { 233 switch (format) {
234 case TextureFormat::R32_G32_B32_A32: 234 case TextureFormat::R32G32B32A32:
235 case TextureFormat::R16_G16_B16_A16: 235 case TextureFormat::R16G16B16A16:
236 case TextureFormat::A8R8G8B8: 236 case TextureFormat::A8R8G8B8:
237 case TextureFormat::A2B10G10R10: 237 case TextureFormat::A2B10G10R10:
238 case TextureFormat::A4B4G4R4: 238 case TextureFormat::A4B4G4R4:
239 case TextureFormat::A5B5G5R1: 239 case TextureFormat::A5B5G5R1:
240 case TextureFormat::A1B5G5R5: 240 case TextureFormat::A1B5G5R5:
241 return std::size_t{R | G | B | A}; 241 return std::size_t{R | G | B | A};
242 case TextureFormat::R32_G32_B32: 242 case TextureFormat::R32G32B32:
243 case TextureFormat::R32_B24G8: 243 case TextureFormat::R32_B24G8:
244 case TextureFormat::B5G6R5: 244 case TextureFormat::B5G6R5:
245 case TextureFormat::B6G5R5: 245 case TextureFormat::B6G5R5:
246 case TextureFormat::BF10GF11RF11: 246 case TextureFormat::B10G11R11:
247 return std::size_t{R | G | B}; 247 return std::size_t{R | G | B};
248 case TextureFormat::R32_G32: 248 case TextureFormat::R32G32:
249 case TextureFormat::R16_G16: 249 case TextureFormat::R16G16:
250 case TextureFormat::G8R24: 250 case TextureFormat::R24G8:
251 case TextureFormat::G24R8: 251 case TextureFormat::R8G24:
252 case TextureFormat::G8R8: 252 case TextureFormat::R8G8:
253 case TextureFormat::G4R4: 253 case TextureFormat::G4R4:
254 return std::size_t{R | G}; 254 return std::size_t{R | G};
255 case TextureFormat::R32: 255 case TextureFormat::R32: