Closed videah closed 8 years ago
That's strange, I've mostly been testing under that backend under Debian and Ubuntu on SDL 2.0.2, and it's been tested on Windows, not sure what version of SDL. What version of SDL are you using?
It might be something to do with scissor, can you test what happens if you set intersectScissor
equal to Backend.setScissor
in painter.lua? Just under the declaration of intersectScissor, add a line:
intersectScissor = Backend.setScissor
And if that doesn't fix it, try setting Backend.setScissor
to a no-op function and see what happens?
I'm currently on SDL 2.0.4-1, setting intersectScissor
to Backend.setScissor
does nothing, but setting Backend.setScissor
to a no-op function semi-fixes the issue.
Some other graphical issues occur due to the lack of scissor though
Yeah, the scissor is mostly there to keep stuff from scrolling out of its parent widget. 2.0.4 must handle scissors differently somehow, I'll take a look.
Well I wonder if this is relevant: https://bugzilla.libsdl.org/show_bug.cgi?id=3117
If this works in 2.0.3, I'm tempted to mark it as wontfix and wait for SDL to fix it, since 2.0.4 isn't stable yet. I wonder what other distros besides Arch are shipping 2.0.4 already.
@VideahGams can you test one more thing for me?
In Backend.setScissor
(backend/ffisdl.lua around line 260) can you add this line:
y = y and Backend.getWindowHeight() - (y + h)
So the function looks like this:
Backend.setScissor = function (x, y, w, h)
y = y and Backend.getWindowHeight() - (y + h)
lastScissor = x and sdl.Rect(x, y, w, h)
sdl.renderSetClipRect(renderer, lastScissor)
end
This flips the coordinate system so Y starts from the bottom; if scissor is flipped in that SDL version for some reason this should fix it. If it works, I guess the next step is to figure out how to isolate affected SDL versions and selectively apply the fix (I'm sure it will be / has been fixed in SDL at some point).
Sure, will do when I'm back on Arch
Doing that doesn't fix it entirely
Oops, would also need to flip it back again in getScissor
. Thanks for testing it. This workaround ought to work, but I'm not sure how to decide when it should be applied. Apply it to any SDL version >= 2.0.4 for now?
I'm going to close this for now, the workaround discussed above is commented out in the source. It's not clear to me what the status of this is in SDL head, or if the affected revisions can be singled out by version number or some kind of clever feature testing. Until this shakes out, uncomment the workaround if you're on an affected version of SDL (it's untested, so if it doesn't actually work please let me know).
If anyone has more information about this, please open a new ticket or make a pull request.
Relevant tickets in SDL's issue tracker: https://bugzilla.libsdl.org/show_bug.cgi?id=3117 and https://bugzilla.libsdl.org/show_bug.cgi?id=2700
Example runs fine with Love, but appears broken with the LuaJIT SDL backend, at least on Arch.