src/render/direct3d11/SDL_render_d3d11.cpp
author David Ludwig <dludwig@pobox.com>
Wed, 25 Dec 2013 21:39:48 -0500
changeset 8563 c0e68f3b6bbb
parent 8561 c10e5bfa6459
child 8564 03366aeff6c6
permissions -rw-r--r--
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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     1
/*
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     2
  Simple DirectMedia Layer
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     4
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     5
  This software is provided 'as-is', without any express or implied
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     7
  arising from the use of this software.
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     8
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    11
  freely, subject to the following restrictions:
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    12
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    14
     claim that you wrote the original software. If you use this software
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    16
     appreciated but is not required.
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    18
     misrepresented as being the original software.
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    20
*/
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    21
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    22
#include "SDL_config.h"
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    23
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    24
#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    25
8463
98dbf81ed5e9 WinRT: made SDL's inner WinRT CoreWindow be accessible to non-C++/CX code, in theory
David Ludwig <dludwig@pobox.com>
parents: 8459
diff changeset
    26
#ifdef __WINRT__
98dbf81ed5e9 WinRT: made SDL's inner WinRT CoreWindow be accessible to non-C++/CX code, in theory
David Ludwig <dludwig@pobox.com>
parents: 8459
diff changeset
    27
#include <windows.ui.core.h>
98dbf81ed5e9 WinRT: made SDL's inner WinRT CoreWindow be accessible to non-C++/CX code, in theory
David Ludwig <dludwig@pobox.com>
parents: 8459
diff changeset
    28
#include <windows.foundation.h>
8505
a76a3842c9eb WinRT: experimental and preliminary support for XAML-based overlays on Windows 8/RT
David Ludwig <dludwig@pobox.com>
parents: 8504
diff changeset
    29
a76a3842c9eb WinRT: experimental and preliminary support for XAML-based overlays on Windows 8/RT
David Ludwig <dludwig@pobox.com>
parents: 8504
diff changeset
    30
#if WINAPI_FAMILY == WINAPI_FAMILY_APP
a76a3842c9eb WinRT: experimental and preliminary support for XAML-based overlays on Windows 8/RT
David Ludwig <dludwig@pobox.com>
parents: 8504
diff changeset
    31
#include <windows.ui.xaml.media.dxinterop.h>
a76a3842c9eb WinRT: experimental and preliminary support for XAML-based overlays on Windows 8/RT
David Ludwig <dludwig@pobox.com>
parents: 8504
diff changeset
    32
#endif
a76a3842c9eb WinRT: experimental and preliminary support for XAML-based overlays on Windows 8/RT
David Ludwig <dludwig@pobox.com>
parents: 8504
diff changeset
    33
8463
98dbf81ed5e9 WinRT: made SDL's inner WinRT CoreWindow be accessible to non-C++/CX code, in theory
David Ludwig <dludwig@pobox.com>
parents: 8459
diff changeset
    34
#endif
98dbf81ed5e9 WinRT: made SDL's inner WinRT CoreWindow be accessible to non-C++/CX code, in theory
David Ludwig <dludwig@pobox.com>
parents: 8459
diff changeset
    35
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    36
extern "C" {
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    37
#include "../../core/windows/SDL_windows.h"
8533
89cf2a2635d1 WinRT: made the Direct3D 11.x 'Debug Layer' be enable-able in any app via a hint
David Ludwig <dludwig@pobox.com>
parents: 8526
diff changeset
    38
#include "SDL_hints.h"
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    39
//#include "SDL_loadso.h"
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
    40
#include "SDL_system.h"
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    41
#include "SDL_syswm.h"
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    42
#include "../SDL_sysrender.h"
8433
3017f87e4479 WinRT: bug fixes for device orientation + Direct3D 11.1 rendering
David Ludwig <dludwig@pobox.com>
parents: 8432
diff changeset
    43
#include "SDL_log.h"
3017f87e4479 WinRT: bug fixes for device orientation + Direct3D 11.1 rendering
David Ludwig <dludwig@pobox.com>
parents: 8432
diff changeset
    44
#include "../../video/SDL_sysvideo.h"
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    45
//#include "stdio.h"
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    46
}
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    47
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
    48
#include <fstream>
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
    49
#include <string>
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
    50
#include <vector>
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
    51
8559
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    52
#include <D3D11_1.h>
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    53
#include <DirectXMath.h>
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    54
#include <wrl/client.h>
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    55
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    56
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
    57
using namespace DirectX;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
    58
using namespace Microsoft::WRL;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
    59
using namespace std;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
    60
8412
59f1191a5cca WinRT: more work on moving rendering code from SDL_winrtrenderer.* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8410
diff changeset
    61
#ifdef __WINRT__
59f1191a5cca WinRT: more work on moving rendering code from SDL_winrtrenderer.* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8410
diff changeset
    62
using namespace Windows::Graphics::Display;
59f1191a5cca WinRT: more work on moving rendering code from SDL_winrtrenderer.* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8410
diff changeset
    63
using namespace Windows::UI::Core;
59f1191a5cca WinRT: more work on moving rendering code from SDL_winrtrenderer.* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8410
diff changeset
    64
#endif
59f1191a5cca WinRT: more work on moving rendering code from SDL_winrtrenderer.* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8410
diff changeset
    65
8540
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
    66
/* Texture sampling types */
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
    67
static const D3D11_FILTER SDL_D3D11_NEAREST_PIXEL_FILTER = D3D11_FILTER_MIN_MAG_MIP_POINT;
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
    68
static const D3D11_FILTER SDL_D3D11_LINEAR_FILTER = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
    69
8559
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    70
/* Vertex shader, common values */
8560
5e14c111f2f9 WinRT: renamed d3d11-internal struct, SDL_VertexShaderConstants, to just VertexShaderConstants
David Ludwig <dludwig@pobox.com>
parents: 8559
diff changeset
    71
struct VertexShaderConstants
8559
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    72
{
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    73
    DirectX::XMFLOAT4X4 model;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    74
    DirectX::XMFLOAT4X4 view;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    75
    DirectX::XMFLOAT4X4 projection;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    76
};
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    77
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    78
/* Per-vertex data */
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    79
struct VertexPositionColor
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    80
{
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    81
    DirectX::XMFLOAT3 pos;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    82
    DirectX::XMFLOAT2 tex;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    83
    DirectX::XMFLOAT4 color;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    84
};
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    85
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    86
/* Per-texture data */
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    87
typedef struct
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    88
{
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    89
    Microsoft::WRL::ComPtr<ID3D11Texture2D> mainTexture;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    90
    Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> mainTextureResourceView;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    91
    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mainTextureRenderTargetView;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    92
    SDL_PixelFormat * pixelFormat;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    93
    Microsoft::WRL::ComPtr<ID3D11Texture2D> stagingTexture;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    94
    DirectX::XMINT2 lockedTexturePosition;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    95
    D3D11_FILTER scaleMode;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    96
} D3D11_TextureData;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    97
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    98
/* Private renderer data */
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
    99
