summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_context.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp30
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 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "shader_recompiler/backend/bindings.h"
6#include "shader_recompiler/backend/glsl/emit_context.h"
7#include "shader_recompiler/frontend/ir/program.h"
8
9namespace Shader::Backend::GLSL {
10
11EmitContext::EmitContext(IR::Program& program, [[maybe_unused]] Bindings& bindings,
12 const Profile& profile_)
13 : info{program.info}, profile{profile_} {
14 std::string header = "#version 450 core\n";
15 header += "layout(local_size_x=1, local_size_y=1, local_size_z=1) in;";
16 code += header;
17 DefineConstantBuffers();
18 code += "void main(){";
19}
20
21void EmitContext::DefineConstantBuffers() {
22 if (info.constant_buffer_descriptors.empty()) {
23 return;
24 }
25 for (const auto& desc : info.constant_buffer_descriptors) {
26 Add("uniform uint c{}[{}];", desc.index, desc.count);
27 }
28}
29
30} // namespace Shader::Backend::GLSL