Commit Graph

133 Commits

Author SHA1 Message Date
David Ludwig
a99bf4d705 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
26823b1bb4 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
3317e4340d 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.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb174540%28v=vs.85%29.aspx
2014-03-23 22:53:50 -07:00
David Ludwig
46a80b04d8 D3D11: Fixed a crash after a GPU device-reset on Win32 2014-03-23 16:08:32 -04:00
David Ludwig
6ce684e92b 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
Ryan C. Gordon
93ba5bd899 Static analysis fix: uninitialized value.
(A false positive: clang doesn't know SDL_SetError() always returns -1.)
2014-03-20 16:23:18 -04:00
Ryan C. Gordon
415675bef0 Static analysis fix: division by zero. 2014-03-20 11:14:44 -04:00
Ryan C. Gordon
b659c70080 Static analysis fix: uninitialized variables.
This is actually a false-positive, in this case, since Clang doesn't know
 that SDL_SetError() only ever returns -1. Feature request to improve that,
 with explanation about these specific SDL patches, is here:

   http://llvm.org/bugs/show_bug.cgi?id=19208
2014-03-20 10:41:47 -04:00
Ryan C. Gordon
e84fc5a368 Static analysis fix: division by zero. 2014-03-19 18:25:21 -04:00
David Ludwig
f25ee50b03 Fixed broken rotation detection routines on WinRT
Rotation detection and handling should now work across all, publicly-released,
WinRT-based platforms (Windows 8.0, Windows 8.1, and Windows Phone 8.0).
2014-03-15 14:54:23 -04:00
David Ludwig
5281f9f1ea 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
f9a5896819 Added missing copyright notices 2014-03-13 21:21:26 -07:00
Sam Lantinga
ed02f61da1 Fixed the copyright date on files contributed by David Ludwig 2014-03-13 00:40:08 -07:00
David Ludwig
4cd5ed7ba2 Merged various WinRT build fixes 2014-03-12 12:12:20 -04:00
David Ludwig
b68b6e23d1 Fixed various build and runtime errors when using WinRT with VS2012. 2014-03-12 11:57:15 -04:00
Sam Lantinga
641ba09975 Fixed compiling Windows RT code on Visual Studio 2013 2014-03-12 07:26:07 -07:00
David Ludwig
36e7c8d92d 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.
2014-03-11 12:40:31 -04:00
David Ludwig
ce3c5b842f Made VS2012 build the D3D11 renderer
This change is currently limited to Win32/Windows-Desktop builds.  Build fixes
for WinRT + VS2012 are still pending.
2014-03-10 22:53:03 -04:00
Sam Lantinga
2c558ca24d Fixed D3D9 initialization on Windows 8, which doesn't have D3DX 2014-03-10 17:19:19 -07:00
Sam Lantinga
9c2fb684af Implemented fullscreen <-> windowed transition on Windows 8 2014-03-10 15:00:59 -07:00
Sam Lantinga
7e8b25534d Fixed line endings 2014-03-10 14:35:37 -07:00
Sam Lantinga
3df586cef5 Fixed creating the rendering context on a specific device 2014-03-10 12:49:15 -07:00
Sam Lantinga
9aa5b1d457 Implemented YV12 and IYUV texture support for the D3D11 renderer 2014-03-10 05:44:34 -07:00
Sam Lantinga
965cdf10d4 Minor style tweaks 2014-03-10 02:13:44 -07:00
Sam Lantinga
1a35f32b68 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.
2014-03-10 01:51:03 -07:00
Sam Lantinga
a8f540fe4a Fixed renderer flags to include support for target textures after the renderer is created. 2014-03-09 22:48:38 -07:00
Sam Lantinga
1367bf8748 Integrated David Ludwig's support for Windows RT 2014-03-09 11:36:47 -07:00
Sam Lantinga
05c23063bb Fixed line endings on WinRT source code 2014-03-09 11:06:11 -07:00
Gabriel Jacobo
f61602b434 Improve window recreation logic in OpenGL* renderers 2014-02-27 20:21:46 -03:00
Gabriel Jacobo
4c192bc802 Fixes #2308, recreate window if GL requirements for the renderer are not met
If the window has been created with values for SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION not matching those
required by the renderer, attempt to recreate the window.
This is needed on platforms where both GL and GLES 1/2 surfaces are supported
by the video backend, requiring that the window be recreated when switching
between context types.
2014-02-25 17:42:34 -03:00
David Ludwig
44b0e901f0 WinRT: d3d11 blend mode bug fixes
The destination target's alpha wasn't getting set correctly in many cases.  Among other problems, this prevented some alpha-blended textures from displaying correctly in Windows Phone 8's multitasking screen.

The d3d11 renderer now uses the same blending settings found in the d3d9 renderer.
2013-12-30 11:59:04 -05:00
David Ludwig
0562e53fdf WinRT: minor header file usage cleanup in the d3d11 renderer 2013-12-26 11:04:35 -05:00
David Ludwig
94233675c7 WinRT: simplified the d3d11 vertex shader a bit
The projection and view matrices are now computed ahead of time, as they both get computed in the same spot, and typically not often.  If this does, however, become a performance problem later on, this change can always be reverted.
2013-12-26 11:03:43 -05:00
David Ludwig
7ef05d266f WinRT: implemented SDL_RenderSetClipRect for the d3d11 renderer 2013-12-26 10:18:33 -05:00
David Ludwig
700f82de2b WinRT: corrected a minor error in an end-of-file comment 2013-12-25 23:46:19 -05:00
David Ludwig
8b2694f986 WinRT: minor rotation/orientation code cleanup in the d3d11 renderer 2013-12-25 23:45:07 -05:00
David Ludwig
b93ab1e6a3 WinRT: removed a bit of dead d3d11 code 2013-12-25 23:25:25 -05:00
David Ludwig
f0e406e994 WinRT: d3d11 compiled-shader code cleanup
I'm surprised this code even compiled, before this change.  It did, but regardless, here's a cleanup.
2013-12-25 22:27:58 -05:00
David Ludwig
4d16628f1c WinRT: made sure d3d11 debug mode doesn't get enabled by default
D3D11 debug mode got inadvertently enabled, in all cases, via changeset c0e68f3.  This change reverts that.
2013-12-25 22:05:18 -05:00
David Ludwig
ce8057221a WinRT: compiled the d3d11 renderer's shaders into SDL itself
Previously, the shaders would get compiled separately, the output of which would need to be packaged into the app.  This change should make SDL's dll be the only binary needed to include SDL in a WinRT app.
2013-12-25 21:39:48 -05:00
David Ludwig
8db33416a2 WinRT: added a TODO note regarding texture-[un]locking in the d3d11 renderer 2013-12-25 14:20:40 -05:00
David Ludwig
187f52e80f WinRT: renamed d3d11-internal struct, SDL_VertexShaderConstants, to just VertexShaderConstants
This is primarily to keep naming consistent with other shader-bound structs.
2013-12-25 14:17:49 -05:00
David Ludwig
2225493102 WinRT: moved contents of the d3d11 renderer's header file into its implementation file 2013-12-25 13:13:15 -05:00
David Ludwig
d4ae392953 WinRT: simplified a potentially-common error message from D3D11_SetRenderTarget 2013-12-25 13:00:41 -05:00
David Ludwig
b0df915737 WinRT: removed an unnecessary use of std::string in the d3d11 renderer 2013-12-25 12:58:37 -05:00
David Ludwig
10f2de1e69 WinRT: utilized SDL_SetError's return value in the d3d11 renderer 2013-12-25 12:52:16 -05:00
David Ludwig
43e27aa82e WinRT: minor d3d11 code cleanups 2013-12-25 12:48:47 -05:00
David Ludwig
8c8feb83e0 WinRT: made d3d11-spawned error messages trickle down
Some error messages had the potential to be overwritten/obscured.
2013-12-25 12:47:39 -05:00
David Ludwig
5fba7db23c WinRT: made d3d11-spawned error messages include the function name of failed calls 2013-12-25 12:43:26 -05:00
David Ludwig
5e6aba0670 WinRT: better rendering performance via D3D11_USAGE_DYNAMIC 2013-12-22 21:13:35 -05:00