Added SR_WScaleFactorXY stubs for all rendering backends in preparation for a Prince of Persia issue fix
This commit is contained in:
parent
fa709308d9
commit
8b72b4b614
13 changed files with 52 additions and 73 deletions
|
@ -3,8 +3,8 @@
|
|||
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.2" apply false
|
||||
id("com.android.library") version "8.1.2" apply false
|
||||
id("com.android.application") version "8.3.0" apply false
|
||||
id("com.android.library") version "8.3.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.20" apply false
|
||||
}
|
||||
|
||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
|
|
|
@ -406,30 +406,10 @@ void EmitInvocationInfo(EmitContext& ctx, IR::Inst& inst) {
|
|||
case Stage::TessellationEval:
|
||||
ctx.Add("SHL.U {}.x,primitive.vertexcount,16;", inst);
|
||||
break;
|
||||
case Stage::Geometry: {
|
||||
u32 vertices_count = 0;
|
||||
switch (ctx.runtime_info.input_topology) {
|
||||
case InputTopology::Lines:
|
||||
vertices_count = 2;
|
||||
break;
|
||||
case InputTopology::LinesAdjacency:
|
||||
vertices_count = 4;
|
||||
break;
|
||||
case InputTopology::Triangles:
|
||||
vertices_count = 3;
|
||||
break;
|
||||
case InputTopology::TrianglesAdjacency:
|
||||
vertices_count = 6;
|
||||
break;
|
||||
case InputTopology::Points:
|
||||
default:
|
||||
vertices_count = 1;
|
||||
break;
|
||||
};
|
||||
|
||||
ctx.Add("SHL.U {}.x,{},16;", inst, vertices_count);
|
||||
case Stage::Geometry:
|
||||
ctx.Add("SHL.U {}.x,{},16;", inst,
|
||||
InputTopologyVertices::vertices(ctx.runtime_info.input_topology));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_WARNING(Shader, "(STUBBED) called");
|
||||
ctx.Add("MOV.S {}.x,0x00ff0000;", inst);
|
||||
|
@ -444,6 +424,10 @@ void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst) {
|
|||
ctx.Add("MOV.S {}.x,fragment.helperthread.x;", inst);
|
||||
}
|
||||
|
||||
void EmitSR_WScaleFactorXY(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);
|
||||
|
|
|
@ -72,6 +72,7 @@ void EmitInvocationId(EmitContext& ctx, IR::Inst& inst);
|
|||
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 EmitYDirection(EmitContext& ctx, IR::Inst& inst);
|
||||
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst);
|
||||
void EmitRenderArea(EmitContext& ctx, IR::Inst& inst);
|
||||
|
|
|
@ -426,30 +426,10 @@ void EmitInvocationInfo(EmitContext& ctx, IR::Inst& inst) {
|
|||
case Stage::TessellationEval:
|
||||
ctx.AddU32("{}=uint(gl_PatchVerticesIn)<<16;", inst);
|
||||
break;
|
||||
case Stage::Geometry: {
|
||||
u32 vertices_count = 0;
|
||||
switch (ctx.runtime_info.input_topology) {
|
||||
case InputTopology::Lines:
|
||||
vertices_count = 2;
|
||||
break;
|
||||
case InputTopology::LinesAdjacency:
|
||||
vertices_count = 4;
|
||||
break;
|
||||
case InputTopology::Triangles:
|
||||
vertices_count = 3;
|
||||
break;
|
||||
case InputTopology::TrianglesAdjacency:
|
||||
vertices_count = 6;
|
||||
break;
|
||||
case InputTopology::Points:
|
||||
default:
|
||||
vertices_count = 1;
|
||||
break;
|
||||
};
|
||||
|
||||
ctx.AddU32("{}=uint({});", inst, vertices_count << 16);
|
||||
case Stage::Geometry:
|
||||
ctx.AddU32("{}=uint({}<<16);", inst,
|
||||
InputTopologyVertices::vertices(ctx.runtime_info.input_topology));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_WARNING(Shader, "(STUBBED) called");
|
||||
ctx.AddU32("{}=uint(0x00ff0000);", inst);
|
||||
|
@ -464,6 +444,10 @@ void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst) {
|
|||
ctx.AddU1("{}=gl_HelperInvocation;", inst);
|
||||
}
|
||||
|
||||
void EmitSR_WScaleFactorXY(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);
|
||||
|
|
|
@ -86,6 +86,7 @@ void EmitInvocationId(EmitContext& ctx, IR::Inst& inst);
|
|||
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 EmitYDirection(EmitContext& ctx, IR::Inst& inst);
|
||||
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst);
|
||||
void EmitRenderArea(EmitContext& ctx, IR::Inst& inst);
|
||||
|
|
|
@ -549,29 +549,8 @@ Id EmitInvocationInfo(EmitContext& ctx) {
|
|||
case Stage::TessellationEval:
|
||||
return ctx.OpShiftLeftLogical(ctx.U32[1], ctx.OpLoad(ctx.U32[1], ctx.patch_vertices_in),
|
||||
ctx.Const(16u));
|
||||
case Stage::Geometry: {
|
||||
u32 vertices_count = 0;
|
||||
switch (ctx.runtime_info.input_topology) {
|
||||
case InputTopology::Lines:
|
||||
vertices_count = 2;
|
||||
break;
|
||||
case InputTopology::LinesAdjacency:
|
||||
vertices_count = 4;
|
||||
break;
|
||||
case InputTopology::Triangles:
|
||||
vertices_count = 3;
|
||||
break;
|
||||
case InputTopology::TrianglesAdjacency:
|
||||
vertices_count = 6;
|
||||
break;
|
||||
case InputTopology::Points:
|
||||
default:
|
||||
vertices_count = 1;
|
||||
break;
|
||||
};
|
||||
|
||||
return ctx.Const(vertices_count << 16);
|
||||
}
|
||||
case Stage::Geometry:
|
||||
return ctx.Const(InputTopologyVertices::vertices(ctx.runtime_info.input_topology) << 16);
|
||||
default:
|
||||
LOG_WARNING(Shader, "(STUBBED) called");
|
||||
return ctx.Const(0x00ff0000u);
|
||||
|
@ -586,6 +565,11 @@ Id EmitIsHelperInvocation(EmitContext& ctx) {
|
|||
return ctx.OpLoad(ctx.U1, ctx.is_helper_invocation);
|
||||
}
|
||||
|
||||
Id EmitSR_WScaleFactorXY(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);
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ Id EmitInvocationId(EmitContext& ctx);
|
|||
Id EmitInvocationInfo(EmitContext& ctx);
|
||||
Id EmitSampleId(EmitContext& ctx);
|
||||
Id EmitIsHelperInvocation(EmitContext& ctx);
|
||||
Id EmitSR_WScaleFactorXY(EmitContext& ctx);
|
||||
Id EmitYDirection(EmitContext& ctx);
|
||||
Id EmitResolutionDownFactor(EmitContext& ctx);
|
||||
Id EmitRenderArea(EmitContext& ctx);
|
||||
|
|
|
@ -382,6 +382,10 @@ U1 IREmitter::IsHelperInvocation() {
|
|||
return Inst<U1>(Opcode::IsHelperInvocation);
|
||||
}
|
||||
|
||||
U32 IREmitter::SR_WScaleFactorXY() {
|
||||
return Inst<U32>(Opcode::SR_WScaleFactorXY);
|
||||
}
|
||||
|
||||
F32 IREmitter::YDirection() {
|
||||
return Inst<F32>(Opcode::YDirection);
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ public:
|
|||
[[nodiscard]] U32 InvocationInfo();
|
||||
[[nodiscard]] U32 SampleId();
|
||||
[[nodiscard]] U1 IsHelperInvocation();
|
||||
[[nodiscard]] U32 SR_WScaleFactorXY();
|
||||
[[nodiscard]] F32 YDirection();
|
||||
|
||||
[[nodiscard]] F32 ResolutionDownFactor();
|
||||
|
|
|
@ -62,6 +62,7 @@ OPCODE(InvocationId, U32,
|
|||
OPCODE(InvocationInfo, U32, )
|
||||
OPCODE(SampleId, U32, )
|
||||
OPCODE(IsHelperInvocation, U1, )
|
||||
OPCODE(SR_WScaleFactorXY, U32, )
|
||||
OPCODE(YDirection, F32, )
|
||||
OPCODE(ResolutionDownFactor, F32, )
|
||||
OPCODE(RenderArea, F32x4, )
|
||||
|
|
|
@ -139,7 +139,7 @@ enum class SpecialRegister : u64 {
|
|||
return ir.WorkgroupIdZ();
|
||||
case SpecialRegister::SR_WSCALEFACTOR_XY:
|
||||
LOG_WARNING(Shader, "(STUBBED) SR_WSCALEFACTOR_XY");
|
||||
return ir.Imm32(Common::BitCast<u32>(1.0f));
|
||||
return ir.SR_WScaleFactorXY();
|
||||
case SpecialRegister::SR_WSCALEFACTOR_Z:
|
||||
LOG_WARNING(Shader, "(STUBBED) SR_WSCALEFACTOR_Z");
|
||||
return ir.Imm32(Common::BitCast<u32>(1.0f));
|
||||
|
|
|
@ -30,6 +30,24 @@ enum class InputTopology {
|
|||
TrianglesAdjacency,
|
||||
};
|
||||
|
||||
struct InputTopologyVertices {
|
||||
static u32 vertices(InputTopology input_topology) {
|
||||
switch (input_topology) {
|
||||
case InputTopology::Lines:
|
||||
return 2;
|
||||
case InputTopology::LinesAdjacency:
|
||||
return 4;
|
||||
case InputTopology::Triangles:
|
||||
return 3;
|
||||
case InputTopology::TrianglesAdjacency:
|
||||
return 6;
|
||||
case InputTopology::Points:
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
enum class CompareFunction {
|
||||
Never,
|
||||
Less,
|
||||
|
|
Loading…
Reference in a new issue