Commit graph

50 commits

Author SHA1 Message Date
Sam Lantinga
40f5b81553 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.
2018-05-07 19:52:25 -07:00
sezero
d9c8979193 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.
2018-02-12 17:00:00 +03:00
Sam Lantinga
e9a1c0c9d0 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
2018-01-30 18:08:34 -08:00
Sam Lantinga
346af016a5 Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga
1e762408f2 Merged latest changes from rel/streaming_client 2017-12-12 12:52:09 -08:00
Sam Lantinga
145d2469ae 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.
2017-11-12 22:51:12 -08:00
Sam Lantinga
808e24ac4a 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);
2017-08-14 05:51:44 -07:00
David Ludwig
ba71c20914 WinRT: removed buildbot debug code, pending further research 2017-02-24 20:49:14 -05:00
David Ludwig
b2e9ec7749 WinRT: more buildbot debug code 2017-02-24 20:19:28 -05:00
David Ludwig
d144271806 WinRT: added code to help debug a buildbot error 2017-02-24 19:59:57 -05:00
Sam Lantinga
1b24bfad38 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
3d33cfb22d Better fix for last point in D3D11 renderer, thanks to Nader Golbaz 2016-11-06 15:15:32 -08:00
Sam Lantinga
12f39836d2 Fixed bug 2421 for D3D11 - SDL_RenderCopyEx off by one when rotating by 90 and -90.
Nader Golbaz

Updated patch for direct3d renderers
2016-11-06 08:47:40 -08:00
Sam Lantinga
1b032a0419 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
David Ludwig
b84ac1f538 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
2016-10-01 18:49:15 -04:00
Sam Lantinga
1515c1fb93 Added SDL prefix to local IID constants 2016-10-01 15:23:43 -07:00
David Ludwig
bd4b1b3b89 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.
2016-10-01 18:10:15 -04:00
Sam Lantinga
b26da9ce71 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.
2016-10-01 10:28:00 -07:00
Sam Lantinga
7ee8dda270 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
David Ludwig
028a80e83b 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
2015-11-29 19:33:11 -05:00
David Ludwig
3f86649e74 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).
2015-11-26 00:41:39 -05:00
Philipp Wiesemann
90a67daf0d 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.
2015-10-15 22:26:21 +02:00
Sam Lantinga
d727fa668a Fixed clip rectangle calculation when there is a viewport offset 2015-05-28 18:57:10 -07:00
Sam Lantinga
56b58afdbe Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Philipp Wiesemann
4225abc296 Windows: Fixed format string for error message. 2015-04-11 20:43:11 +02:00
David Ludwig
445da2c732 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

--HG--
extra : rebase_source : 504904b549f21d518919b2254319783da7c9bbdf
2015-02-08 15:44:15 -05:00
David Ludwig
d3886466c4 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.

--HG--
extra : rebase_source : 6c4e6b4b6386c34677532d2744d4e351ae6e9be0
2014-10-14 09:53:46 -04:00
Alfred Reynolds
156e48e6bf The YUV offset is 16 / 255, not 16 / 256 2014-07-03 10:22:12 -07:00
David Ludwig
7246fba47d 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.
2014-05-09 20:16:21 -04:00
David Ludwig
a7d24ca3a3 WinRT: suppressed an unused param warning when building for Windows Phone 8.1 2014-04-30 21:12:47 -04:00
Jørgen P. Tjernø
431aca234b Render: Allow empty cliprect.
This fixes an issue where an empty cliprect is treated the same as a NULL
cliprect, causing the render backends to disable clipping.

Also adds a new API, SDL_RenderIsClipEnabled(render) that allows you to
differentiate between:
 - SDL_RenderSetClipRect(render, NULL)
 - SDL_Rect r = {0,0,0,0}; SDL_RenderSetClipRect(render, &r);

Fixes https://bugzilla.libsdl.org/show_bug.cgi?id=2504

--HG--
extra : amend_source : 9e5ac76e3f009d9ae49bc61c350df3ba891267b5
extra : histedit_source : b92b8be4d05b19a89fa0dee57f7ed6b1e924cb99%2Cce419f6ade87bafc78ff42702c1f263d2469e7e7
2014-04-19 13:15:41 -07:00
David Ludwig
0755238527 WinRT: Call IDXGIDevice3::Trim before app-suspend, as required on Windows 8.1
Thanks to Sylvain Becker for pointing this out!
2014-03-24 22:51:03 -04:00
Sam Lantinga
c0e9a9afaf Added an event SDL_RENDER_DEVICE_RESET, which is triggered on Direct3D 11 when the device has been lost and all textures need to be recreated. 2014-03-23 23:09:22 -07:00
Sam Lantinga
ce92ee5307 Fixing Alt-Enter handling, submitted by Nader Golbaz
I encountered a little issue: DXGI monitors application's message queue and this behavior interferes with SDL if the application already handles Alt-Enter sequence. I think it is necessary to disable this behavior.
bb174540%28v=vs.85%29.aspx
2014-03-23 22:53:50 -07:00
David Ludwig
519432a55f D3D11: Fixed a crash after a GPU device-reset on Win32 2014-03-23 16:08:32 -04:00
David Ludwig
48ecbf8800 D3D11: Added code to handle GPU-device-removed scenarios
These scenarios can happen when a GPU is switched, its driver updated, or in
some virtual machines (such as Parallels) are suspended and then resumed.  In
these cases, all GPU resources will already be lost, and it's up to the app to
recover.