typedef struct
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   100
{
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   101
    Microsoft::WRL::ComPtr<ID3D11Device1> d3dDevice;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   102
    Microsoft::WRL::ComPtr<ID3D11DeviceContext1> d3dContext;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   103
    Microsoft::WRL::ComPtr<IDXGISwapChain1> swapChain;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   104
    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mainRenderTargetView;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   105
    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> currentOffscreenRenderTargetView;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   106
    Microsoft::WRL::ComPtr<ID3D11InputLayout> inputLayout;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   107
    Microsoft::WRL::ComPtr<ID3D11Buffer> vertexBuffer;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   108
    Microsoft::WRL::ComPtr<ID3D11VertexShader> vertexShader;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   109
    Microsoft::WRL::ComPtr<ID3D11PixelShader> texturePixelShader;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   110
    Microsoft::WRL::ComPtr<ID3D11PixelShader> colorPixelShader;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   111
    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeBlend;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   112
    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeAdd;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   113
    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeMod;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   114
    Microsoft::WRL::ComPtr<ID3D11SamplerState> nearestPixelSampler;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   115
    Microsoft::WRL::ComPtr<ID3D11SamplerState> linearSampler;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   116
    Microsoft::WRL::ComPtr<ID3D11RasterizerState> mainRasterizer;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   117
    D3D_FEATURE_LEVEL featureLevel;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   118
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   119
    // Vertex buffer constants:
8560
5e14c111f2f9 WinRT: renamed d3d11-internal struct, SDL_VertexShaderConstants, to just VertexShaderConstants
David Ludwig <dludwig@pobox.com>
parents: 8559
diff changeset
   120
    VertexShaderConstants vertexShaderConstantsData;
8559
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   121
    Microsoft::WRL::ComPtr<ID3D11Buffer> vertexShaderConstants;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   122
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   123
    // Cached renderer properties.
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   124
    DirectX::XMFLOAT2 windowSizeInDIPs;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   125
    DirectX::XMFLOAT2 renderTargetSize;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   126
    Windows::Graphics::Display::DisplayOrientations orientation;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   127
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   128
    // Transform used for display orientation.
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   129
    DirectX::XMFLOAT4X4 orientationTransform3D;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   130
} D3D11_RenderData;
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   131
9429f36bca22 WinRT: moved contents of the d3d11 renderer's header file into its implementation file
David Ludwig <dludwig@pobox.com>
parents: 8558
diff changeset
   132
