mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-16 01:32:58 +00:00
emit_glasm: Add support for reading position attributes
This commit is contained in:
parent
f7a2340205
commit
3c06293e20
|
@ -51,14 +51,24 @@ void EmitGetCbufU32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding
|
||||||
|
|
||||||
void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
|
void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
|
||||||
[[maybe_unused]] ScalarU32 vertex) {
|
[[maybe_unused]] ScalarU32 vertex) {
|
||||||
|
const u32 element{static_cast<u32>(attr) % 4};
|
||||||
|
const char swizzle{"xyzw"[element]};
|
||||||
if (IR::IsGeneric(attr)) {
|
if (IR::IsGeneric(attr)) {
|
||||||
const u32 index{IR::GenericAttributeIndex(attr)};
|
const u32 index{IR::GenericAttributeIndex(attr)};
|
||||||
const u32 element{IR::GenericAttributeElement(attr)};
|
ctx.Add("MOV.F {}.x,in_attr{}[0].{};", inst, index, swizzle);
|
||||||
ctx.Add("MOV.F {}.x,in_attr{}[0].{};", inst, index, "xyzw"[element]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
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);
|
throw NotImplementedException("Get attribute {}", attr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value,
|
void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value,
|
||||||
[[maybe_unused]] ScalarU32 vertex) {
|
[[maybe_unused]] ScalarU32 vertex) {
|
||||||
|
|
Loading…
Reference in a new issue