Commit Graph

704 Commits

Author SHA1 Message Date
Sam Lantinga
7739392c5b Worked around "Undefined symbol: ___isPlatformVersionAtLeast()" link error on Xcode 11 beta 2019-06-14 13:56:42 -07:00
Ryan C. Gordon
2cab37bb4b software: Fixed compiler warning and dos2unix'd the endlines. 2019-06-11 15:06:35 -04:00
Ryan C. Gordon
8d3646604b software: Correctly track viewport and cliprect.
Fixes Bugzilla #4457.
2019-06-11 14:09:53 -04:00
Ryan C. Gordon
ac3dae1fbd direct3d: Use D3DPOOL_MANAGED for vertex buffers.
Fixes Bugzilla #4537.
2019-06-11 13:02:56 -04:00
Ryan C. Gordon
4a5112ca53 direct3d: Fixed SDL_RenderSetClipRect usage.
Fixes Bugzilla #4459.
2019-06-11 10:12:47 -04:00
Ryan C. Gordon
e4272c78f4 direct3d: don't dereference bogus pointer if current texture was destroyed.
Fixes Bugzilla #4460.
2019-06-11 09:29:48 -04:00
Ryan C. Gordon
73a673e2af direct3d: Fixed more compiler warnings on Visual Studio 64-bit builds. 2019-06-11 02:31:57 -04:00
Sam Lantinga
c17aa515bd Fixed compiler warning
warning C4018: '<' : signed/unsigned mismatch
2019-06-08 19:12:05 -07:00
Sam Lantinga
92ab8688d3 Fixed bug 4469 - make SDL_CreateTextureFromSurface pick a more appropriate format
Sylvain

