early-access version 2358

This commit is contained in:
pineappleEA
2021-12-30 06:46:13 +01:00
parent 5efb208ea8
commit 7232173690
10 changed files with 19 additions and 6 deletions

View File

@@ -138,7 +138,7 @@ void EmitGetAttributeU32(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, S
ctx.Add("MOV.S {}.x,{}.id;", inst, ctx.attrib_name);
break;
default:
throw NotImplementedException("Get attribute {}", attr);
throw NotImplementedException("Get U32 attribute {}", attr);
}
}

View File

@@ -7,6 +7,7 @@
#include "shader_recompiler/backend/glsl/emit_glsl_instructions.h"
#include "shader_recompiler/backend/glsl/glsl_emit_context.h"
#include "shader_recompiler/frontend/ir/value.h"
#include "shader_recompiler/profile.h"
namespace Shader::Backend::GLSL {
namespace {
@@ -30,8 +31,9 @@ void EmitConditionRef(EmitContext& ctx, IR::Inst& inst, const IR::Value& value)
inst.DestructiveAddUsage(1);
const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U1)};
const auto input{ctx.var_alloc.Consume(value)};
const auto suffix{ctx.profile.has_gl_bool_ref_bug ? "?true:false" : ""};
if (ret != input) {
ctx.Add("{}={};", ret, input);
ctx.Add("{}={}{};", ret, input, suffix);
}
}

View File

@@ -240,7 +240,7 @@ void EmitGetAttributeU32(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, s
ctx.AddU32("{}=uint(gl_VertexID);", inst);
break;
default:
throw NotImplementedException("Get attribute {}", attr);
throw NotImplementedException("Get U32 attribute {}", attr);
}
}

View File

@@ -90,7 +90,9 @@ void EmitPhiMove(EmitContext& ctx, const IR::Value& phi_value, const IR::Value&
if (phi_reg == val_reg) {
return;
}
ctx.Add("{}={};", phi_reg, val_reg);
const bool needs_workaround{ctx.profile.has_gl_bool_ref_bug && phi_type == IR::Type::U1};
const auto suffix{needs_workaround ? "?true:false" : ""};
ctx.Add("{}={}{};", phi_reg, val_reg, suffix);
}
void EmitPrologue(EmitContext& ctx) {

View File

@@ -376,7 +376,7 @@ Id EmitGetAttributeU32(EmitContext& ctx, IR::Attribute attr, Id) {
return ctx.OpISub(ctx.U32[1], index, base);
}
default:
throw NotImplementedException("Read attribute {}", attr);
throw NotImplementedException("Read U32 attribute {}", attr);
}
}

View File

@@ -67,6 +67,8 @@ struct Profile {
bool has_gl_precise_bug{};
/// Some drivers do not properly support floatBitsToUint when used on cbufs
bool has_gl_cbuf_ftou_bug{};
/// Some drivers poorly optimize boolean variable references
bool has_gl_bool_ref_bug{};
/// Ignores SPIR-V ordered vs unordered using GLSL semantics
bool ignore_nan_fp_comparisons{};