WinRT: moved contents of the d3d11 renderer's header file into its implementation file
authorDavid Ludwig <dludwig@pobox.com>
Wed, 25 Dec 2013 13:13:15 -0500
changeset 85599429f36bca22
parent 8558 f3a1718a65c6
child 8560 5e14c111f2f9
WinRT: moved contents of the d3d11 renderer's header file into its implementation file
VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj
VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj.filters
VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj
VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters
src/render/direct3d11/SDL_render_d3d11.cpp
src/render/direct3d11/SDL_render_d3d11_cpp.h
     1.1 --- a/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj	Wed Dec 25 13:00:41 2013 -0500
     1.2 +++ b/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj	Wed Dec 25 13:13:15 2013 -0500
     1.3 @@ -215,7 +215,6 @@
     1.4      <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
     1.5      <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
     1.6      <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
     1.7 -    <ClInclude Include="..\..\src\render\direct3d11\SDL_render_d3d11_cpp.h" />
     1.8      <ClInclude Include="..\..\src\render\mmx.h" />
     1.9      <ClInclude Include="..\..\src\render\SDL_sysrender.h" />
    1.10      <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h" />
     2.1 --- a/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj.filters	Wed Dec 25 13:00:41 2013 -0500
     2.2 +++ b/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj.filters	Wed Dec 25 13:13:15 2013 -0500
     2.3 @@ -318,9 +318,6 @@
     2.4      <ClInclude Include="..\..\src\video\SDL_sysvideo.h">
     2.5        <Filter>Source Files</Filter>
     2.6      </ClInclude>
     2.7 -    <ClInclude Include="..\..\src\render\direct3d11\SDL_render_d3d11_cpp.h">
     2.8 -      <Filter>Source Files</Filter>
     2.9 -    </ClInclude>
    2.10      <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h">
    2.11        <Filter>Source Files</Filter>
    2.12      </ClInclude>
     3.1 --- a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj	Wed Dec 25 13:00:41 2013 -0500
     3.2 +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj	Wed Dec 25 13:13:15 2013 -0500
     3.3 @@ -284,7 +284,6 @@
     3.4      <ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h" />
     3.5      <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
     3.6      <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
     3.7 -    <ClInclude Include="..\..\src\render\direct3d11\SDL_render_d3d11_cpp.h" />
     3.8      <ClInclude Include="..\..\src\render\mmx.h" />
     3.9      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
    3.10      <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
     4.1 --- a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters	Wed Dec 25 13:00:41 2013 -0500
     4.2 +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters	Wed Dec 25 13:13:15 2013 -0500
     4.3 @@ -599,9 +599,6 @@
     4.4      <ClInclude Include="..\..\include\SDL_system.h">
     4.5        <Filter>Header Files</Filter>
     4.6      </ClInclude>
     4.7 -    <ClInclude Include="..\..\src\render\direct3d11\SDL_render_d3d11_cpp.h">
     4.8 -      <Filter>Source Files</Filter>
     4.9 -    </ClInclude>
    4.10      <ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h">
    4.11        <Filter>Header Files</Filter>
    4.12      </ClInclude>
     5.1 --- a/src/render/direct3d11/SDL_render_d3d11.cpp	Wed Dec 25 13:00:41 2013 -0500
     5.2 +++ b/src/render/direct3d11/SDL_render_d3d11.cpp	Wed Dec 25 13:13:15 2013 -0500
     5.3 @@ -49,7 +49,10 @@
     5.4  #include <string>
     5.5  #include <vector>
     5.6  
     5.7 -#include "SDL_render_d3d11_cpp.h"
     5.8 +#include <D3D11_1.h>
     5.9 +#include <DirectXMath.h>
    5.10 +#include <wrl/client.h>
    5.11 +
    5.12  
    5.13  using namespace DirectX;
    5.14  using namespace Microsoft::WRL;
    5.15 @@ -64,8 +67,70 @@
    5.16  static const D3D11_FILTER SDL_D3D11_NEAREST_PIXEL_FILTER = D3D11_FILTER_MIN_MAG_MIP_POINT;
    5.17  static const D3D11_FILTER SDL_D3D11_LINEAR_FILTER = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    5.18  
    5.19 +/* Vertex shader, common values */
    5.20 +struct SDL_VertexShaderConstants
    5.21 +{
    5.22 +    DirectX::XMFLOAT4X4 model;
    5.23 +    DirectX::XMFLOAT4X4 view;
    5.24 +    DirectX::XMFLOAT4X4 projection;
    5.25 +};
    5.26 +
    5.27 +/* Per-vertex data */
    5.28 +struct VertexPositionColor
    5.29 +{
    5.30 +    DirectX::XMFLOAT3 pos;
    5.31 +    DirectX::XMFLOAT2 tex;
    5.32 +    DirectX::XMFLOAT4 color;
    5.33 +};
    5.34 +
    5.35 +/* Per-texture data */
    5.36 +typedef struct
    5.37 +{
    5.38 +    Microsoft::WRL::ComPtr<ID3D11Texture2D> mainTexture;
    5.39 +    Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> mainTextureResourceView;
    5.40 +    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mainTextureRenderTargetView;
    5.41 +    SDL_PixelFormat * pixelFormat;
    5.42 +    Microsoft::WRL::ComPtr<ID3D11Texture2D> stagingTexture;
    5.43 +    DirectX::XMINT2 lockedTexturePosition;
    5.44 +    D3D11_FILTER scaleMode;
    5.45 +} D3D11_TextureData;
    5.46 +
    5.47 +/* Private renderer data */
    5.48 +typedef struct
    5.49 +{
    5.50 +    Microsoft::WRL::ComPtr<ID3D11Device1> d3dDevice;
    5.51 +    Microsoft::WRL::ComPtr<ID3D11DeviceContext1> d3dContext;
    5.52 +    Microsoft::WRL::ComPtr<IDXGISwapChain1> swapChain;
    5.53 +    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mainRenderTargetView;
    5.54 +    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> currentOffscreenRenderTargetView;
    5.55 +    Microsoft::WRL::ComPtr<ID3D11InputLayout> inputLayout;
    5.56 +    Microsoft::WRL::ComPtr<ID3D11Buffer> vertexBuffer;
    5.57 +    Microsoft::WRL::ComPtr<ID3D11VertexShader> vertexShader;
    5.58 +    Microsoft::WRL::ComPtr<ID3D11PixelShader> texturePixelShader;
    5.59 +    Microsoft::WRL::ComPtr<ID3D11PixelShader> colorPixelShader;
    5.60 +    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeBlend;
    5.61 +    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeAdd;
    5.62 +    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeMod;
    5.63 +    Microsoft::WRL::ComPtr<ID3D11SamplerState> nearestPixelSampler;
    5.64 +    Microsoft::WRL::ComPtr<ID3D11SamplerState> linearSampler;
    5.65 +    Microsoft::WRL::ComPtr<ID3D11RasterizerState> mainRasterizer;
    5.66 +    D3D_FEATURE_LEVEL featureLevel;
    5.67 +
    5.68 +    // Vertex buffer constants:
    5.69 +    SDL_VertexShaderConstants vertexShaderConstantsData;
    5.70 +    Microsoft::WRL::ComPtr<ID3D11Buffer> vertexShaderConstants;
    5.71 +
    5.72 +    // Cached renderer properties.
    5.73 +    DirectX::XMFLOAT2 windowSizeInDIPs;
    5.74 +    DirectX::XMFLOAT2 renderTargetSize;
    5.75 +    Windows::Graphics::Display::DisplayOrientations orientation;
    5.76 +
    5.77 +    // Transform used for display orientation.
    5.78 +    DirectX::XMFLOAT4X4 orientationTransform3D;
    5.79 +} D3D11_RenderData;
    5.80 +
    5.81 +
    5.82  /* Direct3D 11.1 renderer implementation */
    5.83 -
    5.84  static SDL_Renderer *D3D11_CreateRenderer(SDL_Window * window, Uint32 flags);
    5.85  static void D3D11_WindowEvent(SDL_Renderer * renderer,
    5.86                              const SDL_WindowEvent *event);
     6.1 --- a/src/render/direct3d11/SDL_render_d3d11_cpp.h	Wed Dec 25 13:00:41 2013 -0500
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,86 +0,0 @@
     6.4 -/*
     6.5 -  Simple DirectMedia Layer
     6.6 -  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     6.7 -
     6.8 -  This software is provided 'as-is', without any express or implied
     6.9 -  warranty.  In no event will the authors be held liable for any damages
    6.10 -  arising from the use of this software.
    6.11 -
    6.12 -  Permission is granted to anyone to use this software for any purpose,
    6.13 -  including commercial applications, and to alter it and redistribute it
    6.14 -  freely, subject to the following restrictions:
    6.15 -
    6.16 -  1. The origin of this software must not be misrepresented; you must not
    6.17 -     claim that you wrote the original software. If you use this software
    6.18 -     in a product, an acknowledgment in the product documentation would be
    6.19 -     appreciated but is not required.
    6.20 -  2. Altered source versions must be plainly marked as such, and must not be
    6.21 -     misrepresented as being the original software.
    6.22 -  3. This notice may not be removed or altered from any source distribution.
    6.23 -*/
    6.24 -#include "SDL_config.h"
    6.25 -
    6.26 -#include <D3D11_1.h>
    6.27 -#include <DirectXMath.h>
    6.28 -#include <wrl/client.h>
    6.29 -#include <vector>
    6.30 -
    6.31 -struct SDL_VertexShaderConstants
    6.32 -{
    6.33 -    DirectX::XMFLOAT4X4 model;
    6.34 -    DirectX::XMFLOAT4X4 view;
    6.35 -    DirectX::XMFLOAT4X4 projection;
    6.36 -};
    6.37 -
    6.38 -typedef struct
    6.39 -{
    6.40 -    Microsoft::WRL::ComPtr<ID3D11Device1> d3dDevice;
    6.41 -    Microsoft::WRL::ComPtr<ID3D11DeviceContext1> d3dContext;
    6.42 -    Microsoft::WRL::ComPtr<IDXGISwapChain1> swapChain;
    6.43 -    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mainRenderTargetView;
    6.44 -    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> currentOffscreenRenderTargetView;
    6.45 -    Microsoft::WRL::ComPtr<ID3D11InputLayout> inputLayout;
    6.46 -    Microsoft::WRL::ComPtr<ID3D11Buffer> vertexBuffer;
    6.47 -    Microsoft::WRL::ComPtr<ID3D11VertexShader> vertexShader;
    6.48 -    Microsoft::WRL::ComPtr<ID3D11PixelShader> texturePixelShader;
    6.49 -    Microsoft::WRL::ComPtr<ID3D11PixelShader> colorPixelShader;
    6.50 -    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeBlend;
    6.51 -    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeAdd;
    6.52 -    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeMod;
    6.53 -    Microsoft::WRL::ComPtr<ID3D11SamplerState> nearestPixelSampler;
    6.54 -    Microsoft::WRL::ComPtr<ID3D11SamplerState> linearSampler;
    6.55 -    Microsoft::WRL::ComPtr<ID3D11RasterizerState> mainRasterizer;
    6.56 -    D3D_FEATURE_LEVEL featureLevel;
    6.57 -
    6.58 -    // Vertex buffer constants:
    6.59 -    SDL_VertexShaderConstants vertexShaderConstantsData;
    6.60 -    Microsoft::WRL::ComPtr<ID3D11Buffer> vertexShaderConstants;
    6.61 -
    6.62 -    // Cached renderer properties.
    6.63 -    DirectX::XMFLOAT2 windowSizeInDIPs;
    6.64 -    DirectX::XMFLOAT2 renderTargetSize;
    6.65 -    Windows::Graphics::Display::DisplayOrientations orientation;
    6.66 -
    6.67 -    // Transform used for display orientation.
    6.68 -    DirectX::XMFLOAT4X4 orientationTransform3D;
    6.69 -} D3D11_RenderData;
    6.70 -
    6.71 -typedef struct
    6.72 -{
    6.73 -    Microsoft::WRL::ComPtr<ID3D11Texture2D> mainTexture;
    6.74 -    Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> mainTextureResourceView;
    6.75 -    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mainTextureRenderTargetView;
    6.76 -    SDL_PixelFormat * pixelFormat;
    6.77 -    Microsoft::WRL::ComPtr<ID3D11Texture2D> stagingTexture;
    6.78 -    DirectX::XMINT2 lockedTexturePosition;
    6.79 -    D3D11_FILTER scaleMode;
    6.80 -} D3D11_TextureData;
    6.81 -
    6.82 -struct VertexPositionColor
    6.83 -{
    6.84 -    DirectX::XMFLOAT3 pos;
    6.85 -    DirectX::XMFLOAT2 tex;
    6.86 -    DirectX::XMFLOAT4 color;
    6.87 -};
    6.88 -
    6.89 -/* vi: set ts=4 sw=4 expandtab: */