summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glsl
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-05-30 02:19:24 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:36 +0200
commit80eec858678abeec988ca6390cb2e0636cfcdc98 (patch)
treeb7f864bc31f934a14d1d210124d5427d5c686336 /src/shader_recompiler/backend/glsl
parentglsl: minor cleanup (diff)
downloadyuzu-80eec858678abeec988ca6390cb2e0636cfcdc98.tar
yuzu-80eec858678abeec988ca6390cb2e0636cfcdc98.tar.gz
yuzu-80eec858678abeec988ca6390cb2e0636cfcdc98.tar.bz2
yuzu-80eec858678abeec988ca6390cb2e0636cfcdc98.tar.lz
yuzu-80eec858678abeec988ca6390cb2e0636cfcdc98.tar.xz
yuzu-80eec858678abeec988ca6390cb2e0636cfcdc98.tar.zst
yuzu-80eec858678abeec988ca6390cb2e0636cfcdc98.zip
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl.cpp10
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp6
2 files changed, 9 insertions, 7 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cpp
index 8705daeee..f9ad71f92 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp
@@ -83,7 +83,7 @@ void Invoke(EmitContext& ctx, IR::Inst* inst) {
}
void EmitInst(EmitContext& ctx, IR::Inst* inst) {
- // ctx.Add("/* {} */", inst->GetOpcode());
+ // ctx.Add("/* $ {} $ */", inst->GetOpcode());
switch (inst->GetOpcode()) {
#define OPCODE(name, result_type, ...) \
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) {
ctx.header += fmt::format("{} R{};", ctx.reg_alloc.reg_types[index], index);
}
- // TODO: track usage
- ctx.header += "uint carry;";
+ if (ctx.uses_cc_carry) {
+ ctx.header += "uint carry;";
+ }
if (program.info.uses_subgroup_shuffles) {
- ctx.header += "bool shfl_in_bounds;\n";
+ ctx.header += "bool shfl_in_bounds;";
}
+ ctx.header += "\n";
ctx.code.insert(0, ctx.header);
ctx.code += "}";
// fmt::print("\n{}\n", ctx.code);
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
index 03caaacec..c20747819 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
@@ -149,13 +149,13 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
}
break;
case IR::Attribute::InstanceId:
- ctx.AddS32("{}=gl_InstanceID;", inst);
+ ctx.AddF32("{}=intBitsToFloat(gl_InstanceID);", inst);
break;
case IR::Attribute::VertexId:
- ctx.AddS32("{}=gl_VertexID;", inst);
+ ctx.AddF32("{}=intBitsToFloat(gl_VertexID);", inst);
break;
case IR::Attribute::FrontFace:
- ctx.AddS32("{}=gl_FrontFacing?-1:0;", inst);
+ ctx.AddF32("{}=intBitsToFloat(gl_FrontFacing?-1:0);", inst);
break;
default:
fmt::print("Get attribute {}", attr);