@@ -114,6 +114,37 @@ void Translator::EmitPrologue() {
114
114
} else {
115
115
ir.SetVectorReg (dst_vreg++, ir.Imm32 (0 .0f ));
116
116
}
117
+ case LogicalStage::TessellationControl: {
118
+ ir.SetVectorReg (IR::VectorReg::V1,
119
+ ir.GetAttributeU32 (IR::Attribute::PackedHullInvocationInfo));
120
+ // Test
121
+ // ir.SetPatch(IR::Patch::TessellationLodLeft, ir.Imm32(1.0f));
122
+ // ir.SetPatch(IR::Patch::TessellationLodTop, ir.Imm32(1.0f));
123
+ // ir.SetPatch(IR::Patch::TessellationLodRight, ir.Imm32(1.0f));
124
+ // ir.SetPatch(IR::Patch::TessellationLodBottom, ir.Imm32(1.0f));
125
+ // ir.SetPatch(IR::Patch::TessellationLodInteriorU, ir.Imm32(1.0f));
126
+ // ir.SetPatch(IR::Patch::TessellationLodInteriorV, ir.Imm32(1.0f));
127
+ break ;
128
+ }
129
+ case LogicalStage::TessellationEval:
130
+ ir.SetVectorReg (IR::VectorReg::V0,
131
+ ir.GetAttribute (IR::Attribute::TessellationEvaluationPointU));
132
+ ir.SetVectorReg (IR::VectorReg::V1,
133
+ ir.GetAttribute (IR::Attribute::TessellationEvaluationPointV));
134
+ // I think V2 is actually the patch id within the patches running on the local CU, used in
135
+ // compiler generated address calcs,
136
+ // and V3 is the patch id within the draw
137
+ ir.SetVectorReg (IR::VectorReg::V2, ir.GetAttributeU32 (IR::Attribute::TessPatchIdInVgt));
138
+ ir.SetVectorReg (IR::VectorReg::V3, ir.GetAttributeU32 (IR::Attribute::PrimitiveId));
139
+ break ;
140
+ case LogicalStage::Fragment:
141
+ // https://github.com/chaotic-cx/mesa-mirror/blob/72326e15/src/amd/vulkan/radv_shader_args.c#L258
142
+ // The first two VGPRs are used for i/j barycentric coordinates. In the vast majority of
143
+ // cases it will be only those two, but if shader is using both e.g linear and perspective
144
+ // inputs it can be more For now assume that this isn't the case.
145
+ dst_vreg = IR::VectorReg::V2;
146
+ for (u32 i = 0 ; i < 4 ; i++) {
147
+ ir.SetVectorReg (dst_vreg++, ir.GetAttribute (IR::Attribute::FragCoord, i));
117
148
}
118
149
if (runtime_info.fs_info .addr_flags .front_face_ena ) {
119
150
if (runtime_info.fs_info .en_flags .front_face_ena ) {
0 commit comments