glsl: implement set clip distance

and missed a diff in emit_glsl relating to var alloc ref counting
This commit is contained in:
ameerj 2021-05-30 19:21:30 -04:00
parent 9f3ffb996b
commit 8ec0028e68
2 changed files with 15 additions and 0 deletions

View file

@ -112,6 +112,9 @@ void PrecolorInst(IR::Inst& phi) {
ir.PhiMove(phi, IR::Value{arg.InstRecursive()}); ir.PhiMove(phi, IR::Value{arg.InstRecursive()});
} }
} }
for (size_t i = 0; i < num_args; ++i) {
IR::IREmitter{*phi.PhiBlock(i)}.Reference(IR::Value{&phi});
}
} }
void Precolor(const IR::Program& program) { void Precolor(const IR::Program& program) {

View file

@ -186,6 +186,18 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view val
case IR::Attribute::PositionW: case IR::Attribute::PositionW:
ctx.Add("gl_Position.{}={};", swizzle, value); ctx.Add("gl_Position.{}={};", swizzle, value);
break; break;
case IR::Attribute::ClipDistance0:
case IR::Attribute::ClipDistance1:
case IR::Attribute::ClipDistance2:
case IR::Attribute::ClipDistance3:
case IR::Attribute::ClipDistance4:
case IR::Attribute::ClipDistance5:
case IR::Attribute::ClipDistance6:
case IR::Attribute::ClipDistance7: {
const u32 index{static_cast<u32>(attr) - static_cast<u32>(IR::Attribute::ClipDistance0)};
ctx.Add("gl_ClipDistance[{}]={};", index, value);
break;
}
default: default:
fmt::print("Set attribute {}", attr); fmt::print("Set attribute {}", attr);
throw NotImplementedException("Set attribute {}", attr); throw NotImplementedException("Set attribute {}", attr);