8563
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   133
/* Direct3D 11.x shaders
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   134
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   135
   SDL's shaders are compiled into SDL itself, to simplify distribution.
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   136
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   137
   All Direct3D 11.x shaders were compiled with the following:
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   138
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   139
   fxc /E"main" /T "<TYPE>" /Fo"<OUTPUT FILE>" "<INPUT FILE>"
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   140
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   141
     Variables:
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   142
     - <TYPE>: the type of shader.  A table of utilized shader types is
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   143
       listed below.
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   144
     - <OUTPUT FILE>: where to store compiled output
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   145
     - <INPUT FILE>: where to read shader source code from
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   146
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   147
     Shader types:
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   148
     - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   149
     - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   150
     - ps_4_0_level_9_3: Pixel shader for Windows Phone 8
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   151
     - vs_4_0_level_9_3: Vertex shader for Windows Phone 8
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   152
  */
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   153
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   154
#define D3D11_USE_SHADER_MODEL_4_0_level_9_3
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   155
#else
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   156
#define D3D11_USE_SHADER_MODEL_4_0_level_9_1
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   157
#endif
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   158
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   159
/* The texture-rendering pixel shader:
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   160
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   161
    --- D3D11_PixelShader_Textures.hlsl ---
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   162
    Texture2D theTexture : register(t0);
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   163
    SamplerState theSampler : register(s0);
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   164
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   165
    struct PixelShaderInput
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   166
    {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   167
        float4 pos : SV_POSITION;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   168
        float2 tex : TEXCOORD0;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   169
        float4 color : COLOR0;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   170
    };
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   171
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   172
    float4 main(PixelShaderInput input) : SV_TARGET
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   173
    {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   174
        return theTexture.Sample(theSampler, input.tex) * input.color;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   175
    }
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   176
*/
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   177
#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   178
static const DWORD D3D11_PixelShader_Textures[] = {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   179
    0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   180
    0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   181
    0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   182
    0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   183
    0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   184
    0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   185
    0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   186
    0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   187
    0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   188
    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   189
    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   190
    0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   191
    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   192
    0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   193
    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   194
    0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   195
    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   196
    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   197
    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   198
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   199
    0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   200
    0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   201
    0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   202
    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   203
    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   204
    0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   205
    0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   206
    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   207
    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   208
    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   209
    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   210
    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   211
    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   212
    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   213
};
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   214
#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   215
static const DWORD D3D11_PixelShader_Textures[] = {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   216
    0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   217
    0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   218
    0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   219
    0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   220
    0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   221
    0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   222
    0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   223
    0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   224
    0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   225
    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   226
    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   227
    0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   228
    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   229
    0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   230
    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   231
    0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   232
    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   233
    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   234
    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   235
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   236
    0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   237
    0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   238
    0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   239
    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   240
    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   241
    0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   242
    0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   243
    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   244
    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   245
    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   246
    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   247
    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   248
    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   249
    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   250
};
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   251
#else
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   252
#error "An appropriate 'textures' pixel shader is not defined"
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   253
#endif
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   254
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   255
/* The color-only-rendering pixel shader:
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   256
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   257
   --- D3D11_PixelShader_Colors.hlsl ---
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   258
   struct PixelShaderInput
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   259
   {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   260
       float4 pos : SV_POSITION;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   261
       float2 tex : TEXCOORD0;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   262
       float4 color : COLOR0;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   263
   };
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   264
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   265
   float4 main(PixelShaderInput input) : SV_TARGET
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   266
   {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   267
       return input.color;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   268
   }
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   269
*/
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   270
#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   271
static const DWORD D3D11_PixelShader_Colors[] = {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   272
    0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   273
    0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   274
    0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   275
    0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   276
    0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   277
    0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   278
    0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   279
    0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   280
    0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   281
    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   282
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   283
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   284
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   285
    0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   286
    0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   287
    0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   288
    0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   289
    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   290
    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   291
    0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   292
    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   293
    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   294
    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   295
    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   296
};
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   297
#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   298
static const DWORD D3D11_PixelShader_Colors[] = {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   299
    0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   300
    0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   301
    0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   302
    0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   303
    0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   304
    0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   305
    0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   306
    0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   307
    0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   308
    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   309
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   310
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   311
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   312
    0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   313
    0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   314
    0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   315
    0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   316
    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   317
    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   318
    0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   319
    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   320
    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   321
    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   322
    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   323
};
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   324
#else
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   325
#error "An appropriate 'colors' pixel shader is not defined."
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   326
#endif
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   327
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   328
/* The sole vertex shader:
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   329
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   330
   --- D3D11_VertexShader.hlsl ---
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   331
   #pragma pack_matrix( row_major )
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   332
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   333
   cbuffer VertexShaderConstants : register(b0)
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   334
   {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   335
       matrix model;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   336
       matrix view;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   337
       matrix projection;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   338
   };
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   339
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   340
   struct VertexShaderInput
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   341
   {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   342
       float3 pos : POSITION;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   343
       float2 tex : TEXCOORD0;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   344
       float4 color : COLOR0;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   345
   };
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   346
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   347
   struct VertexShaderOutput
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   348
   {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   349
       float4 pos : SV_POSITION;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   350
       float2 tex : TEXCOORD0;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   351
       float4 color : COLOR0;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   352
   };
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   353
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   354
   VertexShaderOutput main(VertexShaderInput input)
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   355
   {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   356
       VertexShaderOutput output;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   357
       float4 pos = float4(input.pos, 1.0f);
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   358
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   359
       // Transform the vertex position into projected space.
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   360
       pos = mul(pos, model);
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   361
       pos = mul(pos, view);
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   362
       pos = mul(pos, projection);
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   363
       output.pos = pos;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   364
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   365
       // Pass through texture coordinates and color values without transformation
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   366
       output.tex = input.tex;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   367
       output.color = input.color;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   368
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   369
       return output;
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   370
   }
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   371
*/
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   372
#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   373
static const DWORD D3D11_VertexShader[] = {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   374
    0x43425844, 0x3f31b022, 0x2ffad8b8, 0xd6c45cbd, 0xa7894c28, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   375
    0x00000690, 0x00000006, 0x00000038, 0x000001b8, 0x00000418, 0x00000494,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   376
    0x000005ac, 0x0000061c, 0x396e6f41, 0x00000178, 0x00000178, 0xfffe0200,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   377
    0x00000144, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   378
    0x00300001, 0x00000000, 0x0001000c, 0x00000000, 0x00000000, 0xfffe0200,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   379
    0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   380
    0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   381
    0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   382
    0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   383
    0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   384
    0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   385
    0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   386
    0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x03000005, 0x800f0001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   387
    0x80550000, 0xa0e4000a, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40009,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   388
    0x80e40001, 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e4000b, 0x80e40001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   389
    0x04000004, 0x800f0000, 0x80ff0000, 0xa0e4000c, 0x80e40001, 0x04000004,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   390
    0xc0030000, 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   391
    0x80e40000, 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   392
    0x90e40002, 0x0000ffff, 0x52444853, 0x00000258, 0x00010040, 0x00000096,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   393
    0x04000059, 0x00208e46, 0x00000000, 0x0000000c, 0x0300005f, 0x00101072,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   394
    0x00000000, 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   395
    0x00000002, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   396
    0x00102032, 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   397
    0x00000002, 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   398
    0x00208e46, 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   399
    0x00101006, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   400
    0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   401
    0x00208e46, 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   402
    0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   403
    0x00000003, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   404
    0x00208e46, 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   405
    0x00100006, 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   406
    0x00000001, 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   407
    0x00208e46, 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   408
    0x001000f2, 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   409
    0x00000007, 0x00100e46, 0x00000001, 0x08000038, 0x001000f2, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   410
    0x00100556, 0x00000000, 0x00208e46, 0x00000000, 0x00000009, 0x0a000032,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   411
    0x001000f2, 0x00000001, 0x00100006, 0x00000000, 0x00208e46, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   412
    0x00000008, 0x00100e46, 0x00000001, 0x0a000032, 0x001000f2, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   413
    0x00100aa6, 0x00000000, 0x00208e46, 0x00000000, 0x0000000a, 0x00100e46,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   414
    0x00000001, 0x0a000032, 0x001020f2, 0x00000000, 0x00100ff6, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   415
    0x00208e46, 0x00000000, 0x0000000b, 0x00100e46, 0x00000001, 0x05000036,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   416
    0x00102032, 0x00000001, 0x00101046, 0x00000001, 0x05000036, 0x001020f2,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   417
    0x00000002, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   418
    0x0000000f, 0x00000002, 0x00000000, 0x00000006, 0x00000004, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   419
    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   420
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   421
    0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   422
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   423
    0x00000110, 0x00000001, 0x00000054, 0x00000001, 0x0000001c, 0xfffe0400,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   424
    0x00000100, 0x000000dc, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   425
    0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x74726556, 0x68537865,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   426
    0x72656461, 0x736e6f43, 0x746e6174, 0xabab0073, 0x0000003c, 0x00000003,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   427
    0x0000006c, 0x000000c0, 0x00000000, 0x00000000, 0x000000b4, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   428
    0x00000040, 0x00000002, 0x000000bc, 0x00000000, 0x000000cc, 0x00000040,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   429
    0x00000040, 0x00000002, 0x000000bc, 0x00000000, 0x000000d1, 0x00000080,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   430
    0x00000040, 0x00000002, 0x000000bc, 0x00000000, 0x65646f6d, 0xabab006c,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   431
    0x00030002, 0x00040004, 0x00000000, 0x00000000, 0x77656976, 0x6f727000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   432
    0x7463656a, 0x006e6f69, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   433
    0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e30332e,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   434
    0x30303239, 0x3336312e, 0xab003438, 0x4e475349, 0x00000068, 0x00000003,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   435
    0x00000008, 0x00000050, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   436
    0x00000707, 0x00000059, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   437
    0x00000303, 0x00000062, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   438
    0x00000f0f, 0x49534f50, 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   439
    0x00524f4c, 0x4e47534f, 0x0000006c, 0x00000003, 0x00000008, 0x00000050,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   440
    0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   441
    0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000c03, 0x00000065,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   442
    0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x0000000f, 0x505f5653,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   443
    0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   444
};
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   445
#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   446
static const DWORD D3D11_VertexShader[] = {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   447
    0x43425844, 0xacfd840a, 0x6a6ae1e1, 0xc3649c43, 0x8bfc0816, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   448
    0x00000690, 0x00000006, 0x00000038, 0x000001b8, 0x00000418, 0x00000494,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   449
    0x000005ac, 0x0000061c, 0x396e6f41, 0x00000178, 0x00000178, 0xfffe0200,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   450
    0x00000144, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   451
    0x00300001, 0x00000000, 0x0001000c, 0x00000000, 0x00000000, 0xfffe0201,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   452
    0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   453
    0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   454
    0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   455
    0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   456
    0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   457
    0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   458
    0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   459
    0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x03000005, 0x800f0001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   460
    0x80550000, 0xa0e4000a, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40009,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   461
    0x80e40001, 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e4000b, 0x80e40001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   462
    0x04000004, 0x800f0000, 0x80ff0000, 0xa0e4000c, 0x80e40001, 0x04000004,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   463
    0xc0030000, 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   464
    0x80e40000, 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   465
    0x90e40002, 0x0000ffff, 0x52444853, 0x00000258, 0x00010040, 0x00000096,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   466
    0x04000059, 0x00208e46, 0x00000000, 0x0000000c, 0x0300005f, 0x00101072,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   467
    0x00000000, 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   468
    0x00000002, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   469
    0x00102032, 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   470
    0x00000002, 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   471
    0x00208e46, 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   472
    0x00101006, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   473
    0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   474
    0x00208e46, 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   475
    0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   476
    0x00000003, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   477
    0x00208e46, 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   478
    0x00100006, 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   479
    0x00000001, 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   480
    0x00208e46, 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   481
    0x001000f2, 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   482
    0x00000007, 0x00100e46, 0x00000001, 0x08000038, 0x001000f2, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   483
    0x00100556, 0x00000000, 0x00208e46, 0x00000000, 0x00000009, 0x0a000032,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   484
    0x001000f2, 0x00000001, 0x00100006, 0x00000000, 0x00208e46, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   485
    0x00000008, 0x00100e46, 0x00000001, 0x0a000032, 0x001000f2, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   486
    0x00100aa6, 0x00000000, 0x00208e46, 0x00000000, 0x0000000a, 0x00100e46,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   487
    0x00000001, 0x0a000032, 0x001020f2, 0x00000000, 0x00100ff6, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   488
    0x00208e46, 0x00000000, 0x0000000b, 0x00100e46, 0x00000001, 0x05000036,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   489
    0x00102032, 0x00000001, 0x00101046, 0x00000001, 0x05000036, 0x001020f2,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   490
    0x00000002, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   491
    0x0000000f, 0x00000002, 0x00000000, 0x00000006, 0x00000004, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   492
    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   493
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   494
    0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   495
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   496
    0x00000110, 0x00000001, 0x00000054, 0x00000001, 0x0000001c, 0xfffe0400,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   497
    0x00000100, 0x000000dc, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   498
    0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x74726556, 0x68537865,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   499
    0x72656461, 0x736e6f43, 0x746e6174, 0xabab0073, 0x0000003c, 0x00000003,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   500
    0x0000006c, 0x000000c0, 0x00000000, 0x00000000, 0x000000b4, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   501
    0x00000040, 0x00000002, 0x000000bc, 0x00000000, 0x000000cc, 0x00000040,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   502
    0x00000040, 0x00000002, 0x000000bc, 0x00000000, 0x000000d1, 0x00000080,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   503
    0x00000040, 0x00000002, 0x000000bc, 0x00000000, 0x65646f6d, 0xabab006c,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   504
    0x00030002, 0x00040004, 0x00000000, 0x00000000, 0x77656976, 0x6f727000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   505
    0x7463656a, 0x006e6f69, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   506
    0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e30332e,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   507
    0x30303239, 0x3336312e, 0xab003438, 0x4e475349, 0x00000068, 0x00000003,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   508
    0x00000008, 0x00000050, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   509
    0x00000707, 0x00000059, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   510
    0x00000303, 0x00000062, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   511
    0x00000f0f, 0x49534f50, 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   512
    0x00524f4c, 0x4e47534f, 0x0000006c, 0x00000003, 0x00000008, 0x00000050,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   513
    0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   514
    0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000c03, 0x00000065,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   515
    0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x0000000f, 0x505f5653,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   516
    0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   517
};
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   518
#else
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   519
#error "An appropriate vertex shader is not defined."
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   520
#endif
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   521
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   522
/* Direct3D 11.1 renderer implementation */
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   523
static SDL_Renderer *D3D11_CreateRenderer(SDL_Window * window, Uint32 flags);
8415
91977f5b2135 WinRT: added SDL_WINDOWEVENT_RESIZED support, and moved window-resize-handling code from WinRT rendering code to D3D 11.1 code
David Ludwig <dludwig@pobox.com>
parents: 8414
diff changeset
   524
