Move getting the effective res into SetUniformParameters

This commit is contained in:
goeiecool9999 2024-10-29 21:10:00 +01:00
parent c98a0c3ae5
commit 6074e90497
3 changed files with 7 additions and 8 deletions

View File

@ -570,13 +570,10 @@ void OpenGLRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutpu
g_renderer->ClearColorbuffer(padView);
}
sint32 effectiveWidth, effectiveHeight;
texView->baseTexture->GetEffectiveSize(effectiveWidth, effectiveHeight, 0);
shader_unbind(RendererShader::ShaderType::kGeometry);
shader_bind(shader->GetVertexShader());
shader_bind(shader->GetFragmentShader());
shader->SetUniformParameters(*texView, { effectiveWidth, effectiveHeight }, { imageWidth, imageHeight });
shader->SetUniformParameters(*texView, {imageWidth, imageHeight});
// set viewport
glViewportIndexedf(0, imageX, imageY, imageWidth, imageHeight);

View File

@ -142,14 +142,16 @@ RendererOutputShader::RendererOutputShader(const std::string& vertex_source, con
}
}
void RendererOutputShader::SetUniformParameters(const LatteTextureView& texture_view, const Vector2i& input_res, const Vector2i& output_res) const
void RendererOutputShader::SetUniformParameters(const LatteTextureView& texture_view, const Vector2i& output_res) const
{
sint32 effectiveWidth, effectiveHeight;
texture_view.baseTexture->GetEffectiveSize(effectiveWidth, effectiveHeight, 0);
auto setUniforms = [&](RendererShader* shader, const UniformLocations& attributes){
float res[2];
if (attributes.m_loc_textureSrcResolution != -1)
{
res[0] = (float)input_res.x;
res[1] = (float)input_res.y;
res[0] = (float)effectiveWidth;
res[1] = (float)effectiveHeight;
shader->SetUniform2fv(attributes.m_loc_textureSrcResolution, res, 1);
}

View File

@ -17,7 +17,7 @@ public:
RendererOutputShader(const std::string& vertex_source, const std::string& fragment_source);
virtual ~RendererOutputShader() = default;
void SetUniformParameters(const LatteTextureView& texture_view, const Vector2i& input_res, const Vector2i& output_res) const;
void SetUniformParameters(const LatteTextureView& texture_view, const Vector2i& output_res) const;
RendererShader* GetVertexShader() const
{