summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glasm
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-05-15 20:33:57 -0300
committerGravatar ameerj2021-07-22 21:51:31 -0400
commit3c06293e20bde507ed1bc5dabf6c66cc443c2ed4 (patch)
tree712d52932135ea21bb557c965a9e769d53d19ea1 /src/shader_recompiler/backend/glasm
parentshader_recompiler: GCC fixes (diff)
downloadyuzu-3c06293e20bde507ed1bc5dabf6c66cc443c2ed4.tar.gz
yuzu-3c06293e20bde507ed1bc5dabf6c66cc443c2ed4.tar.xz
yuzu-3c06293e20bde507ed1bc5dabf6c66cc443c2ed4.zip
emit_glasm: Add support for reading position attributes
Diffstat (limited to 'src/shader_recompiler/backend/glasm')
-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
51 51
52void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, 52void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
53 [[maybe_unused]] ScalarU32 vertex) { 53 [[maybe_unused]] ScalarU32 vertex) {
54 const u32 element{static_cast<u32>(attr) % 4};
55 const char swizzle{"xyzw"[element]};
54 if (IR::IsGeneric(attr)) { 56 if (IR::IsGeneric(attr)) {
55 const u32 index{IR::GenericAttributeIndex(attr)}; 57 const u32 index{IR::GenericAttributeIndex(attr)};
56 const u32 element{IR::GenericAttributeElement(attr)}; 58 ctx.Add("MOV.F {}.x,in_attr{}[0].{};", inst, index, swizzle);
57 ctx.Add("MOV.F {}.x,in_attr{}[0].{};", inst, index, "xyzw"[element]);
58 return; 59 return;
59 } 60 }
60 throw NotImplementedException("Get attribute {}", attr); 61 switch (attr) {
62 case IR::Attribute::PositionX:
63 case IR::Attribute::PositionY:
64 case IR::Attribute::PositionZ:
65 case IR::Attribute::PositionW:
66 ctx.Add("MOV.F {}.x,{}.position.{};", inst, ctx.stage_name, swizzle);
67 break;
68 default:
69 throw NotImplementedException("Get attribute {}", attr);
70 }
61} 71}
62 72
63void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value, 73void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value,