static void D3D11_WindowEvent(SDL_Renderer * renderer,
91977f5b2135 WinRT: added SDL_WINDOWEVENT_RESIZED support, and moved window-resize-handling code from WinRT rendering code to D3D 11.1 code
David Ludwig <dludwig@pobox.com>
parents: 8414
diff changeset
   525
                            const SDL_WindowEvent *event);
8416
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   526
static int D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   527
static int D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
8459
1178e27580c7 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget
David Ludwig <dludwig@pobox.com>
parents: 8458
diff changeset
   528
                             const SDL_Rect * rect, const void *srcPixels,
1178e27580c7 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget
David Ludwig <dludwig@pobox.com>
parents: 8458
diff changeset
   529
                             int srcPitch);
8451
092ea651523a WinRT: added SDL_LockTexture and SDL_UnlockTexture support to the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8450
diff changeset
   530
static int D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
092ea651523a WinRT: added SDL_LockTexture and SDL_UnlockTexture support to the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8450
diff changeset
   531
                             const SDL_Rect * rect, void **pixels, int *pitch);
092ea651523a WinRT: added SDL_LockTexture and SDL_UnlockTexture support to the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8450
diff changeset
   532
static void D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
8459
1178e27580c7 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget
David Ludwig <dludwig@pobox.com>
parents: 8458
diff changeset
   533
static int D3D11_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   534
static int D3D11_UpdateViewport(SDL_Renderer * renderer);
8482
eb0b00e7519e WinRT: added a stub implementation of UpdateClipRect to the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8463
diff changeset
   535
static int D3D11_UpdateClipRect(SDL_Renderer * renderer);
8416
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   536
static int D3D11_RenderClear(SDL_Renderer * renderer);
8450
6f34a798cb54 WinRT: added point drawing support to the Direct3D 11.1 rendering backend
David Ludwig <dludwig@pobox.com>
parents: 8449
diff changeset
   537
static int D3D11_RenderDrawPoints(SDL_Renderer * renderer,
6f34a798cb54 WinRT: added point drawing support to the Direct3D 11.1 rendering backend
David Ludwig <dludwig@pobox.com>
parents: 8449
diff changeset
   538
                                  const SDL_FPoint * points, int count);
8449
2e4e5085e5b1 WinRT: added line drawing support to the Direct3D 11.1 rendering backend
David Ludwig <dludwig@pobox.com>
parents: 8448
diff changeset
   539
static int D3D11_RenderDrawLines(SDL_Renderer * renderer,
2e4e5085e5b1 WinRT: added line drawing support to the Direct3D 11.1 rendering backend
David Ludwig <dludwig@pobox.com>
parents: 8448
diff changeset
   540
                                 const SDL_FPoint * points, int count);
8429
a8b45a923fbd WinRT: implemented SDL_RenderFillRect and SDL_RenderFillRects for the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8427
diff changeset
   541
static int D3D11_RenderFillRects(SDL_Renderer * renderer,
a8b45a923fbd WinRT: implemented SDL_RenderFillRect and SDL_RenderFillRects for the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8427
diff changeset
   542
                                 const SDL_FRect * rects, int count);
8416
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   543
static int D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   544
                            const SDL_Rect * srcrect, const SDL_FRect * dstrect);
8455
14d4b48cc07f WinRT: implemented SDL_RenderCopyEx, w/ SDL_RendererFlip support, in D3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8454
diff changeset
   545
static int D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
14d4b48cc07f WinRT: implemented SDL_RenderCopyEx, w/ SDL_RendererFlip support, in D3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8454
diff changeset
   546
                              const SDL_Rect * srcrect, const SDL_FRect * dstrect,
14d4b48cc07f WinRT: implemented SDL_RenderCopyEx, w/ SDL_RendererFlip support, in D3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8454
diff changeset
   547
                              const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip);
