summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-05-31 04:19:31 -0300
committerGravatar ameerj2021-07-22 21:51:34 -0400
commitac0f5d2ab6cf0843c9ac6179b52b1e069a78069e (patch)
treef4de2a95a6987a74c6c8801bea35290eb40103ba /src
parentshader: Add support for "negative" and unaligned offsets (diff)
downloadyuzu-ac0f5d2ab6cf0843c9ac6179b52b1e069a78069e.tar.gz
yuzu-ac0f5d2ab6cf0843c9ac6179b52b1e069a78069e.tar.xz
yuzu-ac0f5d2ab6cf0843c9ac6179b52b1e069a78069e.zip
shader: Track legacy varyings
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp101
-rw-r--r--src/shader_recompiler/shader_info.h21
2 files changed, 105 insertions, 17 deletions
diff --git a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
index ea08aacc3..b343f0429 100644
--- a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
+++ b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
@@ -43,14 +43,11 @@ void GetAttribute(Info& info, IR::Attribute attribute) {
43 case IR::Attribute::PositionW: 43 case IR::Attribute::PositionW:
44 info.loads_position = true; 44 info.loads_position = true;
45 break; 45 break;
46 case IR::Attribute::InstanceId: 46 case IR::Attribute::ColorFrontDiffuseR:
47 info.loads_instance_id = true; 47 case IR::Attribute::ColorFrontDiffuseG:
48 break; 48 case IR::Attribute::ColorFrontDiffuseB:
49 case IR::Attribute::VertexId: 49 case IR::Attribute::ColorFrontDiffuseA:
50 info.loads_vertex_id = true; 50 info.loads_color_front_diffuse = true;
51 break;
52 case IR::Attribute::FrontFace:
53 info.loads_front_face = true;
54 break; 51 break;
55 case IR::Attribute::PointSpriteS: 52 case IR::Attribute::PointSpriteS:
56 case IR::Attribute::PointSpriteT: 53 case IR::Attribute::PointSpriteT:
@@ -60,6 +57,15 @@ void GetAttribute(Info& info, IR::Attribute attribute) {
60 case IR::Attribute::TessellationEvaluationPointV: 57 case IR::Attribute::TessellationEvaluationPointV:
61 info.loads_tess_coord = true; 58 info.loads_tess_coord = true;
62 break; 59 break;
60 case IR::Attribute::InstanceId:
61 info.loads_instance_id = true;
62 break;
63 case IR::Attribute::VertexId:
64 info.loads_vertex_id = true;
65 break;
66 case IR::Attribute::FrontFace:
67 info.loads_front_face = true;
68 break;
63 default: 69 default:
64 throw NotImplementedException("Get attribute {}", attribute); 70 throw NotImplementedException("Get attribute {}", attribute);
65 } 71 }
@@ -71,6 +77,12 @@ void SetAttribute(Info& info, IR::Attribute attribute) {
71 return; 77 return;
72 } 78 }
73 switch (attribute) { 79 switch (attribute) {
80 case IR::Attribute::Layer:
81 info.stores_layer = true;
82 break;
83 case IR::Attribute::ViewportIndex:
84 info.stores_viewport_index = true;
85 break;
74 case IR::Attribute::PointSize: 86 case IR::Attribute::PointSize:
75 info.stores_point_size = true; 87 info.stores_point_size = true;
76 break; 88 break;
@@ -80,6 +92,72 @@ void SetAttribute(Info& info, IR::Attribute attribute) {
80 case IR::Attribute::PositionW: 92 case IR::Attribute::PositionW:
81 info.stores_position = true; 93 info.stores_position = true;
82 break; 94 break;
95 case IR::Attribute::ColorFrontDiffuseR:
96 case IR::Attribute::ColorFrontDiffuseG:
97 case IR::Attribute::ColorFrontDiffuseB:
98 case IR::Attribute::ColorFrontDiffuseA:
99 info.stores_color_front_diffuse = true;
100 break;
101 case IR::Attribute::ColorFrontSpecularR:
102 case IR::Attribute::ColorFrontSpecularG:
103 case IR::Attribute::ColorFrontSpecularB:
104 case IR::Attribute::ColorFrontSpecularA:
105 info.stores_color_front_specular = true;
106 break;
107 case IR::Attribute::ColorBackDiffuseR:
108 case IR::Attribute::ColorBackDiffuseG:
109 case IR::Attribute::ColorBackDiffuseB:
110 case IR::Attribute::ColorBackDiffuseA:
111 info.stores_color_back_diffuse = true;
112 break;
113 case IR::Attribute::ColorBackSpecularR:
114 case IR::Attribute::ColorBackSpecularG:
115 case IR::Attribute::ColorBackSpecularB:
116 case IR::Attribute::ColorBackSpecularA:
117 info.stores_color_front_specular = true;
118 break;
119 case IR::Attribute::FixedFncTexture0S:
120 case IR::Attribute::FixedFncTexture0T:
121 case IR::Attribute::FixedFncTexture0R:
122 case IR::Attribute::FixedFncTexture0Q:
123 case IR::Attribute::FixedFncTexture1S:
124 case IR::Attribute::FixedFncTexture1T:
125 case IR::Attribute::FixedFncTexture1R:
126 case IR::Attribute::FixedFncTexture1Q:
127 case IR::Attribute::FixedFncTexture2S:
128 case IR::Attribute::FixedFncTexture2T:
129 case IR::Attribute::FixedFncTexture2R:
130 case IR::Attribute::FixedFncTexture2Q:
131 case IR::Attribute::FixedFncTexture3S:
132 case IR::Attribute::FixedFncTexture3T:
133 case IR::Attribute::FixedFncTexture3R:
134 case IR::Attribute::FixedFncTexture3Q:
135 case IR::Attribute::FixedFncTexture4S:
136 case IR::Attribute::FixedFncTexture4T:
137 case IR::Attribute::FixedFncTexture4R:
138 case IR::Attribute::FixedFncTexture4Q:
139 case IR::Attribute::FixedFncTexture5S:
140 case IR::Attribute::FixedFncTexture5T:
141 case IR::Attribute::FixedFncTexture5R:
142 case IR::Attribute::FixedFncTexture5Q:
143 case IR::Attribute::FixedFncTexture6S:
144 case IR::Attribute::FixedFncTexture6T:
145 case IR::Attribute::FixedFncTexture6R:
146 case IR::Attribute::FixedFncTexture6Q:
147 case IR::Attribute::FixedFncTexture7S:
148 case IR::Attribute::FixedFncTexture7T:
149 case IR::Attribute::FixedFncTexture7R:
150 case IR::Attribute::FixedFncTexture7Q:
151 case IR::Attribute::FixedFncTexture8S:
152 case IR::Attribute::FixedFncTexture8T:
153 case IR::Attribute::FixedFncTexture8R:
154 case IR::Attribute::FixedFncTexture8Q:
155 case IR::Attribute::FixedFncTexture9S:
156 case IR::Attribute::FixedFncTexture9T:
157 case IR::Attribute::FixedFncTexture9R:
158 case IR::Attribute::FixedFncTexture9Q:
159 info.stores_fixed_fnc_textures = true;
160 break;
83 case IR::Attribute::ClipDistance0: 161 case IR::Attribute::ClipDistance0:
84 case IR::Attribute::ClipDistance1: 162 case IR::Attribute::ClipDistance1:
85 case IR::Attribute::ClipDistance2: 163 case IR::Attribute::ClipDistance2:
@@ -90,11 +168,8 @@ void SetAttribute(Info& info, IR::Attribute attribute) {
90 case IR::Attribute::ClipDistance7: 168 case IR::Attribute::ClipDistance7:
91 info.stores_clip_distance = true; 169 info.stores_clip_distance = true;
92 break; 170 break;
93 case IR::Attribute::Layer: 171 case IR::Attribute::FogCoordinate:
94 info.stores_layer = true; 172 info.stores_fog_coordinate = true;
95 break;
96 case IR::Attribute::ViewportIndex:
97 info.stores_viewport_index = true;
98 break; 173 break;
99 case IR::Attribute::ViewportMask: 174 case IR::Attribute::ViewportMask:
100 info.stores_viewport_mask = true; 175 info.stores_viewport_mask = true;
diff --git a/src/shader_recompiler/shader_info.h b/src/shader_recompiler/shader_info.h
index d6c32fbe5..b60ba0457 100644
--- a/src/shader_recompiler/shader_info.h
+++ b/src/shader_recompiler/shader_info.h
@@ -122,26 +122,39 @@ struct Info {
122 std::array<InputVarying, 32> input_generics{}; 122 std::array<InputVarying, 32> input_generics{};
123 bool loads_primitive_id{}; 123 bool loads_primitive_id{};
124 bool loads_position{}; 124 bool loads_position{};
125 bool loads_color_front_diffuse{};
126 bool loads_point_coord{};
125 bool loads_instance_id{}; 127 bool loads_instance_id{};
126 bool loads_vertex_id{}; 128 bool loads_vertex_id{};
127 bool loads_front_face{}; 129 bool loads_front_face{};
128 bool loads_point_coord{}; 130
129 bool loads_tess_coord{}; 131 bool loads_tess_coord{};
132
130 bool loads_indexed_attributes{}; 133 bool loads_indexed_attributes{};
131 134
132 std::array<bool, 8> stores_frag_color{}; 135 std::array<bool, 8> stores_frag_color{};
133 bool stores_sample_mask{}; 136 bool stores_sample_mask{};
134 bool stores_frag_depth{}; 137 bool stores_frag_depth{};
138
135 std::array<bool, 32> stores_generics{}; 139 std::array<bool, 32> stores_generics{};
136 bool stores_position{};
137 bool stores_point_size{};
138 bool stores_clip_distance{};
139 bool stores_layer{}; 140 bool stores_layer{};
140 bool stores_viewport_index{}; 141 bool stores_viewport_index{};
142 bool stores_point_size{};
143 bool stores_position{};
144 bool stores_color_front_diffuse{};
145 bool stores_color_front_specular{};
146 bool stores_color_back_diffuse{};
147 bool stores_color_back_specular{};
148 bool stores_fixed_fnc_textures{};
149 bool stores_clip_distance{};
150 bool stores_fog_coordinate{};
141 bool stores_viewport_mask{}; 151 bool stores_viewport_mask{};
152
142 bool stores_tess_level_outer{}; 153 bool stores_tess_level_outer{};
143 bool stores_tess_level_inner{}; 154 bool stores_tess_level_inner{};
155
144 bool stores_indexed_attributes{}; 156 bool stores_indexed_attributes{};
157
145 bool stores_global_memory{}; 158 bool stores_global_memory{};
146 159
147 bool uses_fp16{}; 160 bool uses_fp16{};