Added SR_WScaleFactorZ stubs for all rendering backends in preparation for a Prince of Persia issue fix

This commit is contained in:
Jarrod Norwell 2024-03-24 19:22:48 +08:00
parent e2003a5b6b
commit 8114790363
10 changed files with 24 additions and 2 deletions

View File

@ -428,6 +428,10 @@ void EmitSR_WScaleFactorXY(EmitContext& ctx, IR::Inst& inst) {
LOG_WARNING(Shader, "(STUBBED) called");
}
void EmitSR_WScaleFactorZ(EmitContext& ctx, IR::Inst& inst) {
LOG_WARNING(Shader, "(STUBBED) called");
}
void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
ctx.uses_y_direction = true;
ctx.Add("MOV.F {}.x,y_direction[0].w;", inst);

View File

@ -73,6 +73,7 @@ void EmitInvocationInfo(EmitContext& ctx, IR::Inst& inst);
void EmitSampleId(EmitContext& ctx, IR::Inst& inst);
void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst);
void EmitSR_WScaleFactorXY(EmitContext& ctx, IR::Inst& inst);
void EmitSR_WScaleFactorZ(EmitContext& ctx, IR::Inst& inst);
void EmitYDirection(EmitContext& ctx, IR::Inst& inst);
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst);
void EmitRenderArea(EmitContext& ctx, IR::Inst& inst);

View File

@ -448,6 +448,10 @@ void EmitSR_WScaleFactorXY(EmitContext& ctx, IR::Inst& inst) {
LOG_WARNING(Shader, "(STUBBED) called");
}
void EmitSR_WScaleFactorZ(EmitContext& ctx, IR::Inst& inst) {
LOG_WARNING(Shader, "(STUBBED) called");
}
void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
ctx.uses_y_direction = true;
ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst);

View File

@ -87,6 +87,7 @@ void EmitInvocationInfo(EmitContext& ctx, IR::Inst& inst);
void EmitSampleId(EmitContext& ctx, IR::Inst& inst);
void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst);
void EmitSR_WScaleFactorXY(EmitContext& ctx, IR::Inst& inst);
void EmitSR_WScaleFactorZ(EmitContext& ctx, IR::Inst& inst);
void EmitYDirection(EmitContext& ctx, IR::Inst& inst);
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst);
void EmitRenderArea(EmitContext& ctx, IR::Inst& inst);

View File

@ -570,6 +570,11 @@ Id EmitSR_WScaleFactorXY(EmitContext& ctx) {
return ctx.Const(0x00ff0000u);
}
Id EmitSR_WScaleFactorZ(EmitContext& ctx) {
LOG_WARNING(Shader, "(STUBBED) called");
return ctx.Const(0x00ff0000u);
}
Id EmitYDirection(EmitContext& ctx) {
return ctx.Const(ctx.runtime_info.y_negate ? -1.0f : 1.0f);
}

View File

@ -76,6 +76,7 @@ Id EmitInvocationInfo(EmitContext& ctx);
Id EmitSampleId(EmitContext& ctx);
Id EmitIsHelperInvocation(EmitContext& ctx);
Id EmitSR_WScaleFactorXY(EmitContext& ctx);
Id EmitSR_WScaleFactorZ(EmitContext& ctx);
Id EmitYDirection(EmitContext& ctx);
Id EmitResolutionDownFactor(EmitContext& ctx);
Id EmitRenderArea(EmitContext& ctx);

View File

@ -386,6 +386,10 @@ U32 IREmitter::SR_WScaleFactorXY() {
return Inst<U32>(Opcode::SR_WScaleFactorXY);
}
U32 IREmitter::SR_WScaleFactorZ() {
return Inst<U32>(Opcode::SR_WScaleFactorZ);
}
F32 IREmitter::YDirection() {
return Inst<F32>(Opcode::YDirection);
}

View File

@ -103,6 +103,7 @@ public:
[[nodiscard]] U32 SampleId();
[[nodiscard]] U1 IsHelperInvocation();
[[nodiscard]] U32 SR_WScaleFactorXY();
[[nodiscard]] U32 SR_WScaleFactorZ();
[[nodiscard]] F32 YDirection();
[[nodiscard]] F32 ResolutionDownFactor();

View File

@ -63,6 +63,7 @@ OPCODE(InvocationInfo, U32,
OPCODE(SampleId, U32, )
OPCODE(IsHelperInvocation, U1, )
OPCODE(SR_WScaleFactorXY, U32, )
OPCODE(SR_WScaleFactorZ, U32, )
OPCODE(YDirection, F32, )
OPCODE(ResolutionDownFactor, F32, )
OPCODE(RenderArea, F32x4, )

View File

@ -142,7 +142,7 @@ enum class SpecialRegister : u64 {
return ir.SR_WScaleFactorXY();
case SpecialRegister::SR_WSCALEFACTOR_Z:
LOG_WARNING(Shader, "(STUBBED) SR_WSCALEFACTOR_Z");
return ir.Imm32(Common::BitCast<u32>(1.0f));
return ir.SR_WScaleFactorZ();
case SpecialRegister::SR_LANEID:
return ir.LaneId();
case SpecialRegister::SR_EQMASK: