glsl: Enable early fragment tests

This commit is contained in:
ameerj 2021-06-09 01:16:25 -04:00
parent 6650c4799d
commit 14bd73db36
2 changed files with 7 additions and 4 deletions

View file

@ -266,6 +266,9 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
case Stage::Fragment: case Stage::Fragment:
stage_name = "fs"; stage_name = "fs";
position_name = "gl_FragCoord"; position_name = "gl_FragCoord";
if (runtime_info.force_early_z) {
header += "layout(early_fragment_tests)in;";
}
break; break;
case Stage::Compute: case Stage::Compute:
stage_name = "cs"; stage_name = "cs";

View file

@ -47,17 +47,17 @@ void EmitFPAdd16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& i
void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
if (Precise(inst)) { if (Precise(inst)) {
ctx.AddPrecF32("{}=float({})+float({});", inst, a, b); ctx.AddPrecF32("{}={}+{};", inst, a, b);
} else { } else {
ctx.AddF32("{}=float({})+float({});", inst, a, b); ctx.AddF32("{}={}+{};", inst, a, b);
} }
} }
void EmitFPAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { void EmitFPAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
if (Precise(inst)) { if (Precise(inst)) {
ctx.AddPrecF64("{}=double({})+double({});", inst, a, b); ctx.AddPrecF64("{}={}+{};", inst, a, b);
} else { } else {
ctx.AddF64("{}=double({})+double({});", inst, a, b); ctx.AddF64("{}={}+{};", inst, a, b);
} }
} }