@@ -137,6 +137,37 @@ void Translator::EmitPrologue() {
137
137
} else {
138
138
ir.SetVectorReg (dst_vreg++, ir.Imm32 (0 .0f ));
139
139
}
140
+ case LogicalStage::TessellationControl: {
141
+ ir.SetVectorReg (IR::VectorReg::V1,
142
+ ir.GetAttributeU32 (IR::Attribute::PackedHullInvocationInfo));
143
+ // Test
144
+ // ir.SetPatch(IR::Patch::TessellationLodLeft, ir.Imm32(1.0f));
145
+ // ir.SetPatch(IR::Patch::TessellationLodTop, ir.Imm32(1.0f));
146
+ // ir.SetPatch(IR::Patch::TessellationLodRight, ir.Imm32(1.0f));
147
+ // ir.SetPatch(IR::Patch::TessellationLodBottom, ir.Imm32(1.0f));
148
+ // ir.SetPatch(IR::Patch::TessellationLodInteriorU, ir.Imm32(1.0f));
149
+ // ir.SetPatch(IR::Patch::TessellationLodInteriorV, ir.Imm32(1.0f));
150
+ break ;
151
+ }
152
+ case LogicalStage::TessellationEval:
153
+ ir.SetVectorReg (IR::VectorReg::V0,
154
+ ir.GetAttribute (IR::Attribute::TessellationEvaluationPointU));
155
+ ir.SetVectorReg (IR::VectorReg::V1,
156
+ ir.GetAttribute (IR::Attribute::TessellationEvaluationPointV));
157
+ // I think V2 is actually the patch id within the patches running on the local CU, used in
158
+ // compiler generated address calcs,
159
+ // and V3 is the patch id within the draw
160
+ ir.SetVectorReg (IR::VectorReg::V2, ir.GetAttributeU32 (IR::Attribute::TessPatchIdInVgt));
161
+ ir.SetVectorReg (IR::VectorReg::V3, ir.GetAttributeU32 (IR::Attribute::PrimitiveId));
162
+ break ;
163
+ case LogicalStage::Fragment:
164
+ // https://github.com/chaotic-cx/mesa-mirror/blob/72326e15/src/amd/vulkan/radv_shader_args.c#L258
165
+ // The first two VGPRs are used for i/j barycentric coordinates. In the vast majority of
166
+ // cases it will be only those two, but if shader is using both e.g linear and perspective
167
+ // inputs it can be more For now assume that this isn't the case.
168
+ dst_vreg = IR::VectorReg::V2;
169
+ for (u32 i = 0 ; i < 4 ; i++) {
170
+ ir.SetVectorReg (dst_vreg++, ir.GetAttribute (IR::Attribute::FragCoord, i));
140
171
}
141
172
if (runtime_info.fs_info .addr_flags .front_face_ena ) {
142
173
if (runtime_info.fs_info .en_flags .front_face_ena ) {
0 commit comments