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 2198

Summary: SOFT RENDERER: SDL_RenderCopyEx fails to draw when texture blend mode is enabled
Product: SDL Reporter: edubart <edub4rt>
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: meklu, rush, sylvain.becker
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   
Attachments: a test case demonstrating the issue
RenderCopyEx patch
RenderCopyEx patch - v2
rotateSurface - disable RLE acceleration
One pixel off at the edge

Description edubart 2013-10-30 16:41:10 UTC
Nothing is drawn when using SDL_RenderCopyEx with SDL_BLENDMODE_BLEND enabled in the software renderer.

Code:
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
SDL_RenderCopyEx(renderer, tex, src_rect, dest_rect, 0.1, NULL, SDL_FLIP_NONE);

However when setting blend mode to SDL_BLENDMODE_NONE it works. Also using SDL_RenderCopy with SDL_BLENDMODE_BLEND seems to work fine. Something is wrong in SDL_RenderCopyEx in the software renderer. I use SDL_RenderCopyEx for drawing rects with rotation.
Comment 1 Melker Narikka 2014-07-13 22:42:48 UTC
Created attachment 1751 [details]
a test case demonstrating the issue

Here's a test case demonstrating the issue.
Comment 2 Melker Narikka 2014-07-13 22:44:06 UTC
Created attachment 1752 [details]
RenderCopyEx patch

This patch seems to fix the issue.
Comment 3 Melker Narikka 2014-07-14 10:51:55 UTC
Created attachment 1754 [details]
RenderCopyEx patch - v2

A revised patch. Since the size of the rotated surface will always match the destination rectangle, we'll just unconditionally use BlitSurface.
Comment 4 Melker Narikka 2014-07-14 10:57:35 UTC
Created attachment 1755 [details]
rotateSurface - disable RLE acceleration

For some reason setting SDL_RLEACCEL (and thus using RLEAlphaBlit instead of SoftBlit) causes the render to fail. This only affects BlitSurface rather than BlitScaled, since BlitScaled seems to always use SoftBlit.

The normal RenderCopy doesn't set any RLE flags either, and winds up using SoftBlit.
Comment 5 Damian Kaczmarek 2014-07-17 10:55:39 UTC
Created attachment 1768 [details]
One pixel off at the edge

Any idea why this is caused? (attached screenshot) Is it a bug in the test case?
Comment 6 Melker Narikka 2014-07-17 11:33:28 UTC
(In reply to Damian Kaczmarek from comment #5)
> Created attachment 1768 [details]
> One pixel off at the edge
> 
> Any idea why this is caused? (attached screenshot) Is it a bug in the test
> case?

I think you meant to post that in #2646 :)

In any case, that looks like a general issue with SDL_render.
Comment 7 Sylvain 2017-11-08 12:44:22 UTC
I tried with older version and it appears to be fixed between SDL 2.0.3 and 2.0.4. So marking as resolved.