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 4425 - SDL_CreateTextureFromSurface forget to choose an alpha format for palettes with alpha values
Summary: SDL_CreateTextureFromSurface forget to choose an alpha format for palettes wi...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: don't know
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-15 13:41 UTC by Sylvain
Modified: 2020-02-23 22:06 UTC (History)
0 users

See Also:


Attachments
test case (5.57 KB, text/x-csrc)
2018-12-15 13:42 UTC, Sylvain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain 2018-12-15 13:41:16 UTC
SDL_CreateTextureFromSurface() forget to choose a texture format with alpha for surfaces that have palette with alpha values.

In the end, it works with opengl renderer because it only has a unique format which has alpha, but it fails with software and opengles2 as it choose a non alpha format.
Comment 1 Sylvain 2018-12-15 13:42:13 UTC
Created attachment 3547 [details]
test case
Comment 2 Sylvain 2018-12-15 13:51:31 UTC
Fixed in https://hg.libsdl.org/SDL/rev/6e387413a916
Comment 3 Sylvain 2020-02-23 09:03:17 UTC
https://hg.libsdl.org/SDL/rev/c66d1c7700bd

Fixed bug 4999 - Palette surface always promoted to alpha (Thanks Cameron Gutman!)
MSVC Static analysis: Incorrect alpha_value check in SDL_render.c
Comment 4 Sylvain 2020-02-23 09:06:15 UTC
re-open because there is another issue with this situation:

- a palette surface without alpha value, but all alpha field with 0.
- using the GLES 1 render, that only has ARGB texture.

=> the texture is always transparent, whereas it should be opaque.
Comment 5 Sylvain 2020-02-23 22:06:43 UTC
Fixed in bug 3827 which has a long history