src/render/direct3d11/SDL_render_d3d11.c
changeset 8596 88fee9ded656
parent 8595 c6fc94639f38
child 8597 1479abb49773
     1.1 --- a/src/render/direct3d11/SDL_render_d3d11.c	Mon Mar 10 05:44:34 2014 -0700
     1.2 +++ b/src/render/direct3d11/SDL_render_d3d11.c	Mon Mar 10 12:49:15 2014 -0700
     1.3 @@ -44,7 +44,7 @@
     1.4  #include <d3d11_1.h>
     1.5  
     1.6  
     1.7 -#define SAFE_RELEASE(X) if ( (X) ) { IUnknown_Release( SDL_static_cast(IUnknown*, X ) ); X = NULL; }
     1.8 +#define SAFE_RELEASE(X) if ((X)) { IUnknown_Release(SDL_static_cast(IUnknown*, X)); X = NULL; }
     1.9  
    1.10  typedef struct
    1.11  {
    1.12 @@ -120,7 +120,10 @@
    1.13  /* Private renderer data */
    1.14  typedef struct
    1.15  {
    1.16 +    void *hDXGIMod;
    1.17      void *hD3D11Mod;
    1.18 +    IDXGIFactory2 *dxgiFactory;
    1.19 +    IDXGIAdapter *dxgiAdapter;
    1.20      ID3D11Device1 *d3dDevice;
    1.21      ID3D11DeviceContext1 *d3dContext;
    1.22      IDXGISwapChain1 *swapChain;
    1.23 @@ -383,159 +386,159 @@
    1.24          float4 color : COLOR0;
    1.25      };
    1.26  
    1.27 -    float4 main(PixelShaderInput input) : SV_TARGET
    1.28 -    {
    1.29 -        const float3 offset = {-0.0625, -0.5, -0.5};
    1.30 -        const float3 Rcoeff = {1.164,  0.000,  1.596};
    1.31 -        const float3 Gcoeff = {1.164, -0.391, -0.813};
    1.32 -        const float3 Bcoeff = {1.164,  2.018,  0.000};
    1.33 -
    1.34 -        float4 Output;
    1.35 -
    1.36 -        float3 yuv;
    1.37 -        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
    1.38 -        yuv.y = theTextureU.Sample(theSampler, input.tex).r;
    1.39 -        yuv.z = theTextureV.Sample(theSampler, input.tex).r;
    1.40 -
    1.41 -        yuv += offset;
    1.42 -        Output.r = dot(yuv, Rcoeff);
    1.43 -        Output.g = dot(yuv, Gcoeff);
    1.44 -        Output.b = dot(yuv, Bcoeff);
    1.45 -        Output.a = 1.0f;
    1.46 -
    1.47 -        return Output * input.color;
    1.48 -    }
    1.49 +    float4 main(PixelShaderInput input) : SV_TARGET
    1.50 +    {
    1.51 +        const float3 offset = {-0.0625, -0.5, -0.5};
    1.52 +        const float3 Rcoeff = {1.164,  0.000,  1.596};
    1.53 +        const float3 Gcoeff = {1.164, -0.391, -0.813};
    1.54 +        const float3 Bcoeff = {1.164,  2.018,  0.000};
    1.55 +
    1.56 +        float4 Output;
    1.57 +
    1.58 +        float3 yuv;
    1.59 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
    1.60 +        yuv.y = theTextureU.Sample(theSampler, input.tex).r;
    1.61 +        yuv.z = theTextureV.Sample(theSampler, input.tex).r;
    1.62 +
    1.63 +        yuv += offset;
    1.64 +        Output.r = dot(yuv, Rcoeff);
    1.65 +        Output.g = dot(yuv, Gcoeff);
    1.66 +        Output.b = dot(yuv, Bcoeff);
    1.67 +        Output.a = 1.0f;
    1.68 +
    1.69 +        return Output * input.color;
    1.70 +    }
    1.71  
    1.72  */
    1.73  #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
    1.74  static const DWORD D3D11_PixelShader_YUV[] = {
    1.75 -    0x43425844, 0x04e69cba, 0x74ce6dd2, 0x7fcf84cb, 0x3003d677, 0x00000001,
    1.76 -    0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438,
    1.77 -    0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200,
    1.78 -    0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
    1.79 -    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051,
    1.80 -    0xa00f0000, 0xbd800000, 0xbf000000, 0xbf000000, 0x3f800000, 0x05000051,
    1.81 -    0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051,
    1.82 -    0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x05000051,
    1.83 -    0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x0200001f,
    1.84 -    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
    1.85 -    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
    1.86 -    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
    1.87 -    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002,
    1.88 -    0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001,
    1.89 -    0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000,
    1.90 -    0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001,
    1.91 -    0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000,
    1.92 -    0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
    1.93 -    0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
    1.94 -    0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853,
    1.95 -    0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000,
    1.96 -    0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000,
    1.97 -    0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555,
    1.98 -    0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
    1.99 -    0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
   1.100 -    0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
   1.101 -    0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
   1.102 -    0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
   1.103 -    0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2,
   1.104 -    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000,
   1.105 -    0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001,
   1.106 -    0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002,
   1.107 -    0xbd800000, 0xbf000000, 0xbf000000, 0x00000000, 0x0a00000f, 0x00100012,
   1.108 -    0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f94fdf4, 0x3fcc49ba,
   1.109 -    0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246,
   1.110 -    0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000,
   1.111 -    0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002,
   1.112 -    0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x05000036, 0x00100082,
   1.113 -    0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000,
   1.114 -    0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453,
   1.115 -    0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005,
   1.116 -    0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
   1.117 -    0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
   1.118 -    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
   1.119 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
   1.120 -    0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c,
   1.121 -    0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000,
   1.122 -    0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7,
   1.123 -    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001,
   1.124 -    0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
   1.125 -    0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005,
   1.126 -    0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874,
   1.127 -    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568,
   1.128 -    0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369,
   1.129 -    0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
   1.130 -    0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00,
   1.131 -    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
   1.132 -    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
   1.133 -    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
   1.134 -    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
   1.135 -    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
   1.136 -    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
   1.137 +    0x43425844, 0x04e69cba, 0x74ce6dd2, 0x7fcf84cb, 0x3003d677, 0x00000001,
   1.138 +    0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438,
   1.139 +    0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200,
   1.140 +    0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
   1.141 +    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051,
   1.142 +    0xa00f0000, 0xbd800000, 0xbf000000, 0xbf000000, 0x3f800000, 0x05000051,
   1.143 +    0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051,
   1.144 +    0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x05000051,
   1.145 +    0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x0200001f,
   1.146 +    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
   1.147 +    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
   1.148 +    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
   1.149 +    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002,
   1.150 +    0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001,
   1.151 +    0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000,
   1.152 +    0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001,
   1.153 +    0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000,
   1.154 +    0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
   1.155 +    0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
   1.156 +    0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853,
   1.157 +    0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000,
   1.158 +    0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000,
   1.159 +    0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555,
   1.160 +    0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
   1.161 +    0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
   1.162 +    0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
   1.163 +    0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
   1.164 +    0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
   1.165 +    0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2,
   1.166 +    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000,
   1.167 +    0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001,
   1.168 +    0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002,
   1.169 +    0xbd800000, 0xbf000000, 0xbf000000, 0x00000000, 0x0a00000f, 0x00100012,
   1.170 +    0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f94fdf4, 0x3fcc49ba,
   1.171 +    0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246,
   1.172 +    0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000,
   1.173 +    0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002,
   1.174 +    0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x05000036, 0x00100082,
   1.175 +    0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000,
   1.176 +    0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453,
   1.177 +    0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005,
   1.178 +    0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
   1.179 +    0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
   1.180 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
   1.181 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
   1.182 +    0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c,
   1.183 +    0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000,
   1.184 +    0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7,
   1.185 +    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001,
   1.186 +    0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
   1.187 +    0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005,
   1.188 +    0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874,
   1.189 +    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568,
   1.190 +    0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369,
   1.191 +    0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
   1.192 +    0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00,
   1.193 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
   1.194 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
   1.195 +    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
   1.196 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
   1.197 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
   1.198 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
   1.199      0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
   1.200  };
   1.201  #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
   1.202  static const DWORD D3D11_PixelShader_YUV[] = {
   1.203 -    0x43425844, 0xe6d969fc, 0x63cac33c, 0xa4926502, 0x5d788135, 0x00000001,
   1.204 -    0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410,
   1.205 -    0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200,
   1.206 -    0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
   1.207 -    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051,
   1.208 -    0xa00f0000, 0xbd800000, 0xbf000000, 0x3f800000, 0x00000000, 0x05000051,
   1.209 -    0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x400126e9, 0x05000051,
   1.210 -    0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x0200001f,
   1.211 -    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
   1.212 -    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
   1.213 -    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801,
   1.214 -    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001,
   1.215 -    0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001,
   1.216 -    0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000,
   1.217 -    0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008,
   1.218 -    0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000,
   1.219 -    0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005,
   1.220 -    0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000,
   1.221 -    0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a,
   1.222 -    0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
   1.223 -    0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000,
   1.224 -    0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062,
   1.225 -    0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
   1.226 -    0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
   1.227 -    0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2,
   1.228 -    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000,
   1.229 -    0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001,
   1.230 -    0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
   1.231 -    0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000,
   1.232 -    0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246,
   1.233 -    0x00000000, 0x00004002, 0xbd800000, 0xbf000000, 0xbf000000, 0x00000000,
   1.234 -    0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002,
   1.235 -    0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022,
   1.236 -    0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127,
   1.237 -    0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046,
   1.238 -    0x00000000, 0x00004002, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000,
   1.239 -    0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038,
   1.240 -    0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002,
   1.241 -    0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000,
   1.242 -    0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
   1.243 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
   1.244 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
   1.245 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
   1.246 -    0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000,
   1.247 -    0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c,
   1.248 -    0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
   1.249 -    0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
   1.250 -    0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005,
   1.251 -    0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf,
   1.252 -    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001,
   1.253 -    0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
   1.254 -    0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478,
   1.255 -    0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
   1.256 -    0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030,
   1.257 -    0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
   1.258 -    0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
   1.259 -    0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
   1.260 -    0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
   1.261 -    0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
   1.262 -    0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
   1.263 -    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
   1.264 +    0x43425844, 0xe6d969fc, 0x63cac33c, 0xa4926502, 0x5d788135, 0x00000001,
   1.265 +    0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410,
   1.266 +    0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200,
   1.267 +    0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
   1.268 +    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051,
   1.269 +    0xa00f0000, 0xbd800000, 0xbf000000, 0x3f800000, 0x00000000, 0x05000051,
   1.270 +    0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x400126e9, 0x05000051,
   1.271 +    0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x0200001f,
   1.272 +    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
   1.273 +    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
   1.274 +    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801,
   1.275 +    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001,
   1.276 +    0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001,
   1.277 +    0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000,
   1.278 +    0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008,
   1.279 +    0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000,
   1.280 +    0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005,
   1.281 +    0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000,
   1.282 +    0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a,
   1.283 +    0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
   1.284 +    0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000,
   1.285 +    0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062,
   1.286 +    0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
   1.287 +    0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
   1.288 +    0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2,
   1.289 +    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000,
   1.290 +    0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001,
   1.291 +    0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
   1.292 +    0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000,
   1.293 +    0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246,
   1.294 +    0x00000000, 0x00004002, 0xbd800000, 0xbf000000, 0xbf000000, 0x00000000,
   1.295 +    0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002,
   1.296 +    0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022,
   1.297 +    0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127,
   1.298 +    0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046,
   1.299 +    0x00000000, 0x00004002, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000,
   1.300 +    0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038,
   1.301 +    0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002,
   1.302 +    0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000,
   1.303 +    0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
   1.304 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
   1.305 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
   1.306 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
   1.307 +    0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000,
   1.308 +    0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c,
   1.309 +    0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
   1.310 +    0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
   1.311 +    0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005,
   1.312 +    0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf,
   1.313 +    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001,
   1.314 +    0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
   1.315 +    0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478,
   1.316 +    0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
   1.317 +    0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030,
   1.318 +    0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
   1.319 +    0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
   1.320 +    0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
   1.321 +    0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
   1.322 +    0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
   1.323 +    0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
   1.324 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
   1.325      0x45475241, 0xabab0054
   1.326  };
   1.327  #else
   1.328 @@ -985,6 +988,8 @@
   1.329      D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
   1.330  
   1.331      if (data) {
   1.332 +        SAFE_RELEASE(data->dxgiFactory);
   1.333 +        SAFE_RELEASE(data->dxgiAdapter);
   1.334          SAFE_RELEASE(data->d3dDevice);
   1.335          SAFE_RELEASE(data->d3dContext);
   1.336          SAFE_RELEASE(data->swapChain);
   1.337 @@ -1008,6 +1013,9 @@
   1.338          if (data->hD3D11Mod) {
   1.339              SDL_UnloadObject(data->hD3D11Mod);
   1.340          }
   1.341 +        if (data->hDXGIMod) {
   1.342 +            SDL_UnloadObject(data->hDXGIMod);
   1.343 +        }
   1.344          SDL_free(data);
   1.345      }
   1.346      SDL_free(renderer);
   1.347 @@ -1049,16 +1057,33 @@
   1.348  /* Create resources that depend on the device. */
   1.349  static HRESULT
   1.350  D3D11_CreateDeviceResources(SDL_Renderer * renderer)
   1.351 -{
   1.352 +{
   1.353 +    typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory);
   1.354 +    PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc;
   1.355      D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
   1.356      PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc;
   1.357 +    IDXGIAdapter *d3dAdapter = NULL;
   1.358      ID3D11Device *d3dDevice = NULL;
   1.359      ID3D11DeviceContext *d3dContext = NULL;
   1.360 +    IDXGIDevice1 *dxgiDevice = NULL;
   1.361      HRESULT result = S_OK;
   1.362  
   1.363  #ifdef __WINRT__
   1.364 +    CreateDXGIFactoryFunc = CreateDXGIFactory;
   1.365      D3D11CreateDeviceFunc = D3D11CreateDevice;
   1.366 -#else
   1.367 +#else
   1.368 +    data->hDXGIMod = SDL_LoadObject("dxgi.dll");
   1.369 +    if (!data->hDXGIMod) {
   1.370 +        result = E_FAIL;
   1.371 +        goto done;
   1.372 +    }
   1.373 +
   1.374 +    CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
   1.375 +    if (!CreateDXGIFactoryFunc) {
   1.376 +        result = E_FAIL;
   1.377 +        goto done;
   1.378 +    }
   1.379 +
   1.380      data->hD3D11Mod = SDL_LoadObject("d3d11.dll");
   1.381      if (!data->hD3D11Mod) {
   1.382          result = E_FAIL;
   1.383 @@ -1070,7 +1095,20 @@
   1.384          result = E_FAIL;
   1.385          goto done;
   1.386      }
   1.387 -#endif /* __WINRT__ */
   1.388 +#endif /* __WINRT__ */
   1.389 +
   1.390 +    result = CreateDXGIFactoryFunc(&IID_IDXGIFactory2, &data->dxgiFactory);
   1.391 +    if (FAILED(result)) {
   1.392 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory", result);
   1.393 +        goto done;
   1.394 +    }
   1.395 +
   1.396 +    /* FIXME: Should we use the default adapter? */
   1.397 +    result = IDXGIFactory2_EnumAdapters(data->dxgiFactory, 0, &data->dxgiAdapter);
   1.398 +    if (FAILED(result)) {
   1.399 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", D3D11CreateDevice", result);
   1.400 +        goto done;
   1.401 +    }
   1.402  
   1.403      /* This flag adds support for surfaces with a different color channel ordering
   1.404       * than the API default. It is required for compatibility with Direct2D.
   1.405 @@ -1101,8 +1139,8 @@
   1.406  
   1.407      /* Create the Direct3D 11 API device object and a corresponding context. */
   1.408      result = D3D11CreateDeviceFunc(
   1.409 -        NULL, /* Specify NULL to use the default adapter */
   1.410 -        D3D_DRIVER_TYPE_HARDWARE,
   1.411 +        data->dxgiAdapter,
   1.412 +        D3D_DRIVER_TYPE_UNKNOWN,
   1.413          NULL,
   1.414          creationFlags, /* Set set debug and Direct2D compatibility flags. */
   1.415          featureLevels, /* List of feature levels this app can support. */
   1.416 @@ -1129,6 +1167,21 @@
   1.417          goto done;
   1.418      }
   1.419  
   1.420 +    result = ID3D11Device_QueryInterface(d3dDevice, &IID_IDXGIDevice1, &dxgiDevice);
   1.421 +    if (FAILED(result)) {
   1.422 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to IDXGIDevice1", result);
   1.423 +        goto done;
   1.424 +    }
   1.425 +
   1.426 +    /* Ensure that DXGI does not queue more than one frame at a time. This both reduces latency and
   1.427 +     * ensures that the application will only render after each VSync, minimizing power consumption.
   1.428 +     */
   1.429 +    result = IDXGIDevice1_SetMaximumFrameLatency(dxgiDevice, 1);
   1.430 +    if (FAILED(result)) {
   1.431 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIDevice1::SetMaximumFrameLatency", result);
   1.432 +        goto done;
   1.433 +    }
   1.434 +
   1.435      /* Make note of the maximum texture size
   1.436       * Max texture sizes are documented on MSDN, at:
   1.437       * http://msdn.microsoft.com/en-us/library/windows/apps/ff476876.aspx
   1.438 @@ -1232,10 +1285,10 @@
   1.439      constantBufferDesc.Usage = D3D11_USAGE_DEFAULT;
   1.440      constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
   1.441      result = ID3D11Device_CreateBuffer(data->d3dDevice,
   1.442 -		&constantBufferDesc,
   1.443 -		NULL,
   1.444 +        &constantBufferDesc,
   1.445 +        NULL,
   1.446          &data->vertexShaderConstants
   1.447 -		);
   1.448 +        );
   1.449      if (FAILED(result)) {
   1.450          WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBuffer [vertex shader constants]", result);
   1.451          goto done;
   1.452 @@ -1275,25 +1328,25 @@
   1.453      /* Setup Direct3D rasterizer states */
   1.454      D3D11_RASTERIZER_DESC rasterDesc;
   1.455      SDL_zero(rasterDesc);
   1.456 -	rasterDesc.AntialiasedLineEnable = FALSE;
   1.457 -	rasterDesc.CullMode = D3D11_CULL_NONE;
   1.458 -	rasterDesc.DepthBias = 0;
   1.459 -	rasterDesc.DepthBiasClamp = 0.0f;
   1.460 -	rasterDesc.DepthClipEnable = TRUE;
   1.461 -	rasterDesc.FillMode = D3D11_FILL_SOLID;
   1.462 -	rasterDesc.FrontCounterClockwise = FALSE;
   1.463 +    rasterDesc.AntialiasedLineEnable = FALSE;
   1.464 +    rasterDesc.CullMode = D3D11_CULL_NONE;
   1.465 +    rasterDesc.DepthBias = 0;
   1.466 +    rasterDesc.DepthBiasClamp = 0.0f;
   1.467 +    rasterDesc.DepthClipEnable = TRUE;
   1.468 +    rasterDesc.FillMode = D3D11_FILL_SOLID;
   1.469 +    rasterDesc.FrontCounterClockwise = FALSE;
   1.470      rasterDesc.MultisampleEnable = FALSE;
   1.471      rasterDesc.ScissorEnable = FALSE;
   1.472 -	rasterDesc.SlopeScaledDepthBias = 0.0f;
   1.473 +    rasterDesc.SlopeScaledDepthBias = 0.0f;
   1.474      result = ID3D11Device_CreateRasterizerState(data->d3dDevice, &rasterDesc, &data->mainRasterizer);
   1.475 -	if (FAILED(result)) {
   1.476 +    if (FAILED(result)) {
   1.477          WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState [main rasterizer]", result);
   1.478          goto done;
   1.479      }
   1.480  
   1.481      rasterDesc.ScissorEnable = TRUE;
   1.482      result = ID3D11Device_CreateRasterizerState(data->d3dDevice, &rasterDesc, &data->clippedRasterizer);
   1.483 -	if (FAILED(result)) {
   1.484 +    if (FAILED(result)) {
   1.485          WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState [clipped rasterizer]", result);
   1.486          goto done;
   1.487      }
   1.488 @@ -1346,6 +1399,7 @@
   1.489  done:
   1.490      SAFE_RELEASE(d3dDevice);
   1.491      SAFE_RELEASE(d3dContext);
   1.492 +    SAFE_RELEASE(dxgiDevice);
   1.493      return result;
   1.494  }
   1.495  
   1.496 @@ -1360,13 +1414,13 @@
   1.497  D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer)
   1.498  {
   1.499      SDL_Window * sdlWindow = renderer->window;
   1.500 -    if ( ! renderer->window ) {
   1.501 +    if (!renderer->window) {
   1.502          return NULL;
   1.503      }
   1.504  
   1.505      SDL_SysWMinfo sdlWindowInfo;
   1.506      SDL_VERSION(&sdlWindowInfo.version);
   1.507 -    if ( ! SDL_GetWindowWMInfo(sdlWindow, &sdlWindowInfo) ) {
   1.508 +    if (!SDL_GetWindowWMInfo(sdlWindow, &sdlWindowInfo)) {
   1.509          return NULL;
   1.510      }
   1.511  
   1.512 @@ -1490,9 +1544,6 @@
   1.513      IUnknown *coreWindow = NULL;
   1.514      const BOOL usingXAML = FALSE;
   1.515  #endif
   1.516 -    IDXGIDevice1 *dxgiDevice = NULL;
   1.517 -    IDXGIAdapter *dxgiAdapter = NULL;
   1.518 -    IDXGIFactory2 *dxgiFactory = NULL;
   1.519      HRESULT result = S_OK;
   1.520  
   1.521      /* Create a swap chain using the same adapter as the existing Direct3D device. */
   1.522 @@ -1519,26 +1570,8 @@
   1.523  #endif
   1.524      swapChainDesc.Flags = 0;
   1.525  
   1.526 -    result = ID3D11Device_QueryInterface(data->d3dDevice, &IID_IDXGIDevice1, &dxgiDevice);
   1.527 -    if (FAILED(result)) {
   1.528 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to IDXGIDevice1", result);
   1.529 -        goto done;
   1.530 -    }
   1.531 -
   1.532 -    result = IDXGIDevice1_GetAdapter(dxgiDevice, &dxgiAdapter);
   1.533 -    if (FAILED(result)) {
   1.534 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIDevice1::GetAdapter", result);
   1.535 -        goto done;
   1.536 -    }
   1.537 -
   1.538 -    result = IDXGIAdapter_GetParent(dxgiAdapter, &IID_IDXGIFactory2, &dxgiFactory);
   1.539 -    if (FAILED(result)) {
   1.540 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIAdapter::GetParent", result);
   1.541 -        goto done;
   1.542 -    }
   1.543 -
   1.544      if (coreWindow) {
   1.545 -        result = IDXGIFactory2_CreateSwapChainForCoreWindow(dxgiFactory,
   1.546 +        result = IDXGIFactory2_CreateSwapChainForCoreWindow(data->dxgiFactory,
   1.547              (IUnknown *)data->d3dDevice,
   1.548              coreWindow,
   1.549              &swapChainDesc,
   1.550 @@ -1550,7 +1583,7 @@
   1.551              goto done;
   1.552          }
   1.553      } else if (usingXAML) {
   1.554 -        result = IDXGIFactory2_CreateSwapChainForComposition(dxgiFactory,
   1.555 +        result = IDXGIFactory2_CreateSwapChainForComposition(data->dxgiFactory,
   1.556              (IUnknown *)data->d3dDevice,
   1.557              &swapChainDesc,
   1.558              NULL,
   1.559 @@ -1564,7 +1597,7 @@
   1.560          result = WINRT_GlobalSwapChainBackgroundPanelNative->SetSwapChain(data->swapChain);
   1.561          if (FAILED(result)) {
   1.562              WIN_SetErrorFromHRESULT(__FUNCTION__ ", ISwapChainBackgroundPanelNative::SetSwapChain", result);
   1.563 -            return result;
   1.564 +            goto done;
   1.565          }
   1.566  #else
   1.567          SDL_SetError(__FUNCTION__ ", XAML support is not yet available for Windows Phone");
   1.568 @@ -1576,7 +1609,7 @@
   1.569          SDL_VERSION(&windowinfo.version);
   1.570          SDL_GetWindowWMInfo(renderer->window, &windowinfo);
   1.571  
   1.572 -        result = IDXGIFactory2_CreateSwapChainForHwnd(dxgiFactory,
   1.573 +        result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory,
   1.574              (IUnknown *)data->d3dDevice,
   1.575              windowinfo.info.win.window,
   1.576              &swapChainDesc,
   1.577 @@ -1591,20 +1624,8 @@
   1.578      }
   1.579      data->swapEffect = swapChainDesc.SwapEffect;
   1.580  
   1.581 -    /* Ensure that DXGI does not queue more than one frame at a time. This both reduces latency and
   1.582 -     * ensures that the application will only render after each VSync, minimizing power consumption.
   1.583 -     */
   1.584 -    result = IDXGIDevice1_SetMaximumFrameLatency(dxgiDevice, 1);
   1.585 -    if (FAILED(result)) {
   1.586 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIDevice1::SetMaximumFrameLatency", result);
   1.587 -        goto done;
   1.588 -    }
   1.589 -
   1.590  done:
   1.591      SAFE_RELEASE(coreWindow);
   1.592 -    SAFE_RELEASE(dxgiDevice);
   1.593 -    SAFE_RELEASE(dxgiAdapter);
   1.594 -    SAFE_RELEASE(dxgiFactory);
   1.595      return result;
   1.596  }
   1.597