Added support for Princess Peach: Showtime!

This commit is contained in:
Jarrod Norwell 2024-03-23 11:53:26 +08:00
parent 8db48f8100
commit 6a35aa6b94
4 changed files with 72 additions and 0 deletions

View file

@ -406,6 +406,30 @@ 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);
break;
}
default:
LOG_WARNING(Shader, "(STUBBED) called");
ctx.Add("MOV.S {}.x,0x00ff0000;", inst);

View file

@ -11,6 +11,7 @@
#include "shader_recompiler/backend/glasm/reg_alloc.h"
#include "shader_recompiler/stage.h"
#include "shader_recompiler/runtime_info.h"
namespace Shader {
struct Info;

View file

@ -426,6 +426,30 @@ 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);
break;
}
default:
LOG_WARNING(Shader, "(STUBBED) called");
ctx.AddU32("{}=uint(0x00ff0000);", inst);

View file

@ -549,6 +549,29 @@ 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);
}
default:
LOG_WARNING(Shader, "(STUBBED) called");
return ctx.Const(0x00ff0000u);