diff options
| author | 2021-05-08 16:28:52 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:30 -0400 | |
| commit | 6fd190d1ae4275a06ed2e488401e1d63912954be (patch) | |
| tree | ece4681d18c7b0b5bcb6b540ea4a21b32c19b363 /src/shader_recompiler/backend/glasm/emit_context.cpp | |
| parent | glasm: Changes to GLASM register allocator and emit context (diff) | |
| download | yuzu-6fd190d1ae4275a06ed2e488401e1d63912954be.tar.gz yuzu-6fd190d1ae4275a06ed2e488401e1d63912954be.tar.xz yuzu-6fd190d1ae4275a06ed2e488401e1d63912954be.zip | |
glasm: Implement basic GLASM instructions
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_context.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_context.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_context.cpp b/src/shader_recompiler/backend/glasm/emit_context.cpp index b4db4ff8f..9f839f3bf 100644 --- a/src/shader_recompiler/backend/glasm/emit_context.cpp +++ b/src/shader_recompiler/backend/glasm/emit_context.cpp | |||
| @@ -3,9 +3,28 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "shader_recompiler/backend/glasm/emit_context.h" | 5 | #include "shader_recompiler/backend/glasm/emit_context.h" |
| 6 | #include "shader_recompiler/frontend/ir/program.h" | ||
| 6 | 7 | ||
| 7 | namespace Shader::Backend::GLASM { | 8 | namespace Shader::Backend::GLASM { |
| 8 | 9 | ||
| 9 | EmitContext::EmitContext() = default; | 10 | EmitContext::EmitContext(IR::Program& program) { |
| 11 | // FIXME: Temporary partial implementation | ||
| 12 | u32 cbuf_index{}; | ||
| 13 | for (const auto& desc : program.info.constant_buffer_descriptors) { | ||
| 14 | if (desc.count != 1) { | ||
| 15 | throw NotImplementedException("Constant buffer descriptor array"); | ||
| 16 | } | ||
| 17 | Add("CBUFFER c{}[]={{program.buffer[{}]}};", desc.index, cbuf_index); | ||
| 18 | ++cbuf_index; | ||
| 19 | } | ||
| 20 | for (const auto& desc : program.info.storage_buffers_descriptors) { | ||
| 21 | if (desc.count != 1) { | ||
| 22 | throw NotImplementedException("Storage buffer descriptor array"); | ||
| 23 | } | ||
| 24 | } | ||
| 25 | if (const size_t num = program.info.storage_buffers_descriptors.size(); num > 0) { | ||
| 26 | Add("PARAM c[{}]={{program.local[0..{}]}};", num, num - 1); | ||
| 27 | } | ||
| 28 | } | ||
| 10 | 29 | ||
| 11 | } // namespace Shader::Backend::GLASM | 30 | } // namespace Shader::Backend::GLASM |