diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-05-20 03:58:32 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:35 +0200 |
commit | eaff1030de07f3739794207403ea833ee91c0034 (patch) | |
tree | c2e6650ba13f55854b5cba9a79d9afc01528eb96 /src/shader_recompiler/backend/glsl/emit_context.cpp | |
parent | spirv: Reduce log severity of mismatching denorm rules (diff) | |
download | yuzu-eaff1030de07f3739794207403ea833ee91c0034.tar yuzu-eaff1030de07f3739794207403ea833ee91c0034.tar.gz yuzu-eaff1030de07f3739794207403ea833ee91c0034.tar.bz2 yuzu-eaff1030de07f3739794207403ea833ee91c0034.tar.lz yuzu-eaff1030de07f3739794207403ea833ee91c0034.tar.xz yuzu-eaff1030de07f3739794207403ea833ee91c0034.tar.zst yuzu-eaff1030de07f3739794207403ea833ee91c0034.zip |
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_context.cpp')
-rw-r--r-- | src/shader_recompiler/backend/glsl/emit_context.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp new file mode 100644 index 000000000..e2a9885f0 --- /dev/null +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp @@ -0,0 +1,30 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "shader_recompiler/backend/bindings.h" +#include "shader_recompiler/backend/glsl/emit_context.h" +#include "shader_recompiler/frontend/ir/program.h" + +namespace Shader::Backend::GLSL { + +EmitContext::EmitContext(IR::Program& program, [[maybe_unused]] Bindings& bindings, + const Profile& profile_) + : info{program.info}, profile{profile_} { + std::string header = "#version 450 core\n"; + header += "layout(local_size_x=1, local_size_y=1, local_size_z=1) in;"; + code += header; + DefineConstantBuffers(); + code += "void main(){"; +} + +void EmitContext::DefineConstantBuffers() { + if (info.constant_buffer_descriptors.empty()) { + return; + } + for (const auto& desc : info.constant_buffer_descriptors) { + Add("uniform uint c{}[{}];", desc.index, desc.count); + } +} + +} // namespace Shader::Backend::GLSL |