aboutsummaryrefslogtreecommitdiff
path: root/src/shader_recompiler
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-07-29 13:27:01 -0400
committerFernando Sahmkow <fsahmkow27@gmail.com>2021-11-16 22:11:28 +0100
commitf086c82e1f80cae088bb22de9092598dc51979da (patch)
tree8e055b4397c2dc9288a8fed65daf171488ecadc9 /src/shader_recompiler
parent2182d2575010a5a85c99c09c6a1c57962242444d (diff)
gl_graphics_pipeline: Add downscale factor to shader uniforms
Diffstat (limited to 'src/shader_recompiler')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp3
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp3
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp3
3 files changed, 5 insertions, 4 deletions
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 807494063d..77ee6dc0e0 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp
@@ -211,8 +211,7 @@ void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
}
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) {
- UNIMPLEMENTED();
- ctx.Add("MOV.F {}.x,1;", inst);
+ ctx.Add("MOV.F {}.x,program.env[0].x;", inst);
}
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 4e6f2c0fe6..7c9ed9159c 100644
--- a/src/shader_recompiler/backend/glsl/emit_context.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_context.cpp
@@ -393,6 +393,9 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
DefineGenericOutput(index, program.invocations);
}
}
+ if (info.uses_rescaling_uniform) {
+ header += "layout(location=0) uniform float down_factor;";
+ }
DefineConstantBuffers(bindings);
DefineStorageBuffers(bindings);
SetupImages(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 f4ed090e3c..3db3083f9d 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,8 +446,7 @@ void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
}
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) {
- UNIMPLEMENTED();
- ctx.AddF32("{}=1.0f;", inst);
+ ctx.AddF32("{}=down_factor;", inst);
}
void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) {