| Summary: | Problems with software renderer when SDL_SetRenderLogicalSize set | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Damian Kaczmarek <rush> |
| Component: | render | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | dm2, meklu |
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
Example showing the problem
Example showing the problem Screenshot of bug SetLogicalSize patch Example showing the problem SetLogicalSize patch - v2 Example showing the problem SetLogicalSize patch - v3 SetLogicalSize patch - v4 Patch for current SDL2 version SetLogicalSize patch - v5 |
||
Created attachment 1762 [details]
Example showing the problem
Created attachment 1763 [details]
Screenshot of bug
Created attachment 1767 [details] SetLogicalSize patch (Note that this patch also includes patches 1754 and 1755 from bug #2198.) This patch seems to fix the behaviour of the test case. I also added these lines to the test case after the RenderCopy call to test the RenderCopyEx clipping (which this patch addresses as well): SDL_SetTextureColorMod(semiTransparentTexture, 255, 0, 255); SDL_RenderCopyEx(renderer, semiTransparentTexture, &a, &b, 45.0, NULL, SDL_FLIP_NONE); SDL_SetTextureColorMod(semiTransparentTexture, 255, 255, 255); Created attachment 1769 [details]
Example showing the problem
Updated test case to show problems when rendering the texture at x < 0
Created attachment 1774 [details]
SetLogicalSize patch - v2
Here's an updated patch that should work, mostly at the very least. There's a weird offset issue with this patch with RenderCopyEx and rotated surfaces though, where I'm getting results that are (1px, 2px) off. This might be due to lossy integer arithmetic.
Thanks for the latest patch. It is much better but I still find a lot of issues .. need to think how to update the test code. Created attachment 1775 [details]
Example showing the problem
Two problems, first see the difference of rendering at the beginning of the rendering code. The rectangle is displayed well .. kind of shifted at the beginning. Second problem is triggered by playing with the size of the window with the mouse, lots of artifacts are being created when resizing the software windows with the mouse.
Created attachment 1776 [details] SetLogicalSize patch - v3 I was supposed to make the if/elif/else blocks if+if/else. Hmm, here I thought I had done just that. Anyway, that addresses the shifted rectangle issue, which was caused by ignoring some fairly important offsets when the rectangle was rendered at negative coordinates. As for the visual artifact issue, I think that's due to not clearing the renderer between frames. I'm getting some really nasty window damage when resizing the hardware-backed renderer[1]. Curiously enough, the software renderer doesn't do this on my system... Is this similar to what you're seeing? [1] http://i.imgur.com/9tBag9t.png I confirm the newest patch fixes the shift. For me hardware renderer works properly and only software leaves the window damage [1] I am using NVIDIA blob drivers. [1] http://x.rushbase.net/ebb4c6f9a824f424944497e1f78572b560f13c7e/damage.png Created attachment 1777 [details]
SetLogicalSize patch - v4
Here's an updated patch with some silliness removed. Should behave identically to v3.
Created attachment 2405 [details]
Patch for current SDL2 version
Minimum patch file for fixing this bug on current SDL2 version (as of 29-March-2016), based on SetLogicalSize patch - v4
Created attachment 2406 [details]
SetLogicalSize patch - v5
(Now with the right format)
Minimum patch file for fixing this bug on current SDL2 version (as of 29-March-2016), based on SetLogicalSize patch - v4.
It passed the example attached to this bug report and the issues I found during my developement.
Many thanks to the original author (Melker Narikka)!!!
Cheers
Roberto
Fixed, thanks! https://hg.libsdl.org/SDL/rev/42b62c737891 |
Created attachment 1761 [details] Example showing the problem When SDL_RenderSetLogicalSize is set the behavior of software renderer is buggy: Couple of problems: 1) Weird software renderer texture contraption while rendering textures on edges 2) Software renderer does not add black borders at all which makes it not viable to use with resizeable windows at all. Also there is an accidentally discovered problem with black borders on hardware renderer - see Hardware window #2 in the demo Note: requires latest HG since the test is based on other bugs being fixed Compile and run with: g++ sdl_software_renderer_logical_size_problems.cpp -lSDL2 && ./a.out