We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1878 - Scaled texture draws with filtering produce wrapping artifacts.
Summary: Scaled texture draws with filtering produce wrapping artifacts.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.0
Hardware: x86 Windows 8
: P2 minor
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-30 08:50 UTC by Yuri K. Schlesner
Modified: 2017-12-08 19:10 UTC (History)
2 users (show)

See Also:


Attachments
Testcase (2.73 KB, text/x-c)
2013-05-30 08:50 UTC, Yuri K. Schlesner
Details
Problem screenshot (21.71 KB, image/png)
2013-05-30 08:51 UTC, Yuri K. Schlesner
Details
Proposed patch (1.55 KB, patch)
2013-05-31 22:35 UTC, Yuri K. Schlesner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri K. Schlesner 2013-05-30 08:50:28 UTC
Created attachment 1157 [details]
Testcase

When using texture filtering, there are filtering artifacts visible on the edges of scaled textures, where the texture filtering pulls in texels from the other side of the texture. Using clamping texture modes wouldn't completely fix this since source rectangles don't need to cover the whole texture. (See screenshot attached in next post.)

The opengl driver uses clamping on textures and so avoid this at least in the cases where the source rect is the whole texture. The direct3d driver does not and so has problems in every case. I'm not sure if it can actually completely be fixed, but at least enabling clamping for direct3d would be one step in the right direction.

Attached is a testcase with a test pattern that illustrates the issue.
Comment 1 Yuri K. Schlesner 2013-05-30 08:51:41 UTC
Created attachment 1158 [details]
Problem screenshot

(Note: the test program in the previous comment depends on bug #1874 to work properly.)
Comment 2 Sam Lantinga 2013-05-31 00:00:02 UTC
If everybody is okay with enabling clamping on D3D, I think that's a good fix.
It seems reasonable to have behavior parity between OpenGL and D3D as long as it doesn't cause other issues.

Do you want to submit a patch?
Comment 3 Yuri K. Schlesner 2013-05-31 22:35:53 UTC
Created attachment 1164 [details]
Proposed patch

I'd like to ask you to verify that I did this state setting in the correct places. I'm not 100% on if there was a shared initialization function that I missed where I could be doing this instead.
Comment 4 Ryan C. Gordon 2015-02-19 05:22:16 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!
Comment 5 Lothar Serra Mari 2017-11-15 21:12:08 UTC
Hi folks,

I'm a contributor to the ScummVM project [http://scummvm.org]. We use SDL2 for some of the platforms we support, mainly the Windows, Linux and macOS ports.

While testing, I noticed that this bug apparently still exists and that the proposed patch by Yuri Schlesner was not merged into the code base.

Any chance to get this merged?

Best regards
rootfather
Comment 6 C Snover 2017-12-08 18:27:47 UTC
I understand this is not a critical issue, and, it has had a patch available which seems to fix the problem for 4.5 years, and the patch is only four lines of code. Could it please be reviewed & landed? Thank you.
Comment 7 Sam Lantinga 2017-12-08 19:10:59 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/0c134b939fd9