For now, SDL's D3D11 renderer will handle this by freeing all GPU resources,
including all textures, and then sending a SDL_RENDER_TARGETS_RESET event.
It's currently up to an app to intercept this event, destroy all of its
textures, then recreate them from scratch.
2014-03-23 13:48:16 -04:00
David Ludwig
4f443b34f0 Fixed a crash on Windows Phone 8 that occurred after rotating a device
This changeset prevents IDXGISwapChain::ResizeBuffers from being invoked on
Windows Phone 8, a function that isn't available on the platform (but is
available on other Windows platforms).  The call would fail, which ultimately
led to a crash.

This changeset also attempts to make sure that the D3D11 swap chain is created
at the correct size, when using Windows Phone 8.

Still TODO: make sure rotation-querying works across relevant Windows
platforms (that support Direct3D 11.x).
2014-03-15 13:27:18 -04:00
Sam Lantinga
67fb6a9aa7 Fixed the copyright date on files contributed by David Ludwig 2014-03-13 00:40:08 -07:00
David Ludwig
468dbccb39 Merged various WinRT build fixes
--HG--
rename : src/render/direct3d11/SDL_render_d3d11_winrthelpers.cpp => src/render/direct3d11/SDL_render_winrt.cpp
2014-03-12 12:12:20 -04:00
David Ludwig
7ba3100244 Fixed various build and runtime errors when using WinRT with VS2012. 2014-03-12 11:57:15 -04:00
Sam Lantinga
ad407b378a Fixed compiling Windows RT code on Visual Studio 2013
--HG--
rename : src/render/direct3d11/SDL_render_d3d11_winrthelpers.cpp => src/render/direct3d11/SDL_render_winrt.cpp
rename : src/render/direct3d11/SDL_render_d3d11_winrthelpers_cpp.h => src/render/direct3d11/SDL_render_winrt.h
2014-03-12 07:26:07 -07:00
David Ludwig
5007e2996e Fixed compiler errors in the D3D11 renderer when building for WinRT
Still TODO: fix other build errors, especially linker errors, when building
SDL/WinRT, then fix any runtime errors that pop up.

--HG--
extra : rebase_source : dec261a0a61ffe463455f7d0a639f4c087e975ba
2014-03-11 12:40:31 -04:00
David Ludwig
cfebd21bdc Made VS2012 build the D3D11 renderer
This change is currently limited to Win32/Windows-Desktop builds.  Build fixes
for WinRT + VS2012 are still pending.

--HG--
extra : rebase_source : 1ba34b2a9a394347f5d95730eeabc3f0d7e4f197
2014-03-10 22:53:03 -04:00
Sam Lantinga
d16a9a6781 Fixed D3D9 initialization on Windows 8, which doesn't have D3DX 2014-03-10 17:19:19 -07:00
Sam Lantinga
1d203bd13f Implemented fullscreen <-> windowed transition on Windows 8 2014-03-10 15:00:59 -07:00
Sam Lantinga
9d421197ef Fixed line endings 2014-03-10 14:35:37 -07:00
Sam Lantinga
0879cd423c Fixed creating the rendering context on a specific device 2014-03-10 12:49:15 -07:00
Sam Lantinga
aceab387be Implemented YV12 and IYUV texture support for the D3D11 renderer 2014-03-10 05:44:34 -07:00
Sam Lantinga
5e7f7c7f4b Minor style tweaks 2014-03-10 02:13:44 -07:00
Sam Lantinga
1348631206 Converted David Ludwig's D3D11 renderer to C and optimized it.
The D3D11 renderer is now slightly faster than D3D9 on my Windows 8 machine (testsprite2 runs at 3400 FPS vs 3100 FPS)
This will need tweaking to fix the Windows RT build.

--HG--
rename : src/render/direct3d11/SDL_render_d3d11.cpp => src/render/direct3d11/SDL_render_d3d11.c
2014-03-10 01:51:03 -07:00
Renamed from src/render/direct3d11/SDL_render_d3d11.cpp (Browse further)