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"); 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) { void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
ctx.uses_y_direction = true; ctx.uses_y_direction = true;
ctx.Add("MOV.F {}.x,y_direction[0].w;", inst); 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 EmitSampleId(EmitContext& ctx, IR::Inst& inst);
void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst); void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst);
void EmitSR_WScaleFactorXY(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 EmitYDirection(EmitContext& ctx, IR::Inst& inst);
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst); void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst);
void EmitRenderArea(EmitContext& ctx, IR::Inst& inst); void EmitRenderArea(EmitContext& ctx, IR::Inst& inst);

View File

@ -428,7 +428,7 @@ void EmitInvocationInfo(EmitContext& ctx, IR::Inst& inst) {
break; break;
case Stage::Geometry: case Stage::Geometry:
ctx.AddU32("{}=uint({}<<16);", inst, ctx.AddU32("{}=uint({}<<16);", inst,
InputTopologyVertices::vertices(ctx.runtime_info.input_topology)); InputTopologyVertices::vertices(ctx.runtime_info.input_topology));
break; break;
default: default:
LOG_WARNING(Shader, "(STUBBED) called"); LOG_WARNING(Shader, "(STUBBED) called");
@ -448,6 +448,10 @@ void EmitSR_WScaleFactorXY(EmitContext& ctx, IR::Inst& inst) {
LOG_WARNING(Shader, "(STUBBED) called"); 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) { void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
ctx.uses_y_direction = true; ctx.uses_y_direction = true;
ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst); 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 EmitSampleId(EmitContext& ctx, IR::Inst& inst);
void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst); void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst);
void EmitSR_WScaleFactorXY(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 EmitYDirection(EmitContext& ctx, IR::Inst& inst);
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst); void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst);
void EmitRenderArea(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); return ctx.Const(0x00ff0000u);
} }
Id EmitSR_WScaleFactorZ(EmitContext& ctx) {
LOG_WARNING(Shader, "(STUBBED) called");
return ctx.Const(0x00ff0000u);
}
Id EmitYDirection(EmitContext& ctx) { Id EmitYDirection(EmitContext& ctx) {
return ctx.Const(ctx.runtime_info.y_negate ? -1.0f : 1.0f); 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 EmitSampleId(EmitContext& ctx);
Id EmitIsHelperInvocation(EmitContext& ctx); Id EmitIsHelperInvocation(EmitContext& ctx);
Id EmitSR_WScaleFactorXY(EmitContext& ctx); Id EmitSR_WScaleFactorXY(EmitContext& ctx);
Id EmitSR_WScaleFactorZ(EmitContext& ctx);
Id EmitYDirection(EmitContext& ctx); Id EmitYDirection(EmitContext& ctx);
Id EmitResolutionDownFactor(EmitContext& ctx); Id EmitResolutionDownFactor(EmitContext& ctx);
Id EmitRenderArea(EmitContext& ctx); Id EmitRenderArea(EmitContext& ctx);

View File

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

View File

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

View File

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

View File

@ -142,7 +142,7 @@ enum class SpecialRegister : u64 {
return ir.SR_WScaleFactorXY(); return ir.SR_WScaleFactorXY();
case SpecialRegister::SR_WSCALEFACTOR_Z: case SpecialRegister::SR_WSCALEFACTOR_Z:
LOG_WARNING(Shader, "(STUBBED) 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: case SpecialRegister::SR_LANEID:
return ir.LaneId(); return ir.LaneId();
case SpecialRegister::SR_EQMASK: case SpecialRegister::SR_EQMASK: