Commit Graph

770 Commits (d71df6448b04d756555d9d9d285ba4c36b7e9f61)

Author SHA1 Message Date
zhailiangliang 00b67f5572 Fix potential memory leak in GLES_CreateTexture 2022-09-20 20:14:01 -07:00
Sam Lantinga 82b40f097b Fixed runaway CPU usage in the metal renderer when the window is minimized 2022-09-16 09:55:20 -07:00
Sam Lantinga e2753e19e8 Calculate simulated vsync interval based on display refresh rate 2022-09-16 07:44:40 -07:00
Sam Lantinga 208964f038 Reset the simulated vsync presentation timeline if it's been too long since the last present 2022-09-16 07:44:40 -07:00
Sam Lantinga 1663cb4196 Reset simulated presentation timeline when vsync status changes 2022-09-16 07:44:40 -07:00
Sam Lantinga d744aafb05 Added support for simulated vsync in the renderer
This kicks in if the platform doesn't support vsync directly, or if the present fails for some reason (e.g. minimized on some platforms)

Fixes https://github.com/libsdl-org/SDL/issues/5134
2022-09-16 07:44:40 -07:00
Ozkan Sezer c23fb235c8 SDL_render_d3d12.c: Fix uninitialized warning for CreateEventExFunc 2022-09-16 17:20:56 +03:00
Sam Lantinga 5bc85d6788 Only advertise the SDL_PIXELFORMAT_EXTERNAL_OES format if we can build the shader for it 2022-09-16 06:15:45 -07:00
Sam Lantinga 2970710b5d Pretty print shaders for debugging purposes 2022-09-15 07:41:29 -07:00
Sam Lantinga bc57d3e35c Fixed OpenGL ES shader compilation on Linux 2022-09-15 06:57:41 -07:00
Sam Lantinga 8a15a738f3 Fixed uninitialized variable warning 2022-09-15 06:21:19 -07:00
Sam Lantinga b5102a551b Fixed OpenGLES shaders failing after renderer has been created
Cache all the shaders up front, so we can verify that they won't silently fail at runtime.

If compiling the fragment shaders with the precision hint fails, try again without specifying precision.

Fixes https://github.com/libsdl-org/SDL/issues/6166
Fixes https://github.com/libsdl-org/SDL/issues/6174
2022-09-14 08:03:46 -07:00
Amir 7f415ce587 android: fix some compiler warnings 2022-09-12 10:06:08 -07:00
Sylvain 90a480a100
Fixed bug #6199 - Broken clip behaviour on a render target (metal) 2022-09-08 05:44:39 +02:00
Sam Lantinga 29f4a5ba0e Add GLES2 shader prologue infrastructure. (by @eloj)
There is supposedly an OpenGL ES2 target that does not support precision specifiers. However, the existing logic to detect this is currently broken in two ways:

1) There's a typo of the `#ifdef` as `#if`.
2) Checking for `GL_FRAGMENT_PRECISION_HIGH` can not be the correct way to detect this platform. Other targets, including some desktops, will also not have this defined (for various reasons).

Because some of the shader code is missing precision specifiers, and because a default is ONLY provided if `GL_FRAGMENT_PRECISION_HIGH` is set, these other targets break.

Instead of 'hard-coding' the prologue string into shaders in the C source, use our ability to provide a list of strings to `glShaderSource` instead, leaving the determination to run-time.

This commit closes https://github.com/libsdl-org/SDL/pull/6182
2022-09-06 15:55:27 -07:00
Sam Lantinga 4fd6bba257 Refactored for similarity to surrounding code 2022-09-06 12:29:42 -07:00
Cameron Cawley 10e1ef00e2 Fix compatibility with Windows XP 2022-09-06 08:55:35 -04:00
Francisco Javier Trujillo Mata f1e4685806 Adding specific SDL_Hint for the dynamic VSYNC 2022-08-30 07:20:36 -04:00
Noel Berry 00452e47fa
Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112) 2022-08-24 11:25:13 -07:00
Sam Lantinga 50c5d23f7d Round coordinates so very small floating point values don't turn into 0x80000000
e.g. SDL_RenderDrawLineF(renderer, -1e20, -1e20, 10, 10);

Fixes https://github.com/libsdl-org/SDL/issues/6116
2022-08-23 07:42:48 -07:00
Cameron Cawley 09b6956dcc opengl: Support NV12 textures on GPUs with only 2 texture units 2022-08-16 07:30:13 -07:00
Francisco Javier Trujillo Mata 7d5ccae22d Fix memory leak when destroying texture 2022-08-14 08:13:37 -04:00
Sam Lantinga cb46e1b3f0 Removed unused variable 2022-08-12 20:51:44 -07:00
Ethan Lee a28f426acb render: Only update size/scale/viewport when moving to a new display, rather than all window movement.
We really only care about DPI changes here, so this both reduces work and also avoids weird cases where viewport state can be corrupted by trivial window events. This doesn't _completely_ get rid of the issue but this is somewhat intentional, since apps will definitely want to do a full reset when changing displays anyhow (otherwise DPI/adapter changes will screw things up, and that's out of our control as long as both window size and drawable size are exposed at the same time.

Note that OpenGL still captures window events because of weird platform-specific issues like macOS and viewport stretching!

Fixes #5949
2022-08-12 16:13:24 -04:00
Francisco Javier Trujillo Mata 20f9a1b8a4 Implement SetTextureScaleMode 2022-08-08 09:34:08 -07:00
Francisco Javier Trujillo Mata fbb440d167 Invalidate texture in the UnlockTextureMethod 2022-08-06 12:11:34 -07:00
Sam Lantinga 5858c7dfce Fixed OpenGL ES Shaders for systems that don't understand precision keywords 2022-08-05 16:17:10 -07:00
Francisco Javier Trujillo Mata 944111dbcf Cleaning up video driver 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata 83c1179744 Adding SetViewPortCommand 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata a9f4cda3f9 Adding setcliprect command 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata fb1a205e70 Implement blend modes 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata 075f9016fa Remove some unnecessary comments 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata ed301b123b Updating supported format 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata 1d1965b6ee Removing the BGR_888 from texture supported 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata f75c35c071 Add invalidate texture when it changes 2022-08-02 11:40:31 -07:00
Daniel Santos 5bb965be3d Implement RenderLines 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata 0f0e5b44dc Increase size of pool for gsKit events 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata f758cad81a Remove non needed FillRects function 2022-08-02 11:40:31 -07:00
Daniel Santos 3cb124b98e Implement RenderPoints 2022-08-02 11:40:31 -07:00
Daniel Santos df6ebc2562 Implement FillRect 2022-08-02 11:40:31 -07:00
Daniel Santos a152e467b1 Fix "implicit declaration" with memalign 2022-08-02 11:40:31 -07:00
Daniel Santos 33cbf9acbe Fix some mixed declaration warnings 2022-08-02 11:40:31 -07:00
Daniel Santos acf48f14ac Vertex pointer revision
Now triangles are fully working
2022-08-02 11:40:31 -07:00
Daniel Santos 726180445e Add textured triangle prim 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata 2a70d492f0 Destroy texture properly 2022-08-02 11:40:31 -07:00
Daniel Santos 7b0486d490 Try triangles 2022-08-02 11:40:31 -07:00
Daniel Santos d5305ee098 Do properly color assign 2022-08-02 11:40:31 -07:00
Daniel Santos b48c74a316 Add GeometryQueue 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata 3bfc8f554e Removing some of the QueueCopy functions because they are legacy 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata be1219bd4e Implement setDrawColor 2022-08-02 11:40:31 -07:00