8454
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   548
static int D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   549
                                  Uint32 format, void * pixels, int pitch);
8401
29ecd2eca4af WinRT: moved a bit more Direct3D 11.1 code into the SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8400
diff changeset
   550
static void D3D11_RenderPresent(SDL_Renderer * renderer);
8416
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   551
static void D3D11_DestroyTexture(SDL_Renderer * renderer,
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   552
                                 SDL_Texture * texture);
8413
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   553
static void D3D11_DestroyRenderer(SDL_Renderer * renderer);
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   554
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   555
/* Direct3D 11.1 Internal Functions */
8412
59f1191a5cca WinRT: more work on moving rendering code from SDL_winrtrenderer.* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8410
diff changeset
   556
HRESULT D3D11_CreateDeviceResources(SDL_Renderer * renderer);
8413
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   557
HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer);
8414
25a7605097a2 WinRT: more code-moving from WinRT code to Direct3D 11.1 code
David Ludwig <dludwig@pobox.com>
parents: 8413
diff changeset
   558
HRESULT D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer);
25a7605097a2 WinRT: more code-moving from WinRT code to Direct3D 11.1 code
David Ludwig <dludwig@pobox.com>
parents: 8413
diff changeset
   559
HRESULT D3D11_HandleDeviceLost(SDL_Renderer * renderer);
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   560
8442
7046465c646c WinRT: added support for alpha-blended texture rendering
David Ludwig <dludwig@pobox.com>
parents: 8434
diff changeset
   561
extern "C" SDL_RenderDriver D3D11_RenderDriver = {
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   562
    D3D11_CreateRenderer,
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   563
    {
8442
7046465c646c WinRT: added support for alpha-blended texture rendering
David Ludwig <dludwig@pobox.com>
parents: 8434
diff changeset
   564
        "direct3d 11.1",
8459
1178e27580c7 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget
David Ludwig <dludwig@pobox.com>
parents: 8458
diff changeset
   565
        (
1178e27580c7 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget
David Ludwig <dludwig@pobox.com>
parents: 8458
diff changeset
   566
            SDL_RENDERER_ACCELERATED |
1178e27580c7 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget
David Ludwig <dludwig@pobox.com>
parents: 8458
diff changeset
   567
            SDL_RENDERER_PRESENTVSYNC |
1178e27580c7 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget
David Ludwig <dludwig@pobox.com>
parents: 8458
diff changeset
   568
            SDL_RENDERER_TARGETTEXTURE
1178e27580c7 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget
David Ludwig <dludwig@pobox.com>
parents: 8458
diff changeset
   569
        ),                          // flags.  see SDL_RendererFlags
8442
7046465c646c WinRT: added support for alpha-blended texture rendering
David Ludwig <dludwig@pobox.com>
parents: 8434
diff changeset
   570
        2,                          // num_texture_formats
7046465c646c WinRT: added support for alpha-blended texture rendering
David Ludwig <dludwig@pobox.com>
parents: 8434
diff changeset
   571
        {                           // texture_formats
7046465c646c WinRT: added support for alpha-blended texture rendering
David Ludwig <dludwig@pobox.com>
parents: 8434
diff changeset
   572
            SDL_PIXELFORMAT_RGB888,
7046465c646c WinRT: added support for alpha-blended texture rendering
David Ludwig <dludwig@pobox.com>
parents: 8434
diff changeset
   573
            SDL_PIXELFORMAT_ARGB8888
7046465c646c WinRT: added support for alpha-blended texture rendering
David Ludwig <dludwig@pobox.com>
parents: 8434
diff changeset
   574
        },
8446
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   575
        0,                          // max_texture_width: will be filled in later
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   576
        0                           // max_texture_height: will be filled in later
8442
7046465c646c WinRT: added support for alpha-blended texture rendering
David Ludwig <dludwig@pobox.com>
parents: 8434
diff changeset
   577
    }
7046465c646c WinRT: added support for alpha-blended texture rendering
David Ludwig <dludwig@pobox.com>
parents: 8434
diff changeset
   578
};
7046465c646c WinRT: added support for alpha-blended texture rendering
David Ludwig <dludwig@pobox.com>
parents: 8434
diff changeset
   579
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   580
8454
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   581
static Uint32
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   582
DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) {
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   583
    switch (dxgiFormat) {
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   584
        case DXGI_FORMAT_B8G8R8A8_UNORM:
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   585
            return SDL_PIXELFORMAT_ARGB8888;
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   586
        case DXGI_FORMAT_B8G8R8X8_UNORM:
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   587
            return SDL_PIXELFORMAT_RGB888;
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   588
        default:
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   589
            return SDL_PIXELFORMAT_UNKNOWN;
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   590
    }
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   591
}
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   592
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   593
static DXGI_FORMAT
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   594
SDLPixelFormatToDXGIFormat(Uint32 sdlFormat)
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   595
{
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   596
    switch (sdlFormat) {
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   597
        case SDL_PIXELFORMAT_ARGB8888:
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   598
            return DXGI_FORMAT_B8G8R8A8_UNORM;
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   599
        case SDL_PIXELFORMAT_RGB888:
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   600
            return DXGI_FORMAT_B8G8R8X8_UNORM;
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   601
        default:
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   602
            return DXGI_FORMAT_UNKNOWN;
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   603
    }
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   604
}
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   605
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   606
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   607
//typedef struct
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   608
//{
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   609
//    float x, y, z;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   610
//    DWORD color;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   611
//    float u, v;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   612
//} Vertex;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   613
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   614
SDL_Renderer *
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   615
D3D11_CreateRenderer(SDL_Window * window, Uint32 flags)
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   616
{
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   617
    SDL_Renderer *renderer;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   618
    D3D11_RenderData *data;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   619
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   620
    renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   621
    if (!renderer) {
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   622
        SDL_OutOfMemory();
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   623
        return NULL;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   624
    }
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   625
    SDL_zerop(renderer);
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   626
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   627
    data = new D3D11_RenderData;    // Use the C++ 'new' operator to make sure the struct's members initialize using C++ rules
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   628
    if (!data) {
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   629
        SDL_OutOfMemory();
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   630
        return NULL;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   631
    }
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   632
    data->featureLevel = (D3D_FEATURE_LEVEL) 0;
8412
59f1191a5cca WinRT: more work on moving rendering code from SDL_winrtrenderer.* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8410
diff changeset
   633
    data->windowSizeInDIPs = XMFLOAT2(0, 0);
59f1191a5cca WinRT: more work on moving rendering code from SDL_winrtrenderer.* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8410
diff changeset
   634
    data->renderTargetSize = XMFLOAT2(0, 0);
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   635
8415
91977f5b2135 WinRT: added SDL_WINDOWEVENT_RESIZED support, and moved window-resize-handling code from WinRT rendering code to D3D 11.1 code
David Ludwig <dludwig@pobox.com>
parents: 8414
diff changeset
   636
    renderer->WindowEvent = D3D11_WindowEvent;
8416
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   637
    renderer->CreateTexture = D3D11_CreateTexture;
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   638
    renderer->UpdateTexture = D3D11_UpdateTexture;
8451
092ea651523a WinRT: added SDL_LockTexture and SDL_UnlockTexture support to the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8450
diff changeset
   639
    renderer->LockTexture = D3D11_LockTexture;
092ea651523a WinRT: added SDL_LockTexture and SDL_UnlockTexture support to the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8450
diff changeset
   640
    renderer->UnlockTexture = D3D11_UnlockTexture;
8459
1178e27580c7 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget
David Ludwig <dludwig@pobox.com>
parents: 8458
diff changeset
   641
    renderer->SetRenderTarget = D3D11_SetRenderTarget;
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   642
    renderer->UpdateViewport = D3D11_UpdateViewport;
8482
eb0b00e7519e WinRT: added a stub implementation of UpdateClipRect to the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8463
diff changeset
   643
    renderer->UpdateClipRect = D3D11_UpdateClipRect;
8416
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   644
    renderer->RenderClear = D3D11_RenderClear;
8450
6f34a798cb54 WinRT: added point drawing support to the Direct3D 11.1 rendering backend
David Ludwig <dludwig@pobox.com>
parents: 8449
diff changeset
   645
    renderer->RenderDrawPoints = D3D11_RenderDrawPoints;
8449
2e4e5085e5b1 WinRT: added line drawing support to the Direct3D 11.1 rendering backend
David Ludwig <dludwig@pobox.com>
parents: 8448
diff changeset
   646
    renderer->RenderDrawLines = D3D11_RenderDrawLines;
8429
a8b45a923fbd WinRT: implemented SDL_RenderFillRect and SDL_RenderFillRects for the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8427
diff changeset
   647
    renderer->RenderFillRects = D3D11_RenderFillRects;
8416
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   648
    renderer->RenderCopy = D3D11_RenderCopy;
8455
14d4b48cc07f WinRT: implemented SDL_RenderCopyEx, w/ SDL_RendererFlip support, in D3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8454
diff changeset
   649
    renderer->RenderCopyEx = D3D11_RenderCopyEx;
8454
ac6a37f54dc2 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1
David Ludwig <dludwig@pobox.com>
parents: 8452
diff changeset
   650
    renderer->RenderReadPixels = D3D11_RenderReadPixels;
8401
29ecd2eca4af WinRT: moved a bit more Direct3D 11.1 code into the SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8400
diff changeset
   651
    renderer->RenderPresent = D3D11_RenderPresent;
8416
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   652
    renderer->DestroyTexture = D3D11_DestroyTexture;
8413
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   653
    renderer->DestroyRenderer = D3D11_DestroyRenderer;
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   654
    renderer->info = D3D11_RenderDriver.info;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   655
    renderer->driverdata = data;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   656
8413
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   657
    // HACK: make sure the SDL_Renderer references the SDL_Window data now, in
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   658
    // order to give init functions access to the underlying window handle:
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   659
    renderer->window = window;
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   660
8413
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   661
    /* Initialize Direct3D resources */
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   662
    if (FAILED(D3D11_CreateDeviceResources(renderer))) {
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   663
        D3D11_DestroyRenderer(renderer);
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   664
        return NULL;
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   665
    }
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   666
    if (FAILED(D3D11_CreateWindowSizeDependentResources(renderer))) {
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   667
        D3D11_DestroyRenderer(renderer);
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   668
        return NULL;
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   669
    }
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   670
8416
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   671
    // TODO, WinRT: fill in renderer->info.texture_formats where appropriate
17040ce2693d WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents: 8415
diff changeset
   672
8400
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   673
    return renderer;
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   674
}
1315402d9028 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   675
8413
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   676
static void
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   677
D3D11_DestroyRenderer(SDL_Renderer * renderer)
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   678
{
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   679
    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   680
    if (data) {
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   681
        delete data;
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   682
        data = NULL;
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   683
    }
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   684
}
4ae81c5dc55e WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver
David Ludwig <dludwig@pobox.com>
parents: 8412
diff changeset
   685
