diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-07-31 08:04:08 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-16 22:11:29 +0100 |
commit | cfeb161c7ebf93bf6ac39e430fc998dc13abfc66 (patch) | |
tree | e77411856862dbe91ef7edb475d19e64ff1db18b /src/video_core/renderer_opengl/gl_compute_pipeline.cpp | |
parent | gl_rasterizer: Properly scale viewports and scissors (diff) | |
download | yuzu-cfeb161c7ebf93bf6ac39e430fc998dc13abfc66.tar yuzu-cfeb161c7ebf93bf6ac39e430fc998dc13abfc66.tar.gz yuzu-cfeb161c7ebf93bf6ac39e430fc998dc13abfc66.tar.bz2 yuzu-cfeb161c7ebf93bf6ac39e430fc998dc13abfc66.tar.lz yuzu-cfeb161c7ebf93bf6ac39e430fc998dc13abfc66.tar.xz yuzu-cfeb161c7ebf93bf6ac39e430fc998dc13abfc66.tar.zst yuzu-cfeb161c7ebf93bf6ac39e430fc998dc13abfc66.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_compute_pipeline.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_compute_pipeline.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp index a11bd5a02..12093c3c4 100644 --- a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp @@ -148,14 +148,8 @@ void ComputePipeline::Configure() { const f32 down_factor{is_rescaling ? config_down_factor : 1.0f}; if (assembly_program.handle != 0) { program_manager.BindComputeAssemblyProgram(assembly_program.handle); - if (info.uses_rescaling_uniform) { - glProgramEnvParameter4fARB(GL_COMPUTE_PROGRAM_NV, 0, down_factor, 0.0f, 0.0f, 1.0f); - } } else { program_manager.BindComputeProgram(source_program.handle); - if (info.uses_rescaling_uniform) { - glProgramUniform1f(source_program.handle, 0, down_factor); - } } buffer_cache.UnbindComputeTextureBuffers(); size_t texbuf_index{}; @@ -187,10 +181,16 @@ void ComputePipeline::Configure() { texture_binding += num_texture_buffers; image_binding += num_image_buffers; + u32 scaling_mask{}; for (const auto& desc : info.texture_descriptors) { for (u32 index = 0; index < desc.count; ++index) { ImageView& image_view{texture_cache.GetImageView((views_it++)->id)}; - textures[texture_binding++] = image_view.Handle(desc.type); + textures[texture_binding] = image_view.Handle(desc.type); + if (True(texture_cache.GetImage(image_view.image_id).flags & + VideoCommon::ImageFlagBits::Rescaled)) { + scaling_mask |= 1u << texture_binding; + } + ++texture_binding; } } for (const auto& desc : info.image_descriptors) { @@ -202,6 +202,15 @@ void ComputePipeline::Configure() { images[image_binding++] = image_view.StorageView(desc.type, desc.format); } } + if (info.uses_rescaling_uniform) { + const f32 float_scaling_mask{Common::BitCast<f32>(scaling_mask)}; + if (assembly_program.handle != 0) { + glProgramLocalParameter4fARB(GL_COMPUTE_PROGRAM_NV, 0, float_scaling_mask, 0.0f, 0.0f, + 0.0f); + } else { + glProgramUniform4f(source_program.handle, 0, float_scaling_mask, 0.0f, 0.0f, 0.0f); + } + } if (texture_binding != 0) { ASSERT(texture_binding == sampler_binding); glBindTextures(0, texture_binding, textures.data()); |