Skip to content

Commit

Permalink
vulkan: fix love_ScreenSize shader variable when a canvas is active.
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Mar 23, 2024
1 parent 339c1ac commit 9aaeabd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/modules/graphics/vulkan/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1430,8 +1430,17 @@ graphics::Shader::BuiltinUniformData Graphics::getCurrentBuiltinUniformData()
// Same with point size.
data.normalMatrix[1].w = getPointSize();

data.screenSizeParams.x = static_cast<float>(swapChainExtent.width);
data.screenSizeParams.y = static_cast<float>(swapChainExtent.height);
const auto &rt = states.back().renderTargets.getFirstTarget();
if (rt.texture != nullptr)
{
data.screenSizeParams.x = rt.texture->getPixelWidth(rt.mipmap);
data.screenSizeParams.y = rt.texture->getPixelHeight(rt.mipmap);
}
else
{
data.screenSizeParams.x = getPixelWidth();
data.screenSizeParams.y = getPixelHeight();
}

data.screenSizeParams.z = 1.0f;
data.screenSizeParams.w = 0.0f;
Expand Down

0 comments on commit 9aaeabd

Please sign in to comment.