8431
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   686
static HRESULT
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   687
D3D11_CreateBlendMode(SDL_Renderer * renderer,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   688
                      BOOL enableBlending,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   689
                      D3D11_BLEND srcBlend,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   690
                      D3D11_BLEND destBlend,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   691
                      ID3D11BlendState ** blendStateOutput)
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   692
{
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   693
    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   694
    HRESULT result = S_OK;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   695
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   696
    D3D11_BLEND_DESC blendDesc;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   697
    memset(&blendDesc, 0, sizeof(blendDesc));
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   698
    blendDesc.AlphaToCoverageEnable = FALSE;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   699
    blendDesc.IndependentBlendEnable = FALSE;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   700
    blendDesc.RenderTarget[0].BlendEnable = enableBlending;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   701
    blendDesc.RenderTarget[0].SrcBlend = srcBlend;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   702
    blendDesc.RenderTarget[0].DestBlend = destBlend;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   703
    blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   704
    blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   705
    blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   706
    blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   707
    blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   708
    result = data->d3dDevice->CreateBlendState(&blendDesc, blendStateOutput);
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   709
    if (FAILED(result)) {
8553
199f6c870823 WinRT: made d3d11-spawned error messages include the function name of failed calls
David Ludwig <dludwig@pobox.com>
parents: 8550
diff changeset
   710
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBlendState", result);
8431
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   711
        return result;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   712
    }
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   713
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   714
    return S_OK;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   715
}
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   716
8414
25a7605097a2 WinRT: more code-moving from WinRT code to Direct3D 11.1 code
David Ludwig <dludwig@pobox.com>
parents: 8413
diff changeset
   717
// Create resources that depend on the device.
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   718
HRESULT
8412
59f1191a5cca WinRT: more work on moving rendering code from SDL_winrtrenderer.* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8410
diff changeset
   719
