mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-15 21:42:58 +00:00
gl_graphics_pipeline: Add downscale factor to shader uniforms
This commit is contained in:
parent
2182d25750
commit
f086c82e1f
|
@ -211,8 +211,7 @@ void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) {
|
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) {
|
||||||
UNIMPLEMENTED();
|
ctx.Add("MOV.F {}.x,program.env[0].x;", inst);
|
||||||
ctx.Add("MOV.F {}.x,1;", inst);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) {
|
void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) {
|
||||||
|
|
|
@ -393,6 +393,9 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
|
||||||
DefineGenericOutput(index, program.invocations);
|
DefineGenericOutput(index, program.invocations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (info.uses_rescaling_uniform) {
|
||||||
|
header += "layout(location=0) uniform float down_factor;";
|
||||||
|
}
|
||||||
DefineConstantBuffers(bindings);
|
DefineConstantBuffers(bindings);
|
||||||
DefineStorageBuffers(bindings);
|
DefineStorageBuffers(bindings);
|
||||||
SetupImages(bindings);
|
SetupImages(bindings);
|
||||||
|
|
|
@ -446,8 +446,7 @@ void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) {
|
void EmitResolutionDownFactor(EmitContext& ctx, IR::Inst& inst) {
|
||||||
UNIMPLEMENTED();
|
ctx.AddF32("{}=down_factor;", inst);
|
||||||
ctx.AddF32("{}=1.0f;", inst);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) {
|
void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) {
|
||||||
|
|
|
@ -443,11 +443,24 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
||||||
if (!is_built.load(std::memory_order::relaxed)) {
|
if (!is_built.load(std::memory_order::relaxed)) {
|
||||||
WaitForBuild();
|
WaitForBuild();
|
||||||
}
|
}
|
||||||
if (assembly_programs[0].handle != 0) {
|
const bool use_assembly{assembly_programs[0].handle != 0};
|
||||||
|
const bool is_rescaling{texture_cache.IsRescaling()};
|
||||||
|
const f32 config_down_factor{Settings::values.resolution_info.down_factor};
|
||||||
|
const f32 down_factor{is_rescaling ? config_down_factor : 1.0f};
|
||||||
|
if (use_assembly) {
|
||||||
program_manager.BindAssemblyPrograms(assembly_programs, enabled_stages_mask);
|
program_manager.BindAssemblyPrograms(assembly_programs, enabled_stages_mask);
|
||||||
} else {
|
} else {
|
||||||
program_manager.BindSourcePrograms(source_programs);
|
program_manager.BindSourcePrograms(source_programs);
|
||||||
}
|
}
|
||||||
|
for (size_t stage = 0; stage < source_programs.size(); ++stage) {
|
||||||
|
if (stage_infos[stage].uses_rescaling_uniform) {
|
||||||
|
if (use_assembly) {
|
||||||
|
glProgramEnvParameter4fARB(AssemblyStage(stage), 0, down_factor, 0.0f, 0.0f, 1.0f);
|
||||||
|
} else {
|
||||||
|
glProgramUniform1f(source_programs[stage].handle, 0, down_factor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const VideoCommon::ImageViewInOut* views_it{views.data()};
|
const VideoCommon::ImageViewInOut* views_it{views.data()};
|
||||||
GLsizei texture_binding = 0;
|
GLsizei texture_binding = 0;
|
||||||
GLsizei image_binding = 0;
|
GLsizei image_binding = 0;
|
||||||
|
|
Loading…
Reference in a new issue