src/render


Log

Author Commit Date CI Message
Sylvain Becker 57a5c453 2021-01-05T22:06:51 Fix D3D11 UpdateTextureNV in non fullscreen (bug #5430)
Sylvain Becker fc61ecb2 2021-01-05T21:54:03 Fix software UpdateNVTexture non fullscreen (bug #5430)
Sylvain Becker 204ef3b5 2021-01-05T20:38:31 Fix D3D11 UpdateNVTexture (bug #5430)
Sylvain Becker c0df40e0 2021-01-05T17:39:48 Add more SDL_HAVE_YUV defines
Sylvain Becker b0325041 2021-01-05T12:36:34 Fix unused variable warning on METAL (see bug #5430)
Sylvain Becker c1eb9ecf 2021-01-05T12:29:43 Add SDL_UpdateNVTexture for META (bug #5430) (not tested)
Sylvain Becker 73d93dbc 2021-01-05T12:20:02 Fix compilation on Window10 (see bug #5430)
Sylvain Becker df6b8131 2021-01-05T12:16:32 Fix compilation (implicit declaration of function) (see bug #5430)
Sylvain Becker d1f031c8 2021-01-05T12:08:16 Add SDL_UpdateNVTexture for d3d11 (bug #5430) (not tested)
Sylvain Becker f5eba2cc 2021-01-05T12:00:54 Fixed invalid read in yuv_rgb_sse() (see bug #5430)
Sylvain Becker be4cfd51 2021-01-05T11:56:22 Add SDL_UpdateNVTexture() to update NV12/21 Texture (bug #5430) for renderer software, opengl, and opengles2
Sam Lantinga 393c8c1f 2021-01-03T10:32:55 Fixed bug 5440 - MacCatalyst build failures C.W. Betts I tested building commit http://hg.libsdl.org/SDL/rev/7adf3fdc19f3 on Mac Catalyst and found some issues: * MTLFeatureSet_iOS_* enums aren't available under Mac Catalyst. * OpenGL ES is unavailable under Mac Catalyst. * Some Metal features are available under Catalyst but not iOS, such as displaySyncEnabled. * Set Metal as the default renderer on Mac Catalyst Attaching a patch that will make SDL2 build for Mac Catalyst.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sylvain Becker 3edf337d 2021-01-02T17:29:34 Simplify RenderGetViewportSize
Sylvain Becker 2af765da 2021-01-02T17:18:13 SDL_RenderGetViewportF: only need the size of viewport (see bug #5424)
Sylvain Becker 41597249 2021-01-02T16:15:22 SDL_RenderGetViewportF: remove debug messages
Sylvain Becker 8c48c423 2021-01-02T16:12:30 Add SDL_RenderGetViewportF: fix lost of precision while scaling (see bug #5424)
Sam Lantinga 223af86c 2021-01-01T11:12:30 Added SDL_RenderGetD3D11Device() to get access to the device associated with the D3D11 renderer
Sam Lantinga 5f0b2a7f 2021-01-01T11:12:22 Fixed resource leak with D3D11 NV12 textures
Sylvain Becker 590a5469 2020-12-30T16:12:14 Fixed bug 5424 - Renderer doesn't use entirely the viewport when scaling is used Viewport/Clip dimensions are calculated usingg SDL_ceil whereas all renders use SDL_floor
Sylvain Becker 5dabc4d7 2020-12-28T18:17:25 Revert changeset 14590 544ac819e8b3 , does not fully fix
Sylvain Becker 9efdafd4 2020-12-28T18:07:03 SDL_RenderCopy: scale before doing intersection this prevents drawing 1 pixel outside the screen, in letterbox mode
Sylvain Becker f9b5f6cc 2020-12-27T20:28:24 Forward scale mode to SW renderer (Bug 5313)
Sam Lantinga 7fa5e95b 2020-12-09T07:23:47 Fixed bug 5213 - Add support to metal in iOS/tvOS simulator Vincent Hamm Xcode11 and ios13 added support for metal simulator. Here is a quick and dirty patch to enable it. Pretty early and only tested on a few samples for now. Required mostly to enable metal support on correct version of ios, generate simulator compatible shaders and enforce buffer alignments on simulator (same as osx).
Sam Lantinga cb361896 2020-12-09T07:16:22 Fixed bug 5235 - All internal sources should include SDL_assert.h Ryan C. Gordon We should really stick this in SDL_internal.h or something so it's always available.
Sam Lantinga 88cb4962 2020-12-09T06:42:31 Fixed bug 5291 - SDL_SetRenderTarget unnecessarily changes target when current target is the native texture of the passed in texture
Sylvain Becker 754286c6 2020-12-02T13:45:24 SDL Renderer: specify the correct flag when recreating the window
Ryan C. Gordon 0e4ce848 2020-11-08T20:57:17 opengl: Make diagonal lines match the software renderer. OpenGL leaves the final line segment open, SDL's software renderer does not, so we need a tiny bit of trigonometry here to move one more pixel in the right direction.
Ryan C. Gordon da49f795 2020-11-08T19:56:12 opengles: use glDrawArrays() correctly with GL_LINE_STRIP.
Ryan C. Gordon 93a2c58c 2020-11-08T12:37:09 opengl: Use GL_LINE_STRIP instead of breaking down into seperate GL_LINES. Surely GL drivers have improved in the last seven years. I hope...?
Ryan C. Gordon 731a5d1c 2020-11-08T03:18:05 metal: Fix line drawing, again.
Ryan C. Gordon ba36eb04 2020-10-21T00:03:33 metal: Make line drawing match software renderer. Partially fixes Bugzilla #2711.
Ryan C. Gordon c33f8083 2020-10-20T11:12:49 render: Restoring line rendering fixes that were previously put on hold. (Backed out hg changeset 7a4240daba46)
Ryan C. Gordon 061256a3 2020-10-07T14:45:24 metal: Clear the framebuffer if presenting without any other operations.
Ryan C. Gordon a720d1a2 2020-08-09T00:55:39 render: fixes to how we convert touch events for logical scaling. We now handle HiDPI correctly, and touches are clamped to the viewport. So if you are rendering to a logical 640x480 in a 720p window, and touch the letterboxing at point (640,700), it will report the touch at (0.5,1.0) instead of outside the documented range.
Ryan C. Gordon b7a4fdd3 2020-07-17T11:16:35 metal: Make sure we have a command buffer available before trying to present. This fixes a case where you render to the backbuffer, then render to a render target, set the current target back to the backbuffer, and then present without drawing anything else; in this circumstance, the Present command would never happen. Fixes Bugzilla #5011.
Sam Lantinga 15294e21 2020-05-26T13:54:47 Fixed iOS build
Sam Lantinga f16e6bfa 2020-05-25T14:10:51 Fixed creating a metal renderer without specifying a metal window
Sylvain Becker 39690a04 2020-05-15T21:33:47 Fix static analysis warning in SDL_render.c
Ryan C. Gordon a96d8a43 2020-04-13T22:05:36 render: Fixed compiler warning about implicit cast.
hmk aa188048 2020-04-10T12:23:08 render: Scale relative mouse motion better for logical sizing From hmk: "When scaling is enabled (e.g. via SDL_RenderSetLogicalSize, size not equal to window size), mouse motion events are also scaled. Small motions are rounded up (SDL_max() when the value after scaling is less than 1), while larger motions are truncated by the floating point -> integer conversion. https://hg.libsdl.org/SDL/file/b18197f9bf9d/src/render/SDL_render.c#l658 The end result feels something like mouse reverse mouse acceleration + angle snapping at low speeds, but less consistent (amount of truncation & rounding depends on how fast the mouse is moved) and potentially much worse if the scaling factor is large. This pretty much makes it useless for anything where you need precise mouse aiming (think of games). I suspect this is why aiming gets so terrible in some games that let you use scaling to reduce the render resolution (e.g. Ion Fury). With 4x4 scaling, I can reproduce a situation where it takes three fast flicks of the mouse across the pad to undo one slow sweep across the pad. In other words, extreme reverse acceleration. This does not happen when scaling is disabled. Furthermore, any game that uses relative mouse motion events for 3D camera rotation probably wants the raw mouse deltas and not a value that depends on scaling and resolution and rounding and truncation. Ideal camera rotation just takes mouse input, multiplies it by sensitivity, and adds it to the angle-in-radians or whatever measure is used for yaw & pitch. Pixels and screen resolution or window dimensions should not be a part of the equation at all, even if it could be implemented without rounding errors. [...] This [patch] completely eliminates angle snapping for me, and makes sensitivity consistent. In other words, it's completely usable for, say, aiming in a first person shooter." Partially fixes Bugzilla #4811.
Sam Lantinga b6afbe63 2020-04-07T09:38:57 Added SDL_log.h to SDL_internal.h so logging is available everywhere
Sam Lantinga d4b561f4 2020-04-05T08:58:47 Fixed bug 5015 - SDL_RenderReadPixels on DirectX 11.1 backend seems to be broken Konrad It appears that I cannot use SDL_RenderReadPixels on a bound framebuffer (SDL_Texture set as render target) as it simply results in gibberish data. However, drawing that framebuffer into the default target (window surface) does render it correctly. Other backends (OpenGL, software, Direct3D) do work fine. It looks to me like D3D11_RenderReadPixels just gets the general backbuffer and not the current render target and its backbuffer. Here is the patch which actually fetches the current render target and its underlying ID3D11Resource which is ID3D11Texture2D.
Ryan C. Gordon 19a5f4ab 2020-03-22T14:32:47 opengl: Don't enable/disable texturing except when actually rendering. Otherwise our cached state goes out of sync when updating a texture. Since these state changes aren't necessary, they were removed instead of updating the cached state. Fixes Bugzilla #4998.
Sylvain Becker e6189f40 2020-03-17T15:47:30 Fix warnining implicit declaration of SDL_DetectPalette (Thanks meyraud705)
Sylvain Becker 838bbf1f 2020-03-17T09:35:42 Fixed bug 5037 - Regression 2.0.12 Alpha value of 0 on palette may become opaque (see also bug 3827)
Sam Lantinga c8c05a9f 2020-03-08T19:23:21 Fixed bug 4991 - Pixel shader problem when recreating a texture for direct3d renderer cmediaplayer Hi, i already mentioned in the SDL discourse a bug that recreating of a texture occours pixel shader problem on direct3d renderer. There is no problem for direct3d11. You can see the issue by using my app named C Media Player which is available for Windows for free using my web site www.cmediaplayer.com. Just follow the steps: *Open a media file *When playing the file change the scale quality under the video menu. *You will see the problem.
Sam Lantinga 367a3561 2020-03-08T18:56:07 Don't release the backbuffer on error, we didn't acquire it.
Cameron Gutman e152a3ce 2020-03-07T13:59:42 direct3d: Don't attempt to create zero sized vertex buffer
Sylvain Becker 9a7c2b22 2020-02-23T09:59:52 Fixed bug 4999 - Palette surface always promoted to alpha (Thanks Cameron Gutman!) MSVC Static analysis: Incorrect alpha_value check in SDL_render.c (see also bug 4425)
Ryan C. Gordon 93b26f17 2020-02-17T16:15:04 opengl: Backed out hg changeset 94f9f40a957f This is the OpenGL line drawing fix for Bugzilla #3182, but there's some disagreement about what the renderers should do here, so I'm backing this out until after 2.0.12 ships, and then we'll reevaluate all the renderer backends to decide what's correct, and make them all work the same.
Sam Lantinga 6ec14b7f 2020-02-11T16:23:43 Fixed iOS and Android build
Ryan C. Gordon ed10d947 2020-02-10T12:53:54 opengl: Build out full GL_LINES and respect the diamond-exit rule. Likewise for the GLES1 and GLES2 renderers. This solves the missing pixel at the end of a line and removes all the heuristics for various platforms/drivers. It's possible we could still use GL_LINE_STRIP with this and save some vertex buffer space, assuming this doesn't upset some driver somewhere, but this seems to be a clean fix that makes the GL renderers match the software renderer output. Diamond-exit rule explanation: http://graphics-software-engineer.blogspot.com/2012/04/rasterization-rules.html Fixes Bugzilla #3182.
Sam Lantinga 13155b35 2020-02-10T09:42:53 The scissor rect needs to be updated when the viewport changes in the Metal renderer
Sam Lantinga b5849daf 2020-02-01T09:23:04 Fixed build warnings on Android
Sam Lantinga b5e3d264 2020-01-23T01:00:52 Added a single SDL_LEAN_AND_MEAN define to turn on minimal SDL builds Protected more code with #ifdefs to reduce the size of minimal shared library builds
Sylvain Becker 7df22cf2 2020-01-21T21:33:40 A few #defines to reduce SDL2 footprint. Only applied when library is statically linked
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga 981e0d36 2020-01-16T08:52:59 Fixed bug 4903 - Lack of color multiply with alpha (SDL_BLENDMODE_MOD + SDL_BLENDMODE_BLEND) blending mode for all renderers Konrad This kind of blending is rather quite useful and in my opinion should be available for all renderers. I do need it myself, but since I didn't want to use a custom blending mode which is supported only by certain renderers (e.g. not in software which is quite important for me) I did write implementation of SDL_BLENDMODE_MUL for all renderers altogether. SDL_BLENDMODE_MUL implements following equation: dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) dstA = (srcA * dstA) + (dstA * (1-srcA)) Background: https://i.imgur.com/UsYhydP.png Blended texture: https://i.imgur.com/0juXQcV.png Result for SDL_BLENDMODE_MOD: https://i.imgur.com/wgNSgUl.png Result for SDL_BLENDMODE_MUL: https://i.imgur.com/Veokzim.png I think I did cover all possibilities within included patch, but I didn't write any tests for SDL_BLENDMODE_MUL, so it would be lovely if someone could do it.
Ozkan Sezer ef3ca2cc 2019-12-23T19:55:10 Fix build error in SDL_render_metal.m (bug #4916.) Patch provided by Konrad. Error was introduced by commit 522164980828 for bug #4914.
Sylvain Becker 6d639fce 2019-12-23T16:47:00 SDL_ScaleMode: fix compilation GLES renderer
Ryan C. Gordon 131e13a7 2019-12-22T20:48:43 direct3d11: Always set vertex buffers when updating them (thanks, Konrad!). Fixes Bugzilla #4913.
Sam Lantinga 5e19e66c 2019-12-22T13:39:44 Fixed bug 4914 - Expose SDL_ScaleMode and add SDL_SetTextureScaleMode/SDL_GetTextureScaleMode Konrad This was something rather trivial to add, but asked at least several times before (I did google about it as well). It should be possible to dynamically change scaling mode of the texture. It is actually trivial task, but until now it was only possible with a hint before creating a texture. I needed it for my game as well, so I took the liberty of writing it myself. This patch adds following functions: SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode); SDL_GetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode *scaleMode); That way you can change texture scaling on the fly.
Ryan C. Gordon 7b08eb48 2019-12-03T03:07:34 direct3d11: Fixed incorrect texture coordinates (thanks, Martin!). Fixes Bugzilla #4860.
Sylvain Becker 9e509e4a 2019-10-30T16:45:53 SDL_render_gles2: remove ineffective widening cast warning: either cast from 'int' to 'size_t' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
Sylvain Becker 60d3965e 2019-10-30T15:36:17 Readability: remove redundant return, continue, enum declaration
Alex Szpakowski a9b867ab 2019-10-26T14:39:50 macOS Fix potential memory leaks in the Metal renderer caught by clang's static analyzer.
Ryan C. Gordon 1ce1364b 2019-10-26T12:56:18 d3d11: Don't fail if there's no vertex data to upload (thanks, Martin!). Fixes Bugzilla #4832.
Alex Szpakowski 216f5b98 2019-10-17T18:48:58 metal: Fix compilation when using older Apple SDKs (bug #4828).
Sylvain Becker fe20c35b 2019-10-14T16:40:46 Fixed race condition when scaling Touch events, and changing the renderer target. Always read the output size of the main renderer. (similar to bug 2107)
Sylvain Becker 72660a51 2019-10-13T20:52:52 Fixed bug 4825 - SDL Renderer OpenGL: Buffer overflow (SDL_RENDERCMD_DRAW_LINES)
Sylvain Becker 7d47f526 2019-10-01T09:26:30 SDL_LockTextureToSurface: robustness of locked region compared to texture size
hmk 0918903f 2019-09-30T22:54:16 render: add a hint for toggling relative scaling Fixes Bugzilla #4811.
Sylvain Becker 1ae61f10 2019-09-30T20:58:44 Added a helper function SDL_LockTextureToSurface() Similar to SDL_LockTexture(), except the locked area is exposed as a SDL surface.
Ryan C. Gordon 847bd8d9 2019-09-02T00:11:58 direct3d: Be more aggressive about resetting state when textures go away. Fixes Bugzilla #4768.
Ryan C. Gordon a3804ba1 2019-09-01T22:41:44 d3d11: Fixed VB state, avoiding unnecessary recreation (Thanks, Alex!). Fixes Bugzilla #4779.
Alex Szpakowski 0c263738 2019-08-26T18:49:04 gl/gles/gles2 render: fix SDL_RenderClear being affected by the clip rect in some situations.
Alex Szpakowski bfdb0e97 2019-08-18T10:38:32 metal renderer: optimize SDL_RenderFillRect slightly.
Alex Szpakowski ff7888e6 2019-08-18T09:35:11 render: fix colors not being set properly after the previous change
Alex Szpakowski 1be03b40 2019-08-17T22:26:33 render: avoid a couple redundant memcmp calls in all drawing functions. Improves performance slightly.
Alex Szpakowski e8278d0d 2019-08-17T16:53:08 metal renderer: use vertex attributes instead of indexing into a buffer with the vertex id in the shader. Allows for more flexibility with vertex setup in the future. Also optimize vertex buffer binding slightly.
Alex Szpakowski 55a46abf 2019-08-17T01:09:30 metal renderer: more closely match buffer data alignment requirements from the metal specification.
Alex Szpakowski 69c6924c 2019-08-17T00:43:44 render: simplify vertex and uniform data allocation. Improves performance of various SDL_Render functions (bug #4764).
Alex Szpakowski e5acccc7 2019-08-17T00:37:22 metal renderer: use the device address space instead of the constant address space for colors. It doesn't negatively impact GPU performance in my tests, and it removes the need for 256 byte memory alignment of color data on macOS.
Alex Szpakowski 3fb5cabe 2019-08-16T22:13:30 metal: Update compiled shaders based on compilation script changes
Alex Szpakowski 9e57e3e5 2019-08-16T22:11:50 metal: Update shader compilation script with fixes for newer xcode versions and for running on older platforms
Alex Szpakowski aebaa316 2019-08-05T12:35:32 Add public APIs for creating a Metal view attached to an SDL window. Add SDL_metal.h.
Sylvain Becker 22a2decf 2019-06-28T16:38:42 Android: concurrency issues, make sure Activity is in running State when calling functions like SDL_CreateWindow, SDL_CreateRenderer, Android_GLES_CreateContext Bugs 4694, 4681, 4142
Sylvain Becker cfed0b77 2019-06-28T16:14:50 Add an "error" label in SDL_CreateRenderer (no op)
Ryan C. Gordon 31bb95f1 2019-06-21T15:07:39 direct3d: Use D3DPOOL_DEFAULT for vertex buffers after all, release correctly. Fixes Bugzilla #4679. Fixes Bugzilla #4537.
Cameron Gutman e681623c 2019-06-20T19:51:00 direct3d: Fix dirty textures failing to update Even if the texture itself has not changed since last time, the data may have so we must call UpdateDirtyTexture() to handle that possibility.
Ryan C. Gordon 7162649f 2019-06-18T18:58:39 opengl: Be more robust in failing cases. Load all possible symbols, not just until one fails, in case they get used during shutdown, etc. Fixes Bugzilla #4093.
Sam Lantinga 5dcac4cc 2019-06-18T10:08:19 Fixed 4669 - Using the software SDL_Renderer on Android leads to GL errors & black screen when window resizes Sylvain I think what happening with the software renderer is: * you're somehow in background (so texture creation is not possible) * it resizes and wants to push a SDL_WINDOWEVENT_SIZE_CHANGED It call: https://hg.libsdl.org/SDL/file/a010811d40dd/src/render/SDL_render.c#l683 * GetOutputSize * SW_GetOutputSize * SW_ActivateRenderer * SDL_GetWindowSurface * SDL_CreateWindowFramebuffer which is mapped to SDL_CreateWindowTexture and it ends up re-creating the surface/a texture, while being in background
Sylvain Becker e96d4760 2019-06-18T18:53:58 Android: resize with software rendering, reverted again (Bug 4669)
Sylvain Becker 12b92260 2019-06-18T18:40:40 Android: try to fix resize with software rendering (bug 4669)
Sylvain Becker 8a20d40d 2019-06-18T18:22:18 Android: revert commit SW_GetOutputSize, again (Bug 4669)
Sylvain Becker 98cc7589 2019-06-18T10:41:11 Android: prevent using SW_GetOutputSize with software renderer (Bug 4669)
Sam Lantinga 1213fe79 2019-06-14T13:56:42 Worked around "Undefined symbol: ___isPlatformVersionAtLeast()" link error on Xcode 11 beta
Ryan C. Gordon 3e9bf284 2019-06-11T15:06:35 software: Fixed compiler warning and dos2unix'd the endlines.
Ryan C. Gordon 04fedce0 2019-06-11T14:09:53 software: Correctly track viewport and cliprect. Fixes Bugzilla #4457.