preliminary fix to the peach game

This commit is contained in:
Crimson-Hawk 2024-03-26 16:39:56 +08:00
parent 068052078f
commit 925ce2fad3
No known key found for this signature in database
GPG key ID: 0804DD39BB9BF5AC
5 changed files with 29 additions and 0 deletions

View file

@ -406,6 +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:
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);

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,10 @@ void EmitInvocationInfo(EmitContext& ctx, IR::Inst& inst) {
case Stage::TessellationEval:
ctx.AddU32("{}=uint(gl_PatchVerticesIn)<<16;", inst);
break;
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);

View file

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

View file

@ -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,