summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend
diff options
context:
space:
mode:
authorGravatar ameerj2021-05-14 21:18:53 -0400
committerGravatar ameerj2021-07-22 21:51:31 -0400
commit057dee48562b0cce69b1fa8bdb02bc0367852b4d (patch)
tree476e943bf30ad18908407c96c9551c377c09bd5d /src/shader_recompiler/backend
parentemit_spirv: Add missing block in case (diff)
downloadyuzu-057dee48562b0cce69b1fa8bdb02bc0367852b4d.tar.gz
yuzu-057dee48562b0cce69b1fa8bdb02bc0367852b4d.tar.xz
yuzu-057dee48562b0cce69b1fa8bdb02bc0367852b4d.zip
glasm: Implement local memory for glasm
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp3
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp8
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_instructions.h2
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp8
4 files changed, 12 insertions, 9 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
index 775dd9e7e..0b70bf3f6 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
@@ -306,6 +306,9 @@ std::string EmitGLASM(const Profile&, IR::Program& program, Bindings&) {
306 for (size_t index = 0; index < ctx.reg_alloc.NumUsedRegisters(); ++index) { 306 for (size_t index = 0; index < ctx.reg_alloc.NumUsedRegisters(); ++index) {
307 header += fmt::format("R{},", index); 307 header += fmt::format("R{},", index);
308 } 308 }
309 if (program.local_memory_size > 0) {
310 header += fmt::format("lmem[{}],", program.local_memory_size);
311 }
309 header += "RC;" 312 header += "RC;"
310 "LONG TEMP "; 313 "LONG TEMP ";
311 for (size_t index = 0; index < ctx.reg_alloc.NumUsedLongRegisters(); ++index) { 314 for (size_t index = 0; index < ctx.reg_alloc.NumUsedLongRegisters(); ++index) {
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
index fed79e381..de0be7aed 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
@@ -113,4 +113,12 @@ void EmitSetFragDepth([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Scalar
113 throw NotImplementedException("GLASM instruction"); 113 throw NotImplementedException("GLASM instruction");
114} 114}
115 115
116void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, ScalarU32 word_offset) {
117 ctx.Add("MOV.U {},lmem[{}].x;", inst, word_offset);
118}
119
120void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value) {
121 ctx.Add("MOV.U lmem[{}].x,{};", word_offset, value);
122}
123
116} // namespace Shader::Backend::GLASM 124} // namespace Shader::Backend::GLASM
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h
index a74e422d6..e7af8fa88 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 EmitInvocationId(EmitContext& ctx);
71void EmitSampleId(EmitContext& ctx); 71void EmitSampleId(EmitContext& ctx);
72void EmitIsHelperInvocation(EmitContext& ctx); 72void EmitIsHelperInvocation(EmitContext& ctx);
73void EmitYDirection(EmitContext& ctx); 73void EmitYDirection(EmitContext& ctx);
74void EmitLoadLocal(EmitContext& ctx, ScalarU32 word_offset); 74void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, ScalarU32 word_offset);
75void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value); 75void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value);
76void EmitUndefU1(EmitContext& ctx); 76void EmitUndefU1(EmitContext& ctx);
77void EmitUndefU8(EmitContext& ctx); 77void EmitUndefU8(EmitContext& ctx);
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 969b91a81..ae1735c8f 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp
@@ -168,14 +168,6 @@ void EmitYDirection(EmitContext& ctx) {
168 NotImplemented(); 168 NotImplemented();
169} 169}
170 170
171void EmitLoadLocal(EmitContext& ctx, ScalarU32 word_offset) {
172 NotImplemented();
173}
174
175void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value) {
176 NotImplemented();
177}
178
179void EmitUndefU1(EmitContext& ctx) { 171void EmitUndefU1(EmitContext& ctx) {
180 NotImplemented(); 172 NotImplemented();
181} 173}