D3D11_CreateDeviceResources(SDL_Renderer * renderer)
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   720
{
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   721
    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   722
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   723
    // This flag adds support for surfaces with a different color channel ordering
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   724
    // than the API default. It is required for compatibility with Direct2D.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   725
    UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   726
8533
89cf2a2635d1 WinRT: made the Direct3D 11.x 'Debug Layer' be enable-able in any app via a hint
David Ludwig <dludwig@pobox.com>
parents: 8526
diff changeset
   727
    // Make sure Direct3D's debugging feature gets used, if the app requests it.
8563
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   728
    //const char *hint = SDL_GetHint(SDL_HINT_RENDER_DIRECT3D11_DEBUG);
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   729
    //if (hint) {
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   730
    //    if (*hint == '1') {
8533
89cf2a2635d1 WinRT: made the Direct3D 11.x 'Debug Layer' be enable-able in any app via a hint
David Ludwig <dludwig@pobox.com>
parents: 8526
diff changeset
   731
            creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
8563
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   732
    //    }
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   733
    //}
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   734
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   735
    // This array defines the set of DirectX hardware feature levels this app will support.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   736
    // Note the ordering should be preserved.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   737
    // Don't forget to declare your application's minimum required feature level in its
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   738
    // description.  All applications are assumed to support 9.1 unless otherwise stated.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   739
    D3D_FEATURE_LEVEL featureLevels[] = 
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   740
    {
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   741
        D3D_FEATURE_LEVEL_11_1,
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   742
        D3D_FEATURE_LEVEL_11_0,
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   743
        D3D_FEATURE_LEVEL_10_1,
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   744
        D3D_FEATURE_LEVEL_10_0,
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   745
        D3D_FEATURE_LEVEL_9_3,
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   746
        D3D_FEATURE_LEVEL_9_2,
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   747
        D3D_FEATURE_LEVEL_9_1
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   748
    };
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   749
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   750
    // Create the Direct3D 11 API device object and a corresponding context.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   751
    ComPtr<ID3D11Device> device;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   752
    ComPtr<ID3D11DeviceContext> context;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   753
    HRESULT result = S_OK;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   754
    result = D3D11CreateDevice(
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   755
        nullptr, // Specify nullptr to use the default adapter.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   756
        D3D_DRIVER_TYPE_HARDWARE,
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   757
        nullptr,
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   758
        creationFlags, // Set set debug and Direct2D compatibility flags.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   759
        featureLevels, // List of feature levels this app can support.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   760
        ARRAYSIZE(featureLevels),
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   761
        D3D11_SDK_VERSION, // Always set this to D3D11_SDK_VERSION for Windows Store apps.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   762
        &device, // Returns the Direct3D device created.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   763
        &data->featureLevel, // Returns feature level of device created.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   764
        &context // Returns the device immediate context.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   765
        );
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   766
    if (FAILED(result)) {
8553
199f6c870823 WinRT: made d3d11-spawned error messages include the function name of failed calls
David Ludwig <dludwig@pobox.com>
parents: 8550
diff changeset
   767
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", D3D11CreateDevice", result);
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   768
        return result;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   769
    }
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   770
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   771
    // Get the Direct3D 11.1 API device and context interfaces.
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   772
    result = device.As(&(data->d3dDevice));
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   773
    if (FAILED(result)) {
8553
199f6c870823 WinRT: made d3d11-spawned error messages include the function name of failed calls
David Ludwig <dludwig@pobox.com>
parents: 8550
diff changeset
   774
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to ID3D11Device1", result);
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   775
        return result;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   776
    }
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   777
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   778
    result = context.As(&data->d3dContext);
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   779
    if (FAILED(result)) {
8553
199f6c870823 WinRT: made d3d11-spawned error messages include the function name of failed calls
David Ludwig <dludwig@pobox.com>
parents: 8550
diff changeset
   780
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext to ID3D11DeviceContext1", result);
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   781
        return result;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   782
    }
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   783
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   784
    //
8446
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   785
    // Make note of the maximum texture size
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   786
    // Max texture sizes are documented on MSDN, at:
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   787
    // http://msdn.microsoft.com/en-us/library/windows/apps/ff476876.aspx
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   788
    //
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   789
    switch (data->d3dDevice->GetFeatureLevel()) {
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   790
        case D3D_FEATURE_LEVEL_11_1:
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   791
        case D3D_FEATURE_LEVEL_11_0:
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   792
            renderer->info.max_texture_width = renderer->info.max_texture_height = 16384;
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   793
            break;
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   794
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   795
        case D3D_FEATURE_LEVEL_10_1:
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   796
        case D3D_FEATURE_LEVEL_10_0:
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   797
            renderer->info.max_texture_width = renderer->info.max_texture_height = 8192;
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   798
            break;
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   799
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   800
        case D3D_FEATURE_LEVEL_9_3:
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   801
            renderer->info.max_texture_width = renderer->info.max_texture_height = 4096;
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   802
            break;
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   803
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   804
        case D3D_FEATURE_LEVEL_9_2:
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   805
        case D3D_FEATURE_LEVEL_9_1:
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   806
            renderer->info.max_texture_width = renderer->info.max_texture_height = 2048;
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   807
            break;
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   808
    }
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   809
290de0966136 WinRT: allowed for querying of max texture size (via Direct3D 11.1)
David Ludwig <dludwig@pobox.com>
parents: 8445
diff changeset
   810
    //
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   811
    // Load in SDL's one and only vertex shader:
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   812
    //
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   813
    result = data->d3dDevice->CreateVertexShader(
8563
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   814
        D3D11_VertexShader,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   815
        sizeof(D3D11_VertexShader),
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   816
        nullptr,
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   817
        &data->vertexShader
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   818
        );
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   819
    if (FAILED(result)) {
8553
199f6c870823 WinRT: made d3d11-spawned error messages include the function name of failed calls
David Ludwig <dludwig@pobox.com>
parents: 8550
diff changeset
   820
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateVertexShader", result);
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   821
        return result;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   822
    }
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   823
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   824
    //
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   825
    // Create an input layout for SDL's vertex shader:
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   826
    //
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   827
    const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = 
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   828
    {
8429
a8b45a923fbd WinRT: implemented SDL_RenderFillRect and SDL_RenderFillRects for the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8427
diff changeset
   829
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   830
        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
8429
a8b45a923fbd WinRT: implemented SDL_RenderFillRect and SDL_RenderFillRects for the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8427
diff changeset
   831
        { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 },
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   832
    };
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   833
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   834
    result = data->d3dDevice->CreateInputLayout(
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   835
        vertexDesc,
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   836
        ARRAYSIZE(vertexDesc),
8563
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   837
        D3D11_VertexShader,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   838
        sizeof(D3D11_VertexShader),
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   839
        &data->inputLayout
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   840
        );
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   841
    if (FAILED(result)) {
8553
199f6c870823 WinRT: made d3d11-spawned error messages include the function name of failed calls
David Ludwig <dludwig@pobox.com>
parents: 8550
diff changeset
   842
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateInputLayout", result);
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   843
        return result;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   844
    }
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   845
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   846
    //
8429
a8b45a923fbd WinRT: implemented SDL_RenderFillRect and SDL_RenderFillRects for the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8427
diff changeset
   847
    // Load in SDL's pixel shaders
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   848
    //
8563
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   849
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   850
    result = data->d3dDevice->CreatePixelShader(
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   851
        D3D11_PixelShader_Textures,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   852
        sizeof(D3D11_PixelShader_Textures),
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   853
        nullptr,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   854
        &data->texturePixelShader
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   855
        );
8429
a8b45a923fbd WinRT: implemented SDL_RenderFillRect and SDL_RenderFillRects for the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8427
diff changeset
   856
    if (FAILED(result)) {
8563
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   857
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['textures' shader]", result);
8429
a8b45a923fbd WinRT: implemented SDL_RenderFillRect and SDL_RenderFillRects for the D3D 11.1 renderer
David Ludwig <dludwig@pobox.com>
parents: 8427
diff changeset
   858
        return result;
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   859
    }
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   860
8563
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   861
    result = data->d3dDevice->CreatePixelShader(
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   862
        D3D11_PixelShader_Colors,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   863
        sizeof(D3D11_PixelShader_Colors),
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   864
        nullptr,
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   865
        &data->colorPixelShader
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   866
        );
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   867
    if (FAILED(result)) {
8563
c0e68f3b6bbb WinRT: compiled the d3d11 renderer's shaders into SDL itself
David Ludwig <dludwig@pobox.com>
parents: 8561
diff changeset
   868
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['color' shader]", result);
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   869
        return result;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   870
    }
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   871
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   872
    //
