glasm: Implement basic GLASM instructions
This commit is contained in:
parent
c1ba685d9c
commit
6fd190d1ae
10 changed files with 1173 additions and 840 deletions
|
@ -3,9 +3,28 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include "shader_recompiler/backend/glasm/emit_context.h"
|
||||
#include "shader_recompiler/frontend/ir/program.h"
|
||||
|
||||
namespace Shader::Backend::GLASM {
|
||||
|
||||
EmitContext::EmitContext() = default;
|
||||
EmitContext::EmitContext(IR::Program& program) {
|
||||
// FIXME: Temporary partial implementation
|
||||
u32 cbuf_index{};
|
||||
for (const auto& desc : program.info.constant_buffer_descriptors) {
|
||||
if (desc.count != 1) {
|
||||
throw NotImplementedException("Constant buffer descriptor array");
|
||||
}
|
||||
Add("CBUFFER c{}[]={{program.buffer[{}]}};", desc.index, cbuf_index);
|
||||
++cbuf_index;
|
||||
}
|
||||
for (const auto& desc : program.info.storage_buffers_descriptors) {
|
||||
if (desc.count != 1) {
|
||||
throw NotImplementedException("Storage buffer descriptor array");
|
||||
}
|
||||
}
|
||||
if (const size_t num = program.info.storage_buffers_descriptors.size(); num > 0) {
|
||||
Add("PARAM c[{}]={{program.local[0..{}]}};", num, num - 1);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Shader::Backend::GLASM
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue