yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

shader: Add resolution down factor opcode

This commit is contained in:
ReinUsesLisp 2021-07-21 22:24:33 -03:00 committed by Fernando Sahmkow
parent fddf372c68
commit fb924ea85c
9 changed files with 25 additions and 0 deletions

View File

@ -72,6 +72,7 @@ void EmitInvocationId(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 EmitYDirection(EmitContext& ctx, IR::Inst& inst); void EmitYDirection(EmitContext& ctx, IR::Inst& inst);
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst);
void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, ScalarU32 word_offset); void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, ScalarU32 word_offset);
void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value); void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value);
void EmitUndefU1(EmitContext& ctx, IR::Inst& inst); void EmitUndefU1(EmitContext& ctx, IR::Inst& inst);

View File

@ -210,6 +210,11 @@ void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
ctx.Add("MOV.F {}.x,y_direction[0].w;", inst); ctx.Add("MOV.F {}.x,y_direction[0].w;", inst);
} }
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) {
UNIMPLEMENTED();
ctx.Add("MOV.F {}.x,1;", inst);
}
void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) { void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) {
ctx.Add("MOV.S {}.x,0;", inst); ctx.Add("MOV.S {}.x,0;", inst);
} }

View File

@ -445,6 +445,11 @@ void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst); ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst);
} }
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) {
UNIMPLEMENTED();
ctx.AddF32("{}=1.0f;", inst);
}
void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) { void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) {
ctx.AddU32("{}=lmem[{}];", inst, word_offset); ctx.AddU32("{}=lmem[{}];", inst, word_offset);
} }

View File

@ -85,6 +85,7 @@ void EmitInvocationId(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 EmitYDirection(EmitContext& ctx, IR::Inst& inst); void EmitYDirection(EmitContext& ctx, IR::Inst& inst);
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst);
void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset); void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset);
void EmitWriteLocal(EmitContext& ctx, std::string_view word_offset, std::string_view value); void EmitWriteLocal(EmitContext& ctx, std::string_view word_offset, std::string_view value);
void EmitUndefU1(EmitContext& ctx, IR::Inst& inst); void EmitUndefU1(EmitContext& ctx, IR::Inst& inst);

View File

@ -526,6 +526,11 @@ 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);
} }
Id EmitResolutionDownFactor(EmitContext& ctx) {
UNIMPLEMENTED();
return ctx.Const(1.0f);
}
Id EmitLoadLocal(EmitContext& ctx, Id word_offset) { Id EmitLoadLocal(EmitContext& ctx, Id word_offset) {
const Id pointer{ctx.OpAccessChain(ctx.private_u32, ctx.local_memory, word_offset)}; const Id pointer{ctx.OpAccessChain(ctx.private_u32, ctx.local_memory, word_offset)};
return ctx.OpLoad(ctx.U32[1], pointer); return ctx.OpLoad(ctx.U32[1], pointer);

View File

@ -75,6 +75,7 @@ Id EmitInvocationId(EmitContext& ctx);
Id EmitSampleId(EmitContext& ctx); Id EmitSampleId(EmitContext& ctx);
Id EmitIsHelperInvocation(EmitContext& ctx); Id EmitIsHelperInvocation(EmitContext& ctx);
Id EmitYDirection(EmitContext& ctx); Id EmitYDirection(EmitContext& ctx);
Id EmitResolutionDownFactor(EmitContext& ctx);
Id EmitLoadLocal(EmitContext& ctx, Id word_offset); Id EmitLoadLocal(EmitContext& ctx, Id word_offset);
void EmitWriteLocal(EmitContext& ctx, Id word_offset, Id value); void EmitWriteLocal(EmitContext& ctx, Id word_offset, Id value);
Id EmitUndefU1(EmitContext& ctx); Id EmitUndefU1(EmitContext& ctx);

View File

@ -375,6 +375,10 @@ F32 IREmitter::YDirection() {
return Inst<F32>(Opcode::YDirection); return Inst<F32>(Opcode::YDirection);
} }
F32 IREmitter::ResolutionDownFactor() {
return Inst<F32>(Opcode::ResolutionDownFactor);
}
U32 IREmitter::LaneId() { U32 IREmitter::LaneId() {
return Inst<U32>(Opcode::LaneId); return Inst<U32>(Opcode::LaneId);
} }

View File

@ -102,6 +102,8 @@ public:
[[nodiscard]] U1 IsHelperInvocation(); [[nodiscard]] U1 IsHelperInvocation();
[[nodiscard]] F32 YDirection(); [[nodiscard]] F32 YDirection();
[[nodiscard]] F32 ResolutionDownFactor();
[[nodiscard]] U32 LaneId(); [[nodiscard]] U32 LaneId();
[[nodiscard]] U32 LoadGlobalU8(const U64& address); [[nodiscard]] U32 LoadGlobalU8(const U64& address);

View File

@ -62,6 +62,7 @@ OPCODE(InvocationId, U32,
OPCODE(SampleId, U32, ) OPCODE(SampleId, U32, )
OPCODE(IsHelperInvocation, U1, ) OPCODE(IsHelperInvocation, U1, )
OPCODE(YDirection, F32, ) OPCODE(YDirection, F32, )
OPCODE(ResolutionDownFactor, F32, )
// Undefined // Undefined
OPCODE(UndefU1, U1, ) OPCODE(UndefU1, U1, )