summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
index 663ff3753..30c4cff81 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
@@ -37,8 +37,9 @@ std::string_view OutputVertexIndex(EmitContext& ctx) {
37 37
38void GetCbuf(EmitContext& ctx, std::string_view ret, const IR::Value& binding, 38void GetCbuf(EmitContext& ctx, std::string_view ret, const IR::Value& binding,
39 const IR::Value& offset, u32 num_bits, std::string_view cast = {}, 39 const IR::Value& offset, u32 num_bits, std::string_view cast = {},
40 bool component_indexing_bug = false, std::string_view bit_offset = {}) { 40 std::string_view bit_offset = {}) {
41 const bool is_immediate{offset.IsImmediate()}; 41 const bool is_immediate{offset.IsImmediate()};
42 const bool component_indexing_bug{!is_immediate && ctx.profile.has_gl_component_indexing_bug};
42 if (is_immediate) { 43 if (is_immediate) {
43 const s32 signed_offset{static_cast<s32>(offset.U32())}; 44 const s32 signed_offset{static_cast<s32>(offset.U32())};
44 static constexpr u32 cbuf_size{0x10000}; 45 static constexpr u32 cbuf_size{0x10000};
@@ -77,12 +78,11 @@ void GetCbuf8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, const
77 const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)}; 78 const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)};
78 if (offset.IsImmediate()) { 79 if (offset.IsImmediate()) {
79 const auto bit_offset{fmt::format("{}", (offset.U32() % 4) * 8)}; 80 const auto bit_offset{fmt::format("{}", (offset.U32() % 4) * 8)};
80 GetCbuf(ctx, ret, binding, offset, 8, cast, false, bit_offset); 81 GetCbuf(ctx, ret, binding, offset, 8, cast, bit_offset);
81 } else { 82 } else {
82 const auto offset_var{ctx.var_alloc.Consume(offset)}; 83 const auto offset_var{ctx.var_alloc.Consume(offset)};
83 const auto bit_offset{fmt::format("({}%4)*8", offset_var)}; 84 const auto bit_offset{fmt::format("({}%4)*8", offset_var)};
84 GetCbuf(ctx, ret, binding, offset, 8, cast, ctx.profile.has_gl_component_indexing_bug, 85 GetCbuf(ctx, ret, binding, offset, 8, cast, bit_offset);
85 bit_offset);
86 } 86 }
87} 87}
88 88
@@ -91,12 +91,11 @@ void GetCbuf16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, const
91 const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)}; 91 const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)};
92 if (offset.IsImmediate()) { 92 if (offset.IsImmediate()) {
93 const auto bit_offset{fmt::format("{}", ((offset.U32() / 2) % 2) * 16)}; 93 const auto bit_offset{fmt::format("{}", ((offset.U32() / 2) % 2) * 16)};
94 GetCbuf(ctx, ret, binding, offset, 16, cast, false, bit_offset); 94 GetCbuf(ctx, ret, binding, offset, 16, cast, bit_offset);
95 } else { 95 } else {
96 const auto offset_var{ctx.var_alloc.Consume(offset)}; 96 const auto offset_var{ctx.var_alloc.Consume(offset)};
97 const auto bit_offset{fmt::format("(({}>>1)%2)*16", offset_var)}; 97 const auto bit_offset{fmt::format("(({}>>1)%2)*16", offset_var)};
98 GetCbuf(ctx, ret, binding, offset, 16, cast, ctx.profile.has_gl_component_indexing_bug, 98 GetCbuf(ctx, ret, binding, offset, 16, cast, bit_offset);
99 bit_offset);
100 } 99 }
101} 100}
102 101