diff options
Diffstat (limited to 'src/shader_recompiler/backend')
6 files changed, 11 insertions, 7 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp index 4ce1c4f54..004658546 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp | |||
| @@ -448,6 +448,9 @@ std::string EmitGLASM(const Profile& profile, const RuntimeInfo& runtime_info, I | |||
| 448 | header += fmt::format("SHARED_MEMORY {};", program.shared_memory_size); | 448 | header += fmt::format("SHARED_MEMORY {};", program.shared_memory_size); |
| 449 | header += fmt::format("SHARED shared_mem[]={{program.sharedmem}};"); | 449 | header += fmt::format("SHARED shared_mem[]={{program.sharedmem}};"); |
| 450 | } | 450 | } |
| 451 | if (program.info.uses_rescaling_uniform) { | ||
| 452 | header += "PARAM scaling[1]={program.local[0..0]};"; | ||
| 453 | } | ||
| 451 | header += "TEMP "; | 454 | header += "TEMP "; |
| 452 | for (size_t index = 0; index < ctx.reg_alloc.NumUsedRegisters(); ++index) { | 455 | for (size_t index = 0; index < ctx.reg_alloc.NumUsedRegisters(); ++index) { |
| 453 | header += fmt::format("R{},", index); | 456 | header += fmt::format("R{},", index); |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp index 583ed3cf2..05e88cd97 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | |||
| @@ -612,8 +612,9 @@ void EmitIsTextureScaled(EmitContext& ctx, IR::Inst& inst, const IR::Value& inde | |||
| 612 | if (!index.IsImmediate()) { | 612 | if (!index.IsImmediate()) { |
| 613 | throw NotImplementedException("Non-constant texture rescaling"); | 613 | throw NotImplementedException("Non-constant texture rescaling"); |
| 614 | } | 614 | } |
| 615 | UNIMPLEMENTED(); | 615 | ctx.Add("AND.U RC.x,scaling[0].x,{};" |
| 616 | ctx.Add("MOV.S {}.x,-1;", inst); | 616 | "SNE.S {},RC.x,0;", |
| 617 | 1u << index.U32(), ctx.reg_alloc.Define(inst)); | ||
| 617 | } | 618 | } |
| 618 | 619 | ||
| 619 | void EmitImageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord, | 620 | void EmitImageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord, |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp index 77ee6dc0e..c0f8ddcad 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp | |||
| @@ -211,7 +211,7 @@ void EmitYDirection(EmitContext& ctx, IR::Inst& inst) { | |||
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) { | 213 | void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) { |
| 214 | ctx.Add("MOV.F {}.x,program.env[0].x;", inst); | 214 | ctx.Add("MOV.F {}.x,scaling[0].y;", inst); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) { | 217 | void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) { |
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp index 7c9ed9159..97bd59302 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp | |||
| @@ -394,7 +394,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile | |||
| 394 | } | 394 | } |
| 395 | } | 395 | } |
| 396 | if (info.uses_rescaling_uniform) { | 396 | if (info.uses_rescaling_uniform) { |
| 397 | header += "layout(location=0) uniform float down_factor;"; | 397 | header += "layout(location=0) uniform vec4 scaling;"; |
| 398 | } | 398 | } |
| 399 | DefineConstantBuffers(bindings); | 399 | DefineConstantBuffers(bindings); |
| 400 | DefineStorageBuffers(bindings); | 400 | DefineStorageBuffers(bindings); |
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 3db3083f9..542a79230 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 | |||
| @@ -446,7 +446,7 @@ void EmitYDirection(EmitContext& ctx, IR::Inst& inst) { | |||
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) { | 448 | void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) { |
| 449 | ctx.AddF32("{}=down_factor;", inst); | 449 | ctx.AddF32("{}=scaling.y;", inst); |
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) { | 452 | void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) { |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp index 099e0160b..82b6f0d77 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | |||
| @@ -616,8 +616,8 @@ void EmitIsTextureScaled(EmitContext& ctx, IR::Inst& inst, const IR::Value& inde | |||
| 616 | if (!index.IsImmediate()) { | 616 | if (!index.IsImmediate()) { |
| 617 | throw NotImplementedException("Non-constant texture rescaling"); | 617 | throw NotImplementedException("Non-constant texture rescaling"); |
| 618 | } | 618 | } |
| 619 | UNIMPLEMENTED(); | 619 | const u32 image_index{index.U32()}; |
| 620 | ctx.AddU1("{}=true;", inst); | 620 | ctx.AddU1("{}=(ftou(scaling.x)&{})!=0;", inst, 1u << image_index); |
| 621 | } | 621 | } |
| 622 | 622 | ||
| 623 | void EmitBindlessImageSampleImplicitLod(EmitContext&) { | 623 | void EmitBindlessImageSampleImplicitLod(EmitContext&) { |