8418
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   873
    // Setup space to hold vertex shader constants:
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   874
    //
8560
5e14c111f2f9 WinRT: renamed d3d11-internal struct, SDL_VertexShaderConstants, to just VertexShaderConstants
David Ludwig <dludwig@pobox.com>
parents: 8559
diff changeset
   875
    CD3D11_BUFFER_DESC constantBufferDesc(sizeof(VertexShaderConstants), D3D11_BIND_CONSTANT_BUFFER);
8418
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   876
    result = data->d3dDevice->CreateBuffer(
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   877
		&constantBufferDesc,
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   878
		nullptr,
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   879
        &data->vertexShaderConstants
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   880
		);
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   881
    if (FAILED(result)) {
8553
199f6c870823 WinRT: made d3d11-spawned error messages include the function name of failed calls
David Ludwig <dludwig@pobox.com>
parents: 8550
diff changeset
   882
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBuffer [vertex shader constants]", result);
8418
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   883
        return result;
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   884
    }
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   885
5230bba62cf2 WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing
David Ludwig <dludwig@pobox.com>
parents: 8416
diff changeset
   886
    //
8425
99448fee696f WinRT: made d3d 11.1 vertex buffers get created, and updated, when a render op is invoked
David Ludwig <dludwig@pobox.com>
parents: 8423
diff changeset
   887
    // Make sure that the vertex buffer, if already created, gets freed.
99448fee696f WinRT: made d3d 11.1 vertex buffers get created, and updated, when a render op is invoked
David Ludwig <dludwig@pobox.com>
parents: 8423
diff changeset
   888
    // It will be recreated later.
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   889
    //
8425
99448fee696f WinRT: made d3d 11.1 vertex buffers get created, and updated, when a render op is invoked
David Ludwig <dludwig@pobox.com>
parents: 8423
diff changeset
   890
    data->vertexBuffer = nullptr;
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   891
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   892
    //
8540
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   893
    // Create samplers to use when drawing textures:
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   894
    //
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   895
    D3D11_SAMPLER_DESC samplerDesc;
8540
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   896
    samplerDesc.Filter = SDL_D3D11_NEAREST_PIXEL_FILTER;
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   897
    samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   898
    samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   899
    samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   900
    samplerDesc.MipLODBias = 0.0f;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   901
    samplerDesc.MaxAnisotropy = 1;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   902
    samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   903
    samplerDesc.BorderColor[0] = 0.0f;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   904
    samplerDesc.BorderColor[1] = 0.0f;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   905
    samplerDesc.BorderColor[2] = 0.0f;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   906
    samplerDesc.BorderColor[3] = 0.0f;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   907
    samplerDesc.MinLOD = 0.0f;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   908
    samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   909
    result = data->d3dDevice->CreateSamplerState(
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   910
        &samplerDesc,
8540
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   911
        &data->nearestPixelSampler
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   912
        );
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   913
    if (FAILED(result)) {
8553
199f6c870823 WinRT: made d3d11-spawned error messages include the function name of failed calls
David Ludwig <dludwig@pobox.com>
parents: 8550
diff changeset
   914
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateSamplerState [nearest-pixel filter]", result);
8540
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   915
        return result;
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   916
    }
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   917
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   918
    samplerDesc.Filter = SDL_D3D11_LINEAR_FILTER;
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   919
    result = data->d3dDevice->CreateSamplerState(
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   920
        &samplerDesc,
724af2cd53b8 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY
David Ludwig <dludwig@pobox.com>
parents: 8533
diff changeset
   921
        &data->linearSampler
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   922
        );
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   923
    if (FAILED(result)) {
8553
199f6c870823 WinRT: made d3d11-spawned error messages include the function name of failed calls
David Ludwig <dludwig@pobox.com>
parents: 8550
diff changeset
   924
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateSamplerState [linear filter]", result);
8410
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   925
        return result;
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   926
    }
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   927
ba725b3a0c87 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11*
David Ludwig <dludwig@pobox.com>
parents: 8401
diff changeset
   928
    //
8426
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   929
    // Setup the Direct3D rasterizer
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   930
    //
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   931
    D3D11_RASTERIZER_DESC rasterDesc;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   932
    memset(&rasterDesc, 0, sizeof(rasterDesc));
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   933
	rasterDesc.AntialiasedLineEnable = false;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   934
	rasterDesc.CullMode = D3D11_CULL_NONE;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   935
	rasterDesc.DepthBias = 0;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   936
	rasterDesc.DepthBiasClamp = 0.0f;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   937
	rasterDesc.DepthClipEnable = true;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   938
	rasterDesc.FillMode = D3D11_FILL_SOLID;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   939
	rasterDesc.FrontCounterClockwise = false;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   940
	rasterDesc.MultisampleEnable = false;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   941
	rasterDesc.ScissorEnable = false;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   942
	rasterDesc.SlopeScaledDepthBias = 0.0f;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   943
	result = data->d3dDevice->CreateRasterizerState(&rasterDesc, &data->mainRasterizer);
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   944
	if (FAILED(result)) {
8553
199f6c870823 WinRT: made d3d11-spawned error messages include the function name of failed calls
David Ludwig <dludwig@pobox.com>
parents: 8550
diff changeset
   945
        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState", result);
8426
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   946
        return result;
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   947
    }
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   948
9775bb101357 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen
David Ludwig <dludwig@pobox.com>
parents: 8425
diff changeset
   949
    //
8431
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   950
    // Create blending states:
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   951
    //
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   952
    result = D3D11_CreateBlendMode(
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   953
        renderer,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   954
        TRUE,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   955
        D3D11_BLEND_SRC_ALPHA,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   956
        D3D11_BLEND_INV_SRC_ALPHA,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   957
        &data->blendModeBlend);
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   958
    if (FAILED(result)) {
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   959
        // D3D11_CreateBlendMode will set the SDL error, if it fails
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   960
        return result;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   961
    }
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   962
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   963
    result = D3D11_CreateBlendMode(
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   964
        renderer,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   965
        TRUE,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   966
        D3D11_BLEND_SRC_ALPHA,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   967
        D3D11_BLEND_ONE,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   968
        &data->blendModeAdd);
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   969
    if (FAILED(result)) {
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   970
        // D3D11_CreateBlendMode will set the SDL error, if it fails
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   971
        return result;
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   972
    }
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   973
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   974
    result = D3D11_CreateBlendMode(
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   975
        renderer,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   976
        TRUE,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   977
        D3D11_BLEND_ZERO,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   978
        D3D11_BLEND_SRC_COLOR,
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   979
        &data->blendModeMod);
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   980
    if (FAILED(result)) {
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig <dludwig@pobox.com>
parents: 8430
diff changeset
   981
        // D3D11_CreateBlendMode will set the SDL error, if it fails
2078dc4f4378 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix
David Ludwig