diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-07-31 03:04:08 -0300 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-16 22:11:29 +0100 |
commit | cfeb161c7ebf93bf6ac39e430fc998dc13abfc66 (patch) | |
tree | e77411856862dbe91ef7edb475d19e64ff1db18b /src/shader_recompiler/backend/glasm | |
parent | 4a512d6827609b13cf991d8e8efb0c789936167f (diff) |
glsl/glasm: Pass and use scaling parameters in shaders
Diffstat (limited to 'src/shader_recompiler/backend/glasm')
3 files changed, 7 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp index 4ce1c4f548..004658546b 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 header += fmt::format("SHARED_MEMORY {};", program.shared_memory_size); header += fmt::format("SHARED shared_mem[]={{program.sharedmem}};"); } + if (program.info.uses_rescaling_uniform) { + header += "PARAM scaling[1]={program.local[0..0]};"; + } header += "TEMP "; for (size_t index = 0; index < ctx.reg_alloc.NumUsedRegisters(); ++index) { 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 583ed3cf2a..05e88cd979 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 if (!index.IsImmediate()) { throw NotImplementedException("Non-constant texture rescaling"); } - UNIMPLEMENTED(); - ctx.Add("MOV.S {}.x,-1;", inst); + ctx.Add("AND.U RC.x,scaling[0].x,{};" + "SNE.S {},RC.x,0;", + 1u << index.U32(), ctx.reg_alloc.Define(inst)); } 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 77ee6dc0e0..c0f8ddcad6 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) { } void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) { - ctx.Add("MOV.F {}.x,program.env[0].x;", inst); + ctx.Add("MOV.F {}.x,scaling[0].y;", inst); } void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) { |