mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 13:26:30 -05:00
glsl: Fix GetAttribute return values
fixes font rendering issues as these were used to index into the ssbos
This commit is contained in:
parent
1542f31e79
commit
80eec85867
2 changed files with 10 additions and 8 deletions
|
@ -83,7 +83,7 @@ void Invoke(EmitContext& ctx, IR::Inst* inst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitInst(EmitContext& ctx, IR::Inst* inst) {
|
void EmitInst(EmitContext& ctx, IR::Inst* inst) {
|
||||||
// ctx.Add("/* {} */", inst->GetOpcode());
|
// ctx.Add("/* $ {} $ */", inst->GetOpcode());
|
||||||
switch (inst->GetOpcode()) {
|
switch (inst->GetOpcode()) {
|
||||||
#define OPCODE(name, result_type, ...) \
|
#define OPCODE(name, result_type, ...) \
|
||||||
case IR::Opcode::name: \
|
case IR::Opcode::name: \
|
||||||
|
@ -183,11 +183,13 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR
|
||||||
for (size_t index = 0; index < ctx.reg_alloc.num_used_registers; ++index) {
|
for (size_t index = 0; index < ctx.reg_alloc.num_used_registers; ++index) {
|
||||||
ctx.header += fmt::format("{} R{};", ctx.reg_alloc.reg_types[index], index);
|
ctx.header += fmt::format("{} R{};", ctx.reg_alloc.reg_types[index], index);
|
||||||
}
|
}
|
||||||
// TODO: track usage
|
if (ctx.uses_cc_carry) {
|
||||||
ctx.header += "uint carry;";
|
ctx.header += "uint carry;";
|
||||||
if (program.info.uses_subgroup_shuffles) {
|
|
||||||
ctx.header += "bool shfl_in_bounds;\n";
|
|
||||||
}
|
}
|
||||||
|
if (program.info.uses_subgroup_shuffles) {
|
||||||
|
ctx.header += "bool shfl_in_bounds;";
|
||||||
|
}
|
||||||
|
ctx.header += "\n";
|
||||||
ctx.code.insert(0, ctx.header);
|
ctx.code.insert(0, ctx.header);
|
||||||
ctx.code += "}";
|
ctx.code += "}";
|
||||||
// fmt::print("\n{}\n", ctx.code);
|
// fmt::print("\n{}\n", ctx.code);
|
||||||
|
|
|
@ -149,13 +149,13 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IR::Attribute::InstanceId:
|
case IR::Attribute::InstanceId:
|
||||||
ctx.AddS32("{}=gl_InstanceID;", inst);
|
ctx.AddF32("{}=intBitsToFloat(gl_InstanceID);", inst);
|
||||||
break;
|
break;
|
||||||
case IR::Attribute::VertexId:
|
case IR::Attribute::VertexId:
|
||||||
ctx.AddS32("{}=gl_VertexID;", inst);
|
ctx.AddF32("{}=intBitsToFloat(gl_VertexID);", inst);
|
||||||
break;
|
break;
|
||||||
case IR::Attribute::FrontFace:
|
case IR::Attribute::FrontFace:
|
||||||
ctx.AddS32("{}=gl_FrontFacing?-1:0;", inst);
|
ctx.AddF32("{}=intBitsToFloat(gl_FrontFacing?-1:0);", inst);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fmt::print("Get attribute {}", attr);
|
fmt::print("Get attribute {}", attr);
|
||||||
|
|
Loading…
Reference in a new issue