diff options
Diffstat (limited to '')
9 files changed, 25 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h index 12afda43b..cb7232704 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h +++ b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h | |||
| @@ -72,6 +72,7 @@ void EmitInvocationId(EmitContext& ctx, IR::Inst& inst); | |||
| 72 | void EmitSampleId(EmitContext& ctx, IR::Inst& inst); | 72 | void EmitSampleId(EmitContext& ctx, IR::Inst& inst); |
| 73 | void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst); | 73 | void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst); |
| 74 | void EmitYDirection(EmitContext& ctx, IR::Inst& inst); | 74 | void EmitYDirection(EmitContext& ctx, IR::Inst& inst); |
| 75 | void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst); | ||
| 75 | void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, ScalarU32 word_offset); | 76 | void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, ScalarU32 word_offset); |
| 76 | void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value); | 77 | void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value); |
| 77 | void EmitUndefU1(EmitContext& ctx, IR::Inst& inst); | 78 | void EmitUndefU1(EmitContext& ctx, IR::Inst& inst); |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp index e537f6073..807494063 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp | |||
| @@ -210,6 +210,11 @@ void EmitYDirection(EmitContext& ctx, IR::Inst& inst) { | |||
| 210 | ctx.Add("MOV.F {}.x,y_direction[0].w;", inst); | 210 | ctx.Add("MOV.F {}.x,y_direction[0].w;", inst); |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) { | ||
| 214 | UNIMPLEMENTED(); | ||
| 215 | ctx.Add("MOV.F {}.x,1;", inst); | ||
| 216 | } | ||
| 217 | |||
| 213 | void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) { | 218 | void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) { |
| 214 | ctx.Add("MOV.S {}.x,0;", inst); | 219 | ctx.Add("MOV.S {}.x,0;", inst); |
| 215 | } | 220 | } |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp index 170db269a..f4ed090e3 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp | |||
| @@ -445,6 +445,11 @@ void EmitYDirection(EmitContext& ctx, IR::Inst& inst) { | |||
| 445 | ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst); | 445 | ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst); |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) { | ||
| 449 | UNIMPLEMENTED(); | ||
| 450 | ctx.AddF32("{}=1.0f;", inst); | ||
| 451 | } | ||
| 452 | |||
| 448 | void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) { | 453 | void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) { |
| 449 | ctx.AddU32("{}=lmem[{}];", inst, word_offset); | 454 | ctx.AddU32("{}=lmem[{}];", inst, word_offset); |
| 450 | } | 455 | } |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h index 5936d086f..6cae0b84a 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h +++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | |||
| @@ -85,6 +85,7 @@ void EmitInvocationId(EmitContext& ctx, IR::Inst& inst); | |||
| 85 | void EmitSampleId(EmitContext& ctx, IR::Inst& inst); | 85 | void EmitSampleId(EmitContext& ctx, IR::Inst& inst); |
| 86 | void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst); | 86 | void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst); |
| 87 | void EmitYDirection(EmitContext& ctx, IR::Inst& inst); | 87 | void EmitYDirection(EmitContext& ctx, IR::Inst& inst); |
| 88 | void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst); | ||
| 88 | void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset); | 89 | void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset); |
| 89 | void EmitWriteLocal(EmitContext& ctx, std::string_view word_offset, std::string_view value); | 90 | void EmitWriteLocal(EmitContext& ctx, std::string_view word_offset, std::string_view value); |
| 90 | void EmitUndefU1(EmitContext& ctx, IR::Inst& inst); | 91 | void EmitUndefU1(EmitContext& ctx, IR::Inst& inst); |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index d3a93d5f4..43f440dfb 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp | |||
| @@ -526,6 +526,11 @@ Id EmitYDirection(EmitContext& ctx) { | |||
| 526 | return ctx.Const(ctx.runtime_info.y_negate ? -1.0f : 1.0f); | 526 | return ctx.Const(ctx.runtime_info.y_negate ? -1.0f : 1.0f); |
| 527 | } | 527 | } |
| 528 | 528 | ||
| 529 | Id EmitResolutionDownFactor(EmitContext& ctx) { | ||
| 530 | UNIMPLEMENTED(); | ||
| 531 | return ctx.Const(1.0f); | ||
| 532 | } | ||
| 533 | |||
| 529 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset) { | 534 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset) { |
| 530 | const Id pointer{ctx.OpAccessChain(ctx.private_u32, ctx.local_memory, word_offset)}; | 535 | const Id pointer{ctx.OpAccessChain(ctx.private_u32, ctx.local_memory, word_offset)}; |
| 531 | return ctx.OpLoad(ctx.U32[1], pointer); | 536 | return ctx.OpLoad(ctx.U32[1], pointer); |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h index c9db1c164..3d90b2286 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h +++ b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h | |||
| @@ -75,6 +75,7 @@ Id EmitInvocationId(EmitContext& ctx); | |||
| 75 | Id EmitSampleId(EmitContext& ctx); | 75 | Id EmitSampleId(EmitContext& ctx); |
| 76 | Id EmitIsHelperInvocation(EmitContext& ctx); | 76 | Id EmitIsHelperInvocation(EmitContext& ctx); |
| 77 | Id EmitYDirection(EmitContext& ctx); | 77 | Id EmitYDirection(EmitContext& ctx); |
| 78 | Id EmitResolutionDownFactor(EmitContext& ctx); | ||
| 78 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset); | 79 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset); |
| 79 | void EmitWriteLocal(EmitContext& ctx, Id word_offset, Id value); | 80 | void EmitWriteLocal(EmitContext& ctx, Id word_offset, Id value); |
| 80 | Id EmitUndefU1(EmitContext& ctx); | 81 | Id EmitUndefU1(EmitContext& ctx); |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index 13159a68d..9ae5da2a1 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -375,6 +375,10 @@ F32 IREmitter::YDirection() { | |||
| 375 | return Inst<F32>(Opcode::YDirection); | 375 | return Inst<F32>(Opcode::YDirection); |
| 376 | } | 376 | } |
| 377 | 377 | ||
| 378 | F32 IREmitter::ResolutionDownFactor() { | ||
| 379 | return Inst<F32>(Opcode::ResolutionDownFactor); | ||
| 380 | } | ||
| 381 | |||
| 378 | U32 IREmitter::LaneId() { | 382 | U32 IREmitter::LaneId() { |
| 379 | return Inst<U32>(Opcode::LaneId); | 383 | return Inst<U32>(Opcode::LaneId); |
| 380 | } | 384 | } |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index 1b89ca5a0..0c664d2fe 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h | |||
| @@ -102,6 +102,8 @@ public: | |||
| 102 | [[nodiscard]] U1 IsHelperInvocation(); | 102 | [[nodiscard]] U1 IsHelperInvocation(); |
| 103 | [[nodiscard]] F32 YDirection(); | 103 | [[nodiscard]] F32 YDirection(); |
| 104 | 104 | ||
| 105 | [[nodiscard]] F32 ResolutionDownFactor(); | ||
| 106 | |||
| 105 | [[nodiscard]] U32 LaneId(); | 107 | [[nodiscard]] U32 LaneId(); |
| 106 | 108 | ||
| 107 | [[nodiscard]] U32 LoadGlobalU8(const U64& address); | 109 | [[nodiscard]] U32 LoadGlobalU8(const U64& address); |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index d91098c80..72751c5a0 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -62,6 +62,7 @@ OPCODE(InvocationId, U32, | |||
| 62 | OPCODE(SampleId, U32, ) | 62 | OPCODE(SampleId, U32, ) |
| 63 | OPCODE(IsHelperInvocation, U1, ) | 63 | OPCODE(IsHelperInvocation, U1, ) |
| 64 | OPCODE(YDirection, F32, ) | 64 | OPCODE(YDirection, F32, ) |
| 65 | OPCODE(ResolutionDownFactor, F32, ) | ||
| 65 | 66 | ||
| 66 | // Undefined | 67 | // Undefined |
| 67 | OPCODE(UndefU1, U1, ) | 68 | OPCODE(UndefU1, U1, ) |