summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-06-02 06:33:03 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:37 +0200
commitf4799e8fa15b92d8d5607dc5dfca4974901ee06c (patch)
treefe05a0bb667c92f018d08aaf7e410fd55746e0c1 /src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
parentglsl: Yet another gl_ViewportIndex fix attempt (diff)
downloadyuzu-f4799e8fa15b92d8d5607dc5dfca4974901ee06c.tar
yuzu-f4799e8fa15b92d8d5607dc5dfca4974901ee06c.tar.gz
yuzu-f4799e8fa15b92d8d5607dc5dfca4974901ee06c.tar.bz2
yuzu-f4799e8fa15b92d8d5607dc5dfca4974901ee06c.tar.lz
yuzu-f4799e8fa15b92d8d5607dc5dfca4974901ee06c.tar.xz
yuzu-f4799e8fa15b92d8d5607dc5dfca4974901ee06c.tar.zst
yuzu-f4799e8fa15b92d8d5607dc5dfca4974901ee06c.zip
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp15
1 files changed, 11 insertions, 4 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 0cf31329d..c48492a17 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
@@ -200,13 +200,21 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view value,
[[maybe_unused]] std::string_view vertex) {
- const u32 element{static_cast<u32>(attr) % 4};
- const char swizzle{"xyzw"[element]};
if (IR::IsGeneric(attr)) {
const u32 index{IR::GenericAttributeIndex(attr)};
- ctx.Add("out_attr{}{}.{}={};", index, OutputVertexIndex(ctx, vertex), swizzle, value);
+ const u32 element{IR::GenericAttributeElement(attr)};
+ const GenericElementInfo& info{ctx.output_generics.at(index).at(element)};
+ const auto output_decorator{OutputVertexIndex(ctx, vertex)};
+ if (info.num_components == 1) {
+ ctx.Add("{}{}={};", info.name, output_decorator, value);
+ } else {
+ const u32 index_element{element - info.first_element};
+ ctx.Add("{}{}.{}={};", info.name, output_decorator, "xyzw"[index_element], value);
+ }
return;
}
+ const u32 element{static_cast<u32>(attr) % 4};
+ const char swizzle{"xyzw"[element]};
switch (attr) {
case IR::Attribute::PointSize:
ctx.Add("gl_PointSize={};", value);
@@ -233,7 +241,6 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view val
break;
}
default:
- fmt::print("Set attribute {}", attr);
throw NotImplementedException("Set attribute {}", attr);
}
}