summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-05-26 16:00:36 -0300
committerGravatar ameerj2021-07-22 21:51:33 -0400
commitf58f79c85dad7ad018a015cc6913f2789540ec22 (patch)
treee1ee7c8b1c3a0203a046188fa9edb2bb6d203967 /src/shader_recompiler/backend
parentglasm: Skip phi moves on undefined instructions (diff)
downloadyuzu-f58f79c85dad7ad018a015cc6913f2789540ec22.tar.gz
yuzu-f58f79c85dad7ad018a015cc6913f2789540ec22.tar.xz
yuzu-f58f79c85dad7ad018a015cc6913f2789540ec22.zip
glasm: Implement Y direction
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_context.h2
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp3
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_instructions.h2
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp5
4 files changed, 9 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_context.h b/src/shader_recompiler/backend/glasm/emit_context.h
index 057d74790..cd4213cb7 100644
--- a/src/shader_recompiler/backend/glasm/emit_context.h
+++ b/src/shader_recompiler/backend/glasm/emit_context.h
@@ -70,6 +70,8 @@ public:
70 Stage stage{}; 70 Stage stage{};
71 std::string_view stage_name = "invalid"; 71 std::string_view stage_name = "invalid";
72 std::string_view attrib_name = "invalid"; 72 std::string_view attrib_name = "invalid";
73
74 bool uses_y_direction{};
73}; 75};
74 76
75} // namespace Shader::Backend::GLASM 77} // namespace Shader::Backend::GLASM
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
index 4f838b699..2a0524609 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
@@ -439,6 +439,9 @@ std::string EmitGLASM(const Profile& profile, const RuntimeInfo& runtime_info, I
439 "MOV.F FSWZB[2],1;" 439 "MOV.F FSWZB[2],1;"
440 "MOV.F FSWZB[3],-1;"; 440 "MOV.F FSWZB[3],-1;";
441 } 441 }
442 if (ctx.uses_y_direction) {
443 header += "PARAM y_direction[1]={state.material.front.ambient};";
444 }
442 ctx.code.insert(0, header); 445 ctx.code.insert(0, header);
443 ctx.code += "END"; 446 ctx.code += "END";
444 return ctx.code; 447 return ctx.code;
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h
index c24c7a71d..7b0f75405 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h
@@ -71,7 +71,7 @@ void EmitLocalInvocationId(EmitContext& ctx, IR::Inst& inst);
71void EmitInvocationId(EmitContext& ctx, IR::Inst& inst); 71void EmitInvocationId(EmitContext& ctx, IR::Inst& inst);
72void EmitSampleId(EmitContext& ctx, IR::Inst& inst); 72void EmitSampleId(EmitContext& ctx, IR::Inst& inst);
73void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst); 73void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst);
74void EmitYDirection(EmitContext& ctx); 74void EmitYDirection(EmitContext& ctx, IR::Inst& inst);
75void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, ScalarU32 word_offset); 75void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, ScalarU32 word_offset);
76void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value); 76void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value);
77void EmitUndefU1(EmitContext& ctx, IR::Inst& inst); 77void 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 022b6584c..2a92d9df5 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp
@@ -207,8 +207,9 @@ void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst) {
207 ctx.Add("MOV.S {}.x,fragment.helperthread.x;", inst); 207 ctx.Add("MOV.S {}.x,fragment.helperthread.x;", inst);
208} 208}
209 209
210void EmitYDirection(EmitContext& ctx) { 210void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
211 NotImplemented(); 211 ctx.uses_y_direction = true;
212 ctx.Add("MOV.F {}.x,y_direction[0].w;", inst);
212} 213}
213 214
214void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) { 215void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) {