src/render

Branch


Log

Author Commit Date CI Message
Anonymous Maarten 36eb4845 2023-10-05T13:40:09 triangle: don't read destination pixel when you're going to discard it anyways
Simon McVittie d710e0be 2023-09-09T14:36:21 render: Enable clipping for zero-sized rectangles Battle for Wesnoth apparently relies on being able to disable rendering of UI elements by setting the clip rectangle to be empty. Resolves: https://github.com/libsdl-org/SDL/issues/6896 Fixes: 00f05dcf "render: only enable clipping when the rectangle is valid" Signed-off-by: Simon McVittie <smcv@collabora.com> (cherry picked from commit 8ad043fc38f09e5a88aca266ae6b70f572d66a1f)
Jeremy Demeule c25a49c4 2023-08-31T10:23:45 metal: Add hint to select low power device instead of the default one (#8182) On some system like MacBook Pro Intel with AMD card, asking for the default device will always return the AMD GPU. This is not an issue for 99% of the case when the renderer context is here to provide the maximum performance level like for game. However, for video application using GPU for 1 quad and 1 texture, using the discrete GPU for that lead to an important power consumption (4 to 8W), heat increase, and fan noise. With this patch, I successfully amend ffplay to only use the integrated GPU (i.e. the Intel one), instead of the discrete GPU (i.e. the AMD one). (cherry picked from commit aa7ba629784ebf4a253cf78d85c286c310ad0cb5)
Sam Lantinga 116a5344 2023-07-03T17:39:29 Fixed resource leak and crash at exit in the D3D11 renderer Also, for some reason ID3D11DeviceContext_OMGetRenderTargets() was failing in the second read pixels call in the "testautomation --filter render_testViewport" test. We already know the target view, so just use that. (cherry picked from commit 619f65af0c390dd10bc0e6bf9dc1227e7ecee54d) (cherry picked from commit 61808b03b5c5e2efe9b37d6c699c133d47448ea9)
Sam Lantinga f3436bc1 2023-07-03T17:09:49 The clip rect is defined in terms of the current viewport Don't use the viewport offset when setting the clip rect in the D3D12 renderer. This fixes "testautomation --filter render_testViewport" on Windows (cherry picked from commit 304d425f99b3b62e5f77ef869731bb702810a572) (cherry picked from commit bf277eb808103cb86a5af235495e866d33f87b0a)
Eric Wasylishen 76392f4f 2023-01-11T19:45:01 Handle DPI scaling in SDL_GetWindowSurface Fixes DPI awareness of testdrawchessboard (previously, the surface was being created in points instead of pixels, resulting in the demo app only drawing in a corner of the screen on High-DPI displays) *_CreateWindowFramebuffer()/*_UpdateWindowFramebuffer(): are updated to use SDL_GetWindowSizeInPixels instead of SDL_GetWindowSize() or window->w/window->h. Most of the _CreateWindowFramebuffer backends are untested except for Windows. Fixes #7047 (cherry picked from commit 67c91353e01f6f2c0cc80c17eeddbad6def7cb01)
Sam Lantinga 36033e38 2023-06-10T08:54:36 Make it clear that you can't mix 2D rendering and the window surface API Also added functions to query and destroy the window surface so you can switch between modes if you want. See https://github.com/pygame-community/pygame-ce/issues/2190 for more details.
Sam Lantinga 3f1fd5ab 2023-05-23T10:59:03 Updated source to match SDL function prototype style
Ozkan Sezer 92a487f2 2023-05-19T14:10:02 style fixes for SDL_PROC macros.
Ivan Mogilko d78072fc 2023-03-18T00:39:02 Fixed SDL_RenderSetVSync does not update flags if simulated vsync is on This lets the user to correctly detect current vsync state by reading SDL_RendererInfo. Also fixes SetVSync's return value check (it may be positive for error too).
Sylvain 23bce27b 2023-03-16T09:49:15 Change SDL_BLENDMODE_MUL for gl renderers Add FIXME for PSP and DirectFB
Sylvain 7d26ba75 2023-03-16T09:46:44 Simplify SDL_BLENDMODE_MUL
Sam Lantinga 0d763800 2023-03-09T15:10:00 Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!) (cherry picked from commit c6443d86c92e962683a1efe5f123a144988875b5)
Sylvain 17515f4a 2023-02-04T15:51:37 Backport simplify flags PR #7220
Sam Lantinga 3fa5a2f7 2023-02-06T11:22:00 Fixed warning running a command queue without any vertex operations (cherry picked from commit f8b41919dac0fb95553f910d02faafc6d7205692)
ds-sloth 038ccd76 2023-01-22T17:16:13 Support MIN/MAX blend on opengles2
ds-sloth 9670f233 2023-01-22T12:27:52 Support MIN/MAX blend on OpenGL + ES
Francisco Javier Trujillo Mata 32fd45cf 2023-01-11T23:26:22 Using UV instead of STQ
Francisco Javier Trujillo Mata c5a09ca7 2023-01-10T23:12:25 Remove dummy flag
Sam Lantinga 0479df53 2023-01-09T09:48:21 Updated copyright for 2023
Ozkan Sezer c7f22f03 2023-01-02T20:51:56 render/SDL_yuv_sw.c: fix build after commit d234f7a
Sylvain Becker d234f7a4 2023-01-02T18:09:57 SDL2: backport SDL_CalculateYUVSize() that checks for YUV size overflow (#6972)
Sam Lantinga 3dbc6a40 2022-12-26T10:24:25 render: only enable clipping when the rectangle is valid Fixes https://github.com/libsdl-org/SDL/issues/6896 (cherry picked from commit 00f05dcf49602889733262fc810386592ff51736)
Sylvain 3e9ae3ea 2022-12-03T13:36:09 Fix wrong clang-tidy modification. This is an integer division. Thanks @meyraud705 (see PR #6725)
Sam Lantinga 3bdc6221 2022-12-01T15:11:29 Fixed Apple build after d0bbfdbfb881e5407911d84c12899bd5b442a130
Pierre Wendling d0bbfdbf 2022-12-01T16:07:03 Clang-Tidy fixes (#6725) (cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
Sam Lantinga 7b100001 2022-11-30T15:51:17 Reverted code formatting for Apple platforms We didn't get the merge right, and rather than tease out exactly what happened, I'm just reverting for now.
Sam Lantinga 6926d046 2022-11-30T13:05:57 Fixed build after cherry-pick of 5750bcb174300011b91d1de20edb288fcca70f8c from SDL3
Sam Lantinga b8d85c69 2022-11-30T12:51:59 Update for SDL3 coding style (#6717) I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594 (cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
Sylvain Becker fb0ce375 2022-11-27T17:38:43 Cleanup add brace (#6545) * Add braces after if conditions * More add braces after if conditions * Add braces after while() conditions * Fix compilation because of macro being modified * Add braces to for loop * Add braces after if/goto * Move comments up * Remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements after merge * Fix inconsistent patterns are xxx == NULL vs !xxx * More "{}" for "if() break;" and "if() continue;" * More "{}" after if() short statement * More "{}" after "if () return;" statement * More fix inconsistent patterns are xxx == NULL vs !xxx * Revert some modificaion on SDL_RLEaccel.c * SDL_RLEaccel: no short statement * Cleanup 'if' where the bracket is in a new line * Cleanup 'while' where the bracket is in a new line * Cleanup 'for' where the bracket is in a new line * Cleanup 'else' where the bracket is in a new line (cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
Sylvain ddad901c 2022-11-17T10:43:45 Remove unneeded semicolon
Sylvain ce5da5d5 2022-11-16T21:47:43 Don't compare pointer against '0', but NULL
Sylvain 1d7966df 2022-11-16T21:27:16 Remove un-needed check for NULL pointer. They were previously checked just before.
ulatekh ec58a817 2022-10-05T19:26:09 Fixes made in response to running a static code analyzer under MS Windows. Most of these are probably harmless, but the changes to SDL_immdevice.c and SDL_pixels.c appear to have fixed genuine bugs. SDL_audiocvt.c: By separating the calculation of the divisor, I got rid of the suspicion that dividing a double by an integer led to loss of precision. SDL_immdevice.c: Added a missing test, one that could have otherwise led to dereferencing a null pointer. SDL_events.c, SDL_gamecontroller.c, SDL_joystick.c, SDL_malloc.c, SDL_video.c: Made it clear the return values weren't used. SDL_hidapi_shield.c: The size is zero, so nothing bad would have happened, but the SDL_memset() was still being given an address outside of the array's range. SDL_dinputjoystick.c: Initialize local data, just in case IDirectInputDevice8_GetProperty() isn't guaranteed to write to it. SDL_render_sw.c: drawstate.viewport could be null (as seen on line 691). SDL.c: SDL_MostSignificantBitIndex32() could return -1, though I don't know if you want to cope with that (what I did) or SDL_assert() that it can't happen. SDL_hints.c: Replaced boolean tests on pointer values with comparisons to NULL. SDL_pixels.c: Looks like the switch is genuinely missing a break! SDL_rect_impl.h: The MacOS static checker pointed out issues with the X comparisons that were handled by assertions; I added assertions for the Y comparisons. SDL_yuv.c, SDL_windowskeyboard.c, SDL_windowswindow.c: Checked error-result returns.
Sam Lantinga 70656b13 2022-11-15T10:18:41 Don't recreate the window when creating a Metal renderer on an OpenGL window. It turns out that we can safely create a Metal view on an existing window, and that avoids issues with the window being recreated with the wrong orientation in iOS 16. Fixes https://github.com/libsdl-org/SDL/issues/6289
Hubert Maier 5dc93451 2022-11-06T20:49:37 JANITORIAL : Correct some more spelling mistakes (#6489)
Hubert Maier 8b9c82e1 2022-10-30T08:50:36 SDL_RENDER_PSP.C: Correct spelling mistakes wether -> whether
Francisco Javier Trujillo Mata a8f019b1 2022-10-28T00:52:06 Using ST and removing warnings
Francisco Javier Trujillo Mata f2ebedae 2022-10-27T00:35:20 adding texture function
Francisco Javier Trujillo Mata 5de01eb0 2022-10-22T00:22:34 Make render to use new functions
Sam Lantinga dd72f3f0 2022-10-24T10:37:43 Added comment for #endif
Steven Noonan 3d35c085 2022-10-02T17:30:03 fix a few 'unused but set variable' and 'unused function' warnings
Sam Lantinga aefc6b5b 2022-10-18T08:40:03 Renamed variables, index is the singular of indices
Sylvain dfbb93dd 2022-10-18T11:31:30 SDL_Renderer / GLES2: add specific list of indice to render rect (see #6401)
Sylvain e8a4c23c 2022-10-18T10:45:01 Revert commit 790fa3156cfee847a7c0b34986de0cd7fdd7438f. SDL_BLENDMODE_INVALID case is probably used for custom blendmode
Sylvain 790fa315 2022-10-18T10:41:10 Fix warning: enumeration value 'SDL_BLENDMODE_INVALID' not explicitly handled in switch
Sylvain 3d99d310 2022-10-18T10:34:56 Fixed bug #6401 - back-end can choose the order the triangles when rendering rects, attempt to fix small glitch rendering.
Sylvain 285cbf6f 2022-10-18T10:04:06 Revert commit 485bb3565b6da24620e4eedde837fbfbc5cee6d2. "Fixed bug #6401 - change the order of triangles when using RenderCopy, RenderCopyEx and RenderFillRect" because the glitch reappears on other backend
Wouter Wijsman 3903f4c8 2022-10-17T21:59:38 PSP: Use vramalloc instead of conflicting valloc function The libpspvram library was offering a function with conflicted with valloc. This has been renamed now, so SDL2 had to be updated for it.
Sylvain 485bb356 2022-10-17T13:30:30 Fixed bug #6401 - change the order of triangles when using RenderCopy, RenderCopyEx and RenderFillRect
Pierre Wendling 5b9608e0 2022-10-11T23:35:33 Remove D3D9 workarounds for Watcom. The linked PRs have been merged since May.
Sam Lantinga df1bd07d 2022-10-11T07:25:27 d3d12: actually execute the pending commands before processing resize This makes sure all the resources are in the expected state Fix the D3D12 case in https://github.com/libsdl-org/SDL/issues/6376
zhailiangliang 41c718ed 2022-10-11T10:07:32 Fix memory leak in PSP_CreateTexture
Pierre Wendling 8117bfe5 2022-10-10T22:29:31 PS2: Ignore warnings from toolchain headers. The `gsInline.h` header creates `Wdeclaration-after-statement` warnings.
Sam Lantinga f99fc326 2022-10-09T11:42:39 d3d12: fixed window resize handling Fixes https://github.com/libsdl-org/SDL/issues/6355
Sam Lantinga 490c20f9 2022-10-09T09:57:55 d3d12: reset the vertex buffer size when it is released
Anonymous Maarten 01498d3a 2022-10-06T03:19:28 SDL_render_psp.c: fix -Wshadow Emitted by PSP's gcc
Anonymous Maarten 85fd40fa 2022-10-06T02:04:24 Fix -Wunused-const-variable warning when using clang-cl
Ryan C. Gordon 321ca109 2022-10-03T12:00:38 opengles2: Texture names are GLuint, not GLenum.
Ryan C. Gordon 01c5554f 2022-10-03T11:57:10 opengles2: SDL_GL_BindTexture() should bind all YUV textures. This matches what the non-GLES OpenGL renderer does. Fixes #6070.
zll 69bbe4ce 2022-09-29T15:50:50 Fix memory leak in VITA_GXM_CreateRenderer
zhailiangliang 00b67f55 2022-09-21T10:30:38 Fix potential memory leak in GLES_CreateTexture
Sam Lantinga 82b40f09 2022-09-16T09:55:20 Fixed runaway CPU usage in the metal renderer when the window is minimized
Sam Lantinga e2753e19 2022-09-15T08:02:14 Calculate simulated vsync interval based on display refresh rate
Sam Lantinga 208964f0 2022-09-15T07:05:55 Reset the simulated vsync presentation timeline if it's been too long since the last present
Sam Lantinga 1663cb41 2022-09-15T06:30:19 Reset simulated presentation timeline when vsync status changes
Sam Lantinga d744aafb 2022-09-15T01:00:12 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
Ozkan Sezer c23fb235 2022-09-16T17:20:56 SDL_render_d3d12.c: Fix uninitialized warning for CreateEventExFunc
Sam Lantinga 5bc85d67 2022-09-16T06:15:45 Only advertise the SDL_PIXELFORMAT_EXTERNAL_OES format if we can build the shader for it
Sam Lantinga 2970710b 2022-09-15T07:41:29 Pretty print shaders for debugging purposes
Sam Lantinga bc57d3e3 2022-09-15T06:57:41 Fixed OpenGL ES shader compilation on Linux
Sam Lantinga 8a15a738 2022-09-15T06:21:19 Fixed uninitialized variable warning
Sam Lantinga b5102a55 2022-09-14T08:03:46 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
Amir 7f415ce5 2022-09-12T20:09:00 android: fix some compiler warnings
Sylvain 90a480a1 2022-09-08T05:44:39 Fixed bug #6199 - Broken clip behaviour on a render target (metal)
Sam Lantinga 29f4a5ba 2022-09-06T15:55:27 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
Sam Lantinga 4fd6bba2 2022-09-06T12:29:42 Refactored for similarity to surrounding code
Cameron Cawley 10e1ef00 2022-09-06T11:21:57 Fix compatibility with Windows XP
Francisco Javier Trujillo Mata f1e46858 2022-08-26T17:58:59 Adding specific SDL_Hint for the dynamic VSYNC
Noel Berry 00452e47 2022-08-24T11:25:13 Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
Sam Lantinga 50c5d23f 2022-08-23T07:42:48 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
Cameron Cawley 09b6956d 2022-08-16T15:08:10 opengl: Support NV12 textures on GPUs with only 2 texture units
Francisco Javier Trujillo Mata 7d5ccae2 2022-08-14T12:15:55 Fix memory leak when destroying texture
Sam Lantinga cb46e1b3 2022-08-12T20:51:44 Removed unused variable
Ethan Lee a28f426a 2022-08-12T16:13:24 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
Francisco Javier Trujillo Mata 20f9a1b8 2022-08-08T17:23:43 Implement SetTextureScaleMode
Francisco Javier Trujillo Mata fbb440d1 2022-08-06T18:10:54 Invalidate texture in the UnlockTextureMethod
Sam Lantinga 5858c7df 2022-08-05T16:17:10 Fixed OpenGL ES Shaders for systems that don't understand precision keywords
Francisco Javier Trujillo Mata 944111db 2022-08-02T18:47:39 Cleaning up video driver
Francisco Javier Trujillo Mata 83c11797 2022-08-01T12:23:58 Adding SetViewPortCommand
Francisco Javier Trujillo Mata a9f4cda3 2022-08-01T12:13:28 Adding setcliprect command
Francisco Javier Trujillo Mata fb1a205e 2022-08-01T11:44:05 Implement blend modes
Francisco Javier Trujillo Mata 075f9016 2022-08-01T11:43:50 Remove some unnecessary comments
Francisco Javier Trujillo Mata ed301b12 2022-08-01T11:43:35 Updating supported format
Francisco Javier Trujillo Mata 1d1965b6 2022-07-18T12:34:17 Removing the BGR_888 from texture supported
Francisco Javier Trujillo Mata f75c35c0 2022-07-12T23:01:28 Add invalidate texture when it changes
Daniel Santos 5bb965be 2022-07-08T15:47:33 Implement RenderLines
Francisco Javier Trujillo Mata 0f0e5b44 2022-07-08T17:47:19 Increase size of pool for gsKit events
Francisco Javier Trujillo Mata f758cad8 2022-07-08T13:14:40 Remove non needed FillRects function
Daniel Santos 3cb124b9 2022-07-07T15:00:15 Implement RenderPoints