src/render/direct3d11/SDL_render_d3d11.c


Log

Author Commit Date CI Message
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
Noel Berry 00452e47 2022-08-24T11:25:13 Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
chalonverse 3b191580 2022-06-27T17:19:39 Windows GDK Support (#5830) * Added GDK * Simplfied checks in SDL_config_wingdk.h * Added testgdk sample * Added GDK readme * Fixed error in merge of SDL_windows.h * Additional GDK fixes * OpenWatcom should not export _SDL_GDKGetTaskQueue * Formatting fixes * Moved initialization code into SDL_GDKRunApp
Sam Lantinga adc68758 2022-06-17T10:22:28 Added SDL_copyp to avoid size mismatch when copying values (thanks @1bsyl!) Closes https://github.com/libsdl-org/SDL/pull/5811
Eric Wasylishen e09551bc 2022-06-09T02:22:21 Fix WinRT build
Eric Wasylishen ab81a559 2022-06-07T02:01:27 Windows DPI scaling/highdpi support Adds hint "SDL_WINDOWS_DPI_SCALING" which can be set to "1" to change the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. This means windows will be appropriately sized, even when created on high-DPI displays with scaling. e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, will create a window with an 800x600 client area (in pixels). Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows.
chalonverse 6f69bbc5 2022-06-08T12:38:43 D3D11: Fix SDL_TEXTUREACCESS_TARGET not working if SDL_HAVE_YUV was 0 Added a couple of missing SDL_zeros in CreateTexture
Ethan Lee ba0ba9ef 2022-04-08T01:20:36 direct3d11: Set the swapchain target immediately after creating it. Fixes #4782
pionere 0983fcee 2022-02-05T12:28:37 fix memory leak in D3D11_CreateRenderer
pionere 3f8b450d 2022-02-05T12:22:34 extend the code hidden by SDL_HAVE_YUV
pionere 2cfc83ea 2022-01-22T17:10:37 sync D3D_RenderReadPixels with D3D11_RenderReadPixels - use the result of SDL_ConvertPixels to propagate error - get rid of the verbose error message of D3D11_RenderReadPixels in case SDL_ConvertPixels failed
pionere 60deadba 2022-01-17T17:22:30 re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory
Cameron Gutman c6ec5a07 2022-01-02T15:43:35 d3d11: Respect SDL_HINT_RENDER_DIRECT3D_THREADSAFE when creating device
Sam Lantinga 18e4d9fe 2022-01-08T09:02:25 Re-enable line drawing path in render drivers This is still used for scaled line drawing in RenderDrawLinesWithRects()
Sylvain 9cb2c549 2022-01-07T22:43:30 Remove QueueDrawLines from D3D, D3D11
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Alex Szpakowski 3a5e148b 2021-12-14T11:02:07 Renderer backends use SDL_Color instead of int for geometry colors.
Alex Szpakowski 323ba6c0 2021-12-13T18:27:49 d3d11 renderer: reduce vertex bandwidth and calculations.
Sylvain 7828362d 2021-11-24T16:45:06 SDL_Renderer software, D3D11: don't use "renderer->viewport" in back-ends, but use the one from SETVIEWPORT cmd
DarkContact e77cfb9a 2021-11-24T00:29:45 Fixed d3d11 renderer creation
Ozkan Sezer b3f9d8f3 2021-10-25T07:05:50 remove unused local vars after the latest commits.
Sylvain 79732c9d 2021-09-25T11:35:20 Remove FillRects from back-end, where RenderGeometry can be used
Sylvain f02ad282 2021-09-25T11:31:18 Remove FillRects from back-end, where RenderGeometry can be used
Sylvain 73f4ab4c 2021-09-20T16:57:21 Direct3D11: remove RenderCopy and RenderCopyEx from back-end
Misa 4549769d 2021-03-07T15:20:45 Add `SDL_RenderSetVSync()` Currently, if an application wants to toggle VSync, they'd have to tear down the renderer and recreate it. This patch fixes that by letting applications call SDL_RenderSetVSync(). This is the same as the patch in #3673, except it applies to all renderers (including PSP, even thought it seems that the VSync flag is disabled for that renderer). Furthermore, the renderer flags also change as well, which #3673 didn't do. It is also an API instead of using hint callbacks (which could be potentially dangerous). Closes #3673.
Sylvain 54ca1d19 2021-08-27T07:44:03 SW_RenderGeometry: add a redundant check to clear static analysis (see bug #4600)
Sylvain a8f89a01 2021-04-23T12:00:14 Change 'size_indice' to 'size_indices'
Sylvain 47db47c1 2021-04-06T21:32:02 Add SDL_HAVE_RENDER_GEOMETRY to compile or not with RenderGeometry support
Sylvain cd0663e0 2021-04-01T11:47:45 Fix declaration-after-statement and remove tabs
Sylvain Becker cd4663df 2021-04-01T11:11:12 Update D3D11 for SDL_RenderGeometryRaw
Sylvain f73c1eff 2021-03-17T09:58:49 Use normalized texture coordinates
Sylvain Becker 9a8a8e65 2021-03-16T16:04:33 Update SDL_render_d3d11.c Fix D3D11 compilation
Sylvain 1ebef073 2021-03-16T15:15:43 Add D3D11 implementation (not yet tested)
Sam Lantinga a91ab883 2021-08-06T12:28:03 Fixed building on Windows with cmake, ninja, and clang
Ozkan Sezer 0ed17131 2021-03-04T18:27:47 update SDL_COMPOSE_ERROR macro for windows clang-cl from a patchset by Vladislav Dmitrievich Turbanov: https://github.com/libsdl-org/SDL/pull/4062
Sam Lantinga 1e5f0073 2021-01-27T10:58:36 Fixed building with mingw64
Sam Lantinga de85d612 2021-01-25T20:51:47 Fixed bug 5497 - SDL_COMPOSE_ERROR is wrong UMU #define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str I think SDL_STRINGIFY_ARG should be removed. #define SDL_COMPOSE_ERROR(str) __FUNCTION__ ", " str (verified with Visual Studio 2019)
Sylvain Becker b94718e0 2021-01-09T21:22:21 SDL_UpdateNVTexture: for D3D11, same notation as SDL_UpdateTexture (bug #5430)
Sylvain Becker 57a5c453 2021-01-05T22:06:51 Fix D3D11 UpdateTextureNV in 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 73d93dbc 2021-01-05T12:20:02 Fix compilation on Window10 (see bug #5430)
Sylvain Becker d1f031c8 2021-01-05T12:08:16 Add SDL_UpdateNVTexture for d3d11 (bug #5430) (not tested)
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
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
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.
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.
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.
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.
Ryan C. Gordon a3804ba1 2019-09-01T22:41:44 d3d11: Fixed VB state, avoiding unnecessary recreation (Thanks, Alex!). Fixes Bugzilla #4779.
Sylvain Becker d68e501d 2019-04-08T13:43:48 Fixed bug 4582 - Maximize/Resize not working on Windows 10 When viewport is set, projectionAndView changes, but ID3D11DeviceContext_UpdateSubresource was not called.
Sam Lantinga b2e76d86 2019-03-19T16:52:09 Fixed Windows RT build
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Ryan C. Gordon fde7592a 2018-11-17T14:39:42 direct3d11: Fixed missing rendering of solid primitives. Fixes Bugzilla #4388.
Ryan C. Gordon bd08a4e6 2018-10-03T19:05:20 render: D3D11 now cycles through 8 vertex buffers. This means it doesn't have to block while the current frame finishes using the vertex buffer; it just moves on to the next, probably-not-in-use buffer.
Ryan C. Gordon a9094a21 2018-10-03T18:23:53 render: D3D11 renderer patched to compile.
Ryan C. Gordon 6e6f7382 2018-10-03T00:52:37 render: first (untested!) shot at converting D3D11 renderer to new interfaces. Probably doesn't even compile yet.
Sam Lantinga 20dfda44 2018-09-28T00:40:35 Fixed mingw-w64 build
Sam Lantinga eb14b635 2018-05-07T19:52:25 Fixed bug 4134 - Render targets lose scale quality after minimizing a fullscreen window Olli-Samuli Lehmus If one creates a window with the SDL_WINDOW_FULLSCREEN_DESKTOP flag, and creates a render target with SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"), and afterwards sets SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"), after minimizing the window, the scale quality hint is lost on the render target. Textures however do keep their interpolation modes.
sezero 40b27fd5 2018-02-12T17:00:00 revert the recent typecast assignment changes (see bug #4079) also change the void* typedefs for the two vulkan function pointers added in vulkan_internal.h into generic function pointer typedefs.
Sam Lantinga 90e72bf4 2018-01-30T18:08:34 Fixed ISO C99 compatibility SDL now builds with gcc 7.2 with the following command line options: -Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga bed7fd80 2017-12-12T12:52:09 Merged latest changes from rel/streaming_client
Sam Lantinga a6a4e27a 2017-11-12T22:51:12 Updated SDL's YUV support, many thanks to Adrien Descamps New functions get and set the YUV colorspace conversion mode: SDL_SetYUVConversionMode() SDL_GetYUVConversionMode() SDL_GetYUVConversionModeForResolution() SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats. Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
Sam Lantinga c59d9923 2017-08-14T05:51:44 Implemented more flexible blending modes for accelerated renderers This fixes bug 2594 - Propose new blend mode, SDL_BLENDMODE_BLEND_DSTA blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD); This fixes bug 2828 - Subtractive Blending blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT, SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT); This goes partway to fixing bug 3684 - Add support for a pre-multiplied alpha blending mode blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD);
David Ludwig b13c443c 2017-02-24T20:49:14 WinRT: removed buildbot debug code, pending further research
David Ludwig f7bfa3b7 2017-02-24T20:19:28 WinRT: more buildbot debug code
David Ludwig ecb1eb82 2017-02-24T19:59:57 WinRT: added code to help debug a buildbot error
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 057bca8a 2016-11-06T15:15:32 Better fix for last point in D3D11 renderer, thanks to Nader Golbaz
Sam Lantinga 330e2952 2016-11-06T08:47:40 Fixed bug 2421 for D3D11 - SDL_RenderCopyEx off by one when rotating by 90 and -90. Nader Golbaz Updated patch for direct3d renderers
Sam Lantinga 27d4f099 2016-10-07T23:40:44 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints
David Ludwig 969c3167 2016-10-01T18:49:15 Fixed MinGW-w64 build warnings in SDL_render_d3d11.c Some of these were legitimate bugs, including: - a malformed SDL_snprintf call - a probably-invalid enum comparison
Sam Lantinga 702d9348 2016-10-01T15:23:43 Added SDL prefix to local IID constants
David Ludwig 7851eb08 2016-10-01T18:10:15 Fixed bug 3437 - build error for WinRT/UWP .dlls, caused by fix for SDL bug 3336 This fix has been tested with both MinGW-w64, and Visual C++ 2012-2015.
Sam Lantinga b7e45f8a 2016-10-01T10:28:00 Fixed bug 3336 - Failure to build with MinGW-w64 Kai Sterker There are already patches available from mingw64 that fix the issue https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-SDL2 With those applied, I could compile SDL2 without problems. But of course, it would be preferable if SDL built cleanly from source.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
David Ludwig 25abce51 2015-11-29T19:33:11 WinRT: added Win10/UWP (Universal Windows Platform) support "UWP" appears to be Microsoft's new name for WinRT/Windows-Store APIs. This set of changes updates SDL's WinRT backends to support the Win10 flavor of WinRT. It has been tested on Win10 on a desktop. In theory, it should also support Win10 on other devices (phone, Xbox One, etc.), however further patches may be necessary. This adds: - a set of MSVC 2015 project files, for use in creating UWP apps - modifications to various pieces of SDL, in order to compile via MSVC 2015 + the Win10 API set - enables SDL_Window resizing and programmatic-fullscreen toggling, when using the WinRT backend - WinRT README updates
David Ludwig 623898f7 2015-11-26T00:41:39 WinRT: lots of display and windowing related fixes This change-set fixes a lot of windowing related bugs, especially with regards to Windows 8.x apps running on Windows 10 (which was the driver for this work). The primary fixes include: * listed display modes were wrong, especially when launching apps into a non-fullscreen space * reported window flags were often wrong, especially on Windows 10 * fullscreen/windowed mode switches weren't failing (they are not programmatically possible in Win 8.x apps).
Philipp Wiesemann 4c72d39c 2015-10-15T22:26:21 D3D11: Fixed SDL_RenderDrawPoints() ignoring input after the first 128 points. If a limit would be needed then count should be adapted before stack allocation.
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga da190975 2015-05-28T18:57:10 Fixed clip rectangle calculation when there is a viewport offset
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Philipp Wiesemann 26b4898a 2015-04-11T20:43:11 Windows: Fixed format string for error message.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
David Ludwig 78f3a80c 2015-02-08T15:44:15 WinRT: made note that VSync is always enabled on WinPhone, due to OS Windows Phone does not appear to allow VSync to be turned off. Doing so appears to either result in content not getting drawn (when the D3D debug runtime is turned off), or forcing VSync back on and logging an error (when the D3D debug runtime is turned on). VSync had been getting turned on anyways, this change just notes such: - via the WinRT README - by always setting the SDL_RENDERER_PRESENTVSYNC flag when creating an SDL_Renderer on Windows Phone
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
David Ludwig 20a6c623 2014-10-14T09:53:46 WinRT: fixed bug whereby offscreen-rendered content could get improperly rotated Attributes on the host device's rotation were getting applied to offscreen textures in an invalid manner. This was causing some apps to look different, depending on how the device was rotated.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Alfred Reynolds 2748e282 2014-07-03T10:22:12 The YUV offset is 16 / 255, not 16 / 256
David Ludwig 0a879d63 2014-05-09T20:16:21 Fixed rendering-alignment issues on WinPhone 8.1, when the device was rotated If a Windows Phone 8.1 device was rotated to anything but Portrait mode, the Direct3D 11 renderer's output wouldn't get aligned correctly with the screen.
David Ludwig ec5f6ad5 2014-04-30T21:12:47 WinRT: suppressed an unused param warning when building for Windows Phone 8.1