diff options
| author | 2021-07-31 03:04:08 -0300 | |
|---|---|---|
| committer | 2021-11-16 22:11:29 +0100 | |
| commit | cfeb161c7ebf93bf6ac39e430fc998dc13abfc66 (patch) | |
| tree | e77411856862dbe91ef7edb475d19e64ff1db18b /src/shader_recompiler/backend/glsl | |
| parent | gl_rasterizer: Properly scale viewports and scissors (diff) | |
| download | yuzu-cfeb161c7ebf93bf6ac39e430fc998dc13abfc66.tar.gz yuzu-cfeb161c7ebf93bf6ac39e430fc998dc13abfc66.tar.xz yuzu-cfeb161c7ebf93bf6ac39e430fc998dc13abfc66.zip | |
glsl/glasm: Pass and use scaling parameters in shaders
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
3 files changed, 4 insertions, 4 deletions
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&) { |