summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glasm/emit_context.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-05-18 21:04:09 -0300
committerGravatar ameerj2021-07-22 21:51:32 -0400
commit8b7d5912d61d56f65fb7e3a03bba544a4c40bfa6 (patch)
treeede1d0e1d3c828b50f4af190f64adf73a30a62e7 /src/shader_recompiler/backend/glasm/emit_context.cpp
parentglasm: Implement textureGather instructions (diff)
downloadyuzu-8b7d5912d61d56f65fb7e3a03bba544a4c40bfa6.tar.gz
yuzu-8b7d5912d61d56f65fb7e3a03bba544a4c40bfa6.tar.xz
yuzu-8b7d5912d61d56f65fb7e3a03bba544a4c40bfa6.zip
glasm: Support textures used in more than one stage
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_context.cpp')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_context.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_context.cpp b/src/shader_recompiler/backend/glasm/emit_context.cpp
index 4903e9d8e..d1fe84a5f 100644
--- a/src/shader_recompiler/backend/glasm/emit_context.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_context.cpp
@@ -4,6 +4,7 @@
4 4
5#include <string_view> 5#include <string_view>
6 6
7#include "shader_recompiler/backend/bindings.h"
7#include "shader_recompiler/backend/glasm/emit_context.h" 8#include "shader_recompiler/backend/glasm/emit_context.h"
8#include "shader_recompiler/frontend/ir/program.h" 9#include "shader_recompiler/frontend/ir/program.h"
9 10
@@ -22,7 +23,7 @@ std::string_view InterpDecorator(Interpolation interp) {
22} 23}
23} // Anonymous namespace 24} // Anonymous namespace
24 25
25EmitContext::EmitContext(IR::Program& program) { 26EmitContext::EmitContext(IR::Program& program, Bindings& bindings) : info{program.info} {
26 // FIXME: Temporary partial implementation 27 // FIXME: Temporary partial implementation
27 u32 cbuf_index{}; 28 u32 cbuf_index{};
28 for (const auto& desc : program.info.constant_buffer_descriptors) { 29 for (const auto& desc : program.info.constant_buffer_descriptors) {
@@ -79,6 +80,13 @@ EmitContext::EmitContext(IR::Program& program) {
79 Add("OUTPUT out_attr{}[]={{result.attrib[{}..{}]}};", index, index, index); 80 Add("OUTPUT out_attr{}[]={{result.attrib[{}..{}]}};", index, index, index);
80 } 81 }
81 } 82 }
83 const size_t num_textures{program.info.texture_descriptors.size()};
84 texture_bindings.resize(num_textures);
85 for (size_t index = 0; index < num_textures; ++index) {
86 const auto& desc{program.info.texture_descriptors[index]};
87 texture_bindings[index] = bindings.texture;
88 bindings.texture += desc.count;
89 }
82} 90}
83 91
84} // namespace Shader::Backend::GLASM 92} // namespace Shader::Backend::GLASM