Currently SDL_CreateTextureFromSurface picks first valid format, and do a conversion.

    format = renderer->info.texture_formats[0];
    for (i = 0; i < renderer->info.num_texture_formats; ++i) {
        if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) &&
            SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) {
            format = renderer->info.texture_formats[i];
            break;

It could try to find a better format, for instance :

 if SDL_Surface has no Amask, but a colorkey :
   if surface fmt is RGB888, try to pick ARGB8888 renderer fmt
   if surface fmt is BGR888, try to pick ABGR8888 renderer fmt
 else
   try to pick the same renderer format as surface fmt

if no format has been picked, use the fallback.


I think it goes with bug 4290 fastpath BlitNtoN
when you expand a surface with pixel format of size 24 to 32, there is a fast path possible.


So with this issue:

- if you have a surface with colorkey (RGB or BGR, not palette), it takes a renderer format where the conversion is faster.
  (it avoids, if possible, RGB -> ABGR which means switching RGB to BGR)

- if you have a surface ABGR format, it try to take the ABGR from the renderer.
  (it avoids, if possible, ABGR -> ARGB, which means switch RGB to BGR)
2019-05-19 12:04:06 -07:00
Sam Lantinga
35ddb8e320 Fixed bug 4025 - SDL_Renderer OpenGL : add support for textures ABGR, RGB, BGR
Sylvain

OpenGLES2 SDL renderer has support for textures ARGB, ABGR, RGB and BGR, whereas OpenGL SDL renderer only had ARGB.

If you think it's worth adding it, here's a patch. I quickly tried and it worked, but there may be missing things or corner case.
2019-05-19 11:01:36 -07:00
Sylvain Becker
11b3900b3a Fixed bug 4582 - Maximize/Resize not working on Windows 10
When viewport is set, projectionAndView changes, but ID3D11DeviceContext_UpdateSubresource was not called.
2019-04-08 13:43:48 +02:00
Ryan C. Gordon
78998f2417 opengles2: Fix static analysis warning.
Not clear if this could ever dereference NULL in real life, but better safe
than sorry!
2019-03-21 10:39:49 -04:00
Sam Lantinga
672c79130e Fixed Windows RT build 2019-03-19 16:52:09 -07:00
Sylvain Becker
0b82cde5b9 Fixed bug 4542 - Image flipped vertically when rendering on texture
Have to recompute  viewport because projection/glOrtho is different
wether rendering is on target texture or not
2019-03-12 07:59:53 +01:00
Ryan C. Gordon
7719c8450b opengles2: patched to compile. 2019-02-04 23:35:18 -05:00
Ryan C. Gordon
e9ff968b3d opengles2: keep cached texturing state correct. 2019-02-04 23:32:28 -05:00
Ryan C. Gordon
1603864f35 opengles1: keep cached texturing state correct. 2019-02-04 23:24:10 -05:00
Ryan C. Gordon
18c266de93 render: Fix OpenGL draw state cache for various points of texture binding. 2019-02-04 18:55:39 -05:00
Sylvain Becker
e1e05d5d70 Fixed bug 3657 - Color-key doesn't work when an alpha channel is present
When surface format is the same as renderer format, it still needs an
intermediate conversion to transform colorkey to alpha.
2019-01-19 16:47:43 +01:00
Sylvain Becker
d4a6d42c36 Fixed bug 4453 - GLES / GLES2: first white renderer clear cmd is drawn as black 2019-01-12 13:34:03 +01:00
Sam Lantinga
a7609d9e2a Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sylvain Becker
5462c25419 PSP renderer: use colors from 'draw' union (very likely, but un-tested) 2018-12-29 17:59:34 +01:00
Sylvain Becker
8030ccc6b4 opengles 1: same fix as in bug #4433 2018-12-29 16:37:44 +01:00
Sylvain Becker
17d90ebcd0 opengles 1: use color from 'draw' union in SetDrawState() 2018-12-29 16:34:50 +01:00
Alex Szpakowski
04e747196e render: Fix internal state getting out of sync when destroying a texture that was just rendered and then creating a new one, in the GL and GLES2 backends. Fixes bug #4433. 2018-12-21 20:53:31 -04:00
Ryan C. Gordon
8b4f8f851f render: Prefer the Metal renderer over OpenGL.
This is the best option for macOS and iOS, the only platforms with Metal.

Pre-Metal versions of these platforms will fall back to OpenGL (ES), as
appropriate.

Huge thanks to Alexander Szpakowski, who worked incredibly hard to get the
Metal renderer to such a high-quality state!
2018-12-19 18:10:02 -05:00
Alex Szpakowski
1fef0780b0 metal: Implement SDL_LockTexture for YUV formats. 2018-12-19 18:27:21 -04:00
Alex Szpakowski
ab8c8b57d7 metal: Implement SDL_LockTexture for non-YUV textures. 2018-12-18 14:23:05 -04:00
Sylvain Becker
cdf7a0983c Fixed bug 4425 - promote to alpha format, palette surface with alpha values.
SDL_CreateTextureFromSurface() forgets to choose a texture format with alpha for
surfaces that have palettes with alpha values.
2018-12-15 14:50:12 +01:00
Sylvain Becker
6832c29cfb opengles2: fix prototype of glDeleteBuffers 2018-12-06 10:24:44 +01:00
Sylvain Becker
64aff1d0b1 Fix warnings detected on Android build 2018-12-06 09:22:00 +01:00
Sylvain Becker
a8ad1e236c Warnings: fix a documentation warning and missing prototypes 2018-12-05 16:13:12 +01:00
Ryan C. Gordon
e4d152081d direct3d: be more aggressive about resetting invalidated cached state.
Fixes Bugzilla #4402.
2018-12-03 09:26:05 -05:00
Ryan C. Gordon
a45803eb03 render: fix some static analysis warnings. 2018-12-03 02:06:17 -05:00
Ryan C. Gordon
d3e28c4b87 direct3d: Make sure streaming textures update before being used for drawing.
Fixes Bugzilla #4402.
2018-12-03 01:58:23 -05:00
Ryan C. Gordon
25f6ba04a4 Patched to compile on C89 compilers. 2018-12-02 21:57:33 -05:00
Ryan C. Gordon
ece0a1fa69 direct3d: Release and NULL out vertex buffers on reset.
Otherwise they are irretrievably lost on window resize, etc, which makes
rendering freeze and other disasters.

Fixes Bugzilla #4358.
2018-12-02 20:55:57 -05:00
Alex Szpakowski
9eb0eca492 metal: use a staging texture in SDL_UpdateTexture, to make sure it doesn't stomp texture data being drawn in a previous frame on the GPU. 2018-11-25 22:13:09 -04:00
Alex Szpakowski
e280e75f1c metal: Fix an incorrect division. 2018-11-21 23:46:37 -04:00
Alex Szpakowski
4e0d88f0e3 metal: SDL_RenderFillRects uses one draw call per 16k rectangles (within the given FillRects call), instead of one draw call per rectangle. Reduces CPU usage when drawing many rectangles. 2018-11-21 23:37:23 -04:00
Ryan C. Gordon
1753789ba1 opengles: Fixed compiler warnings. 2018-11-17 16:24:52 -05:00
Sam Lantinga
9a75f9e464 Back out change initializing renderer blend mode incorrectly. 2018-11-17 12:12:29 -08:00
Ryan C. Gordon
05e4c99068 direct3d11: Fixed missing rendering of solid primitives.
Fixes Bugzilla #4388.
2018-11-17 14:39:42 -05:00
Ryan C. Gordon
1bff9ec3c6 Fixed a few compiler warnings. 2018-11-17 14:37:51 -05:00
Sam Lantinga
b171721e4d The default draw blendmode is SDL_BLENDMODE_NONE 2018-11-17 00:58:45 -08:00
Ryan C. Gordon
57e300f4c2 software: fix blits with color mods that change during a command queue run. 2018-11-14 22:38:58 -05:00
Alex Szpakowski
e0a3508801 metal: SDL_RenderReadPixels on macOS synchronizes the render target's texture data if it's managed, before reading from it. 2018-11-04 14:31:56 -04:00
Alex Szpakowski
133fbcbc84 metal: fix the SDL_RENDERER_PRESENTVSYNC flag not being set on the renderer info on macOS, when vsync is used. 2018-11-04 12:31:02 -04:00
Alex Szpakowski
0ba9595219 metal: fix the size of the buffer used for constant data. 2018-11-04 12:24:05 -04:00
Alex Szpakowski
8ba1c41f88 metal: avoid an extra buffer allocation and GPU data copy in RunCommandQueue, it's not needed. Improves overall performance. 2018-11-01 20:24:21 -03:00