Skip to content

Commit

Permalink
metal: fix love_ScreenSize shader variable when rendering to a non-de…
Browse files Browse the repository at this point in the history
…fault mipmap level of a Canvas.
  • Loading branch information
slime73 committed Mar 23, 2024
1 parent 9aaeabd commit 1e657ea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/modules/graphics/metal/Graphics.mm
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,8 @@ static bool isClampOne(SamplerState::WrapMode w)
const auto &rt = state.renderTargets.getFirstTarget();
if (rt.texture.get())
{
rtw = rt.texture->getPixelWidth();
rth = rt.texture->getPixelHeight();
rtw = rt.texture->getPixelWidth(rt.mipmap);
rth = rt.texture->getPixelHeight(rt.mipmap);
}
else
{
Expand Down Expand Up @@ -1134,11 +1134,11 @@ static bool isClampOne(SamplerState::WrapMode w)
builtins->normalMatrix[1].w = getPointSize();

builtins->screenSizeParams = Vector4(getPixelWidth(), getPixelHeight(), 1.0f, 0.0f);
auto rt = states.back().renderTargets.getFirstTarget().texture.get();
if (rt != nullptr)
auto rt = states.back().renderTargets.getFirstTarget();
if (rt.texture.get())
{
builtins->screenSizeParams.x = rt->getPixelWidth();
builtins->screenSizeParams.y = rt->getPixelHeight();
builtins->screenSizeParams.x = rt.texture->getPixelWidth(rt.mipmap);
builtins->screenSizeParams.y = rt.texture->getPixelHeight(rt.mipmap);
}

builtins->constantColor = getColor();
Expand Down

0 comments on commit 1e657ea

Please sign in to comment.