diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl.cpp | 10 | ||||
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp | 6 |
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) { | |||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | void EmitInst(EmitContext& ctx, IR::Inst* inst) { | 85 | void EmitInst(EmitContext& ctx, IR::Inst* inst) { |
| 86 | // ctx.Add("/* {} */", inst->GetOpcode()); | 86 | // ctx.Add("/* $ {} $ */", inst->GetOpcode()); |
| 87 | switch (inst->GetOpcode()) { | 87 | switch (inst->GetOpcode()) { |
| 88 | #define OPCODE(name, result_type, ...) \ | 88 | #define OPCODE(name, result_type, ...) \ |
| 89 | case IR::Opcode::name: \ | 89 | case IR::Opcode::name: \ |
| @@ -183,11 +183,13 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR | |||
| 183 | for (size_t index = 0; index < ctx.reg_alloc.num_used_registers; ++index) { | 183 | for (size_t index = 0; index < ctx.reg_alloc.num_used_registers; ++index) { |
| 184 | ctx.header += fmt::format("{} R{};", ctx.reg_alloc.reg_types[index], index); | 184 | ctx.header += fmt::format("{} R{};", ctx.reg_alloc.reg_types[index], index); |
| 185 | } | 185 | } |
| 186 | // TODO: track usage | 186 | if (ctx.uses_cc_carry) { |
| 187 | ctx.header += "uint carry;"; | 187 | ctx.header += "uint carry;"; |
| 188 | } | ||
| 188 | if (program.info.uses_subgroup_shuffles) { | 189 | if (program.info.uses_subgroup_shuffles) { |
| 189 | ctx.header += "bool shfl_in_bounds;\n"; | 190 | ctx.header += "bool shfl_in_bounds;"; |
| 190 | } | 191 | } |
| 192 | ctx.header += "\n"; | ||
| 191 | ctx.code.insert(0, ctx.header); | 193 | ctx.code.insert(0, ctx.header); |
| 192 | ctx.code += "}"; | 194 | ctx.code += "}"; |
| 193 | // fmt::print("\n{}\n", ctx.code); | 195 | // 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, | |||
| 149 | } | 149 | } |
| 150 | break; | 150 | break; |
| 151 | case IR::Attribute::InstanceId: | 151 | case IR::Attribute::InstanceId: |
| 152 | ctx.AddS32("{}=gl_InstanceID;", inst); | 152 | ctx.AddF32("{}=intBitsToFloat(gl_InstanceID);", inst); |
| 153 | break; | 153 | break; |
| 154 | case IR::Attribute::VertexId: | 154 | case IR::Attribute::VertexId: |
| 155 | ctx.AddS32("{}=gl_VertexID;", inst); | 155 | ctx.AddF32("{}=intBitsToFloat(gl_VertexID);", inst); |
| 156 | break; | 156 | break; |
| 157 | case IR::Attribute::FrontFace: | 157 | case IR::Attribute::FrontFace: |
| 158 | ctx.AddS32("{}=gl_FrontFacing?-1:0;", inst); | 158 | ctx.AddF32("{}=intBitsToFloat(gl_FrontFacing?-1:0);", inst); |
| 159 | break; | 159 | break; |
| 160 | default: | 160 | default: |
| 161 | fmt::print("Get attribute {}", attr); | 161 | fmt::print("Get attribute {}", attr); |