summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-16 01:33:57 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:31 +0200
commit3c06293e20bde507ed1bc5dabf6c66cc443c2ed4 (patch)
tree712d52932135ea21bb557c965a9e769d53d19ea1
parentshader_recompiler: GCC fixes (diff)
downloadyuzu-3c06293e20bde507ed1bc5dabf6c66cc443c2ed4.tar
yuzu-3c06293e20bde507ed1bc5dabf6c66cc443c2ed4.tar.gz
yuzu-3c06293e20bde507ed1bc5dabf6c66cc443c2ed4.tar.bz2
yuzu-3c06293e20bde507ed1bc5dabf6c66cc443c2ed4.tar.lz
yuzu-3c06293e20bde507ed1bc5dabf6c66cc443c2ed4.tar.xz
yuzu-3c06293e20bde507ed1bc5dabf6c66cc443c2ed4.tar.zst
yuzu-3c06293e20bde507ed1bc5dabf6c66cc443c2ed4.zip
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
index 2de7fb9cc..9ce6c9214 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
@@ -51,13 +51,23 @@ void EmitGetCbufU32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding
void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
[[maybe_unused]] ScalarU32 vertex) {
+ const u32 element{static_cast<u32>(attr) % 4};
+ const char swizzle{"xyzw"[element]};
if (IR::IsGeneric(attr)) {
const u32 index{IR::GenericAttributeIndex(attr)};
- const u32 element{IR::GenericAttributeElement(attr)};
- ctx.Add("MOV.F {}.x,in_attr{}[0].{};", inst, index, "xyzw"[element]);
+ ctx.Add("MOV.F {}.x,in_attr{}[0].{};", inst, index, swizzle);
return;
}
- throw NotImplementedException("Get attribute {}", attr);
+ switch (attr) {
+ case IR::Attribute::PositionX:
+ case IR::Attribute::PositionY:
+ case IR::Attribute::PositionZ:
+ case IR::Attribute::PositionW:
+ ctx.Add("MOV.F {}.x,{}.position.{};", inst, ctx.stage_name, swizzle);
+ break;
+ default:
+ throw NotImplementedException("Get attribute {}", attr);
+ }
}
void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value,