summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar namkazy2020-03-22 20:29:46 +0700
committerGravatar namkazy2020-04-05 10:31:30 +0700
commit658112783d5719b95435170d00e63afb2ce75f28 (patch)
tree6ffb401b85d645c488db3769339f005eb97a348d /src
parentremove disable optimize (diff)
downloadyuzu-658112783d5719b95435170d00e63afb2ce75f28.tar.gz
yuzu-658112783d5719b95435170d00e63afb2ce75f28.tar.xz
yuzu-658112783d5719b95435170d00e63afb2ce75f28.zip
reimplement get component type, uncomment mistaken code
Diffstat (limited to 'src')
-rw-r--r--src/video_core/shader/decode/image.cpp111
1 files changed, 93 insertions, 18 deletions
diff --git a/src/video_core/shader/decode/image.cpp b/src/video_core/shader/decode/image.cpp
index 6bfa71925..34010a162 100644
--- a/src/video_core/shader/decode/image.cpp
+++ b/src/video_core/shader/decode/image.cpp
@@ -29,22 +29,97 @@ using Tegra::Texture::TICEntry;
29 29
30namespace { 30namespace {
31ComponentType GetComponentType(TICEntry tic, std::size_t component) { 31ComponentType GetComponentType(TICEntry tic, std::size_t component) {
32 constexpr u8 R = 0b0001; 32 const TextureFormat format{tic.format};
33 constexpr u8 G = 0b0010; 33 switch (format) {
34 constexpr u8 B = 0b0100; 34 case TextureFormat::R16_G16_B16_A16:
35 constexpr u8 A = 0b1000; 35 case TextureFormat::R32_G32_B32_A32:
36 if (R & component) { 36 case TextureFormat::R32_G32_B32:
37 return tic.r_type; 37 case TextureFormat::R32_G32:
38 } 38 case TextureFormat::R16_G16:
39 if (G & component) { 39 case TextureFormat::R32:
40 return tic.g_type; 40 case TextureFormat::R16:
41 } 41 case TextureFormat::R8:
42 if (B & component) { 42 case TextureFormat::R1:
43 return tic.b_type; 43 if (0 == component) {
44 } 44 return tic.r_type;
45 if (A & component) { 45 }
46 return tic.a_type; 46 if (1 == component) {
47 return tic.g_type;
48 }
49 if (2 == component) {
50 return tic.b_type;
51 }
52 if (3 == component) {
53 return tic.a_type;
54 }
55 break;
56 case TextureFormat::A8R8G8B8:
57 if (0 == component) {
58 return tic.a_type;
59 }
60 if (1 == component) {
61 return tic.r_type;
62 }
63 if (2 == component) {
64 return tic.g_type;
65 }
66 if (3 == component) {
67 return tic.b_type;
68 }
69 break;
70 case TextureFormat::A2B10G10R10:
71 case TextureFormat::A4B4G4R4:
72 case TextureFormat::A5B5G5R1:
73 case TextureFormat::A1B5G5R5:
74 if (0 == component) {
75 return tic.a_type;
76 }
77 if (1 == component) {
78 return tic.b_type;
79 }
80 if (2 == component) {
81 return tic.g_type;
82 }
83 if (3 == component) {
84 return tic.r_type;
85 }
86 break;
87 case TextureFormat::R32_B24G8:
88 if (0 == component) {
89 return tic.r_type;
90 }
91 if (1 == component) {
92 return tic.b_type;
93 }
94 if (2 == component) {
95 return tic.g_type;
96 }
97 break;
98 case TextureFormat::B5G6R5:
99 case TextureFormat::B6G5R5:
100 if (0 == component) {
101 return tic.b_type;
102 }
103 if (1 == component) {
104 return tic.g_type;
105 }
106 if (2 == component) {
107 return tic.r_type;
108 }
109 break;
110 case TextureFormat::G8R24:
111 case TextureFormat::G24R8:
112 case TextureFormat::G8R8:
113 case TextureFormat::G4R4:
114 if (0 == component) {
115 return tic.g_type;
116 }
117 if (1 == component) {
118 return tic.r_type;
119 }
120 break;
47 } 121 }
122 UNIMPLEMENTED_MSG("texture format not implement={}", format);
48 return ComponentType::FLOAT; 123 return ComponentType::FLOAT;
49} 124}
50 125
@@ -298,9 +373,9 @@ u32 ShaderIR::DecodeImage(NodeBlock& bb, u32 pc) {
298 shifted_counter += component_size; 373 shifted_counter += component_size;
299 const auto shifted = 32 - shifted_counter; 374 const auto shifted = 32 - shifted_counter;
300 if (shifted > 0) { 375 if (shifted > 0) {
301 /* converted_value = 376 converted_value =
302 SignedOperation(OperationCode::ILogicalShiftLeft, is_signed, 377 SignedOperation(OperationCode::ILogicalShiftLeft, is_signed,
303 std::move(converted_value), Immediate(shifted));*/ 378 std::move(converted_value), Immediate(shifted));
304 } 379 }
305 380
306 // add value into result 381 // add value into result