#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2013 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11API_H #define NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11API_H #define WIN32_LEAN_AND_MEAN #define VC_EXTRALEAN #define NO_MINMAX #include #include #define INITGUID 1 #define D3D11_NO_HELPERS #include // Direct3D 11.1 requires Windows 8 or later. #if defined(NUCLEX_GRAPHICS_DIRECT3D11_1) #include #endif #include #include namespace Nuclex { namespace Graphics { namespace Rasterization { // ------------------------------------------------------------------------------------------- // // For some reason, the _COM_SMARTPTR_TYPEDEF macro causes errors when it is used in // a WinRT build. A bug submitted to Microsoft Connect was confirmed, its cause pinpointed // by a member of the Windows C++ libraries team, then 'Deferred' and forgotten about. // // Windows 8 now ships with the buggy header and it will probably not get fixed ever because // it might change the behavior of existing code (eg. people relying on a compilation error // for whatever reason might suddenly get perfectly working code). Hurray. // http://connect.microsoft.com/VisualStudio/feedback/details/751127 // // Now Microsoft added a third smart pointer, Microsoft::WRL::ComPtr, with yet another // QueryInterface() concept. Its design isn't as crappy as the CComPtr and CComQIPtr, // but obviously whoever wrote it forgot about _com_ptr_t. // // This new member of the COM smart pointer zoo, Microsoft::WRL::ComPtr, only works in // C++/CX and is far less elegant than _com_ptr_t, so we use _com_ptr_t. End of story. // #if defined(NUCLEX_GRAPHICS_DIRECT3D11_1) /// GPU interface through which rendering takes place typedef ID3D11Device1 ID3D11DeviceN; /// Manages the state of the GPU for rendering typedef ID3D11DeviceContext1 ID3D11DeviceContextN; /// Creates resources for the Direct3D 11 windows interface typedef IDXGIFactory2 IDXGIFactoryN; /// Manages the Direct3D 11 windows interface typedef IDXGIDevice2 IDXGIDeviceN; /// Direct3D graphics adapter interface typedef IDXGIAdapter2 IDXGIAdapterN; /// Direct3D windows interface swap chain typedef IDXGISwapChain1 IDXGISwapChainN; /// Blending state that can be bound to the output merger stage typedef ID3D11BlendState1 ID3DBlendStateN; /// Manages the rasterization options used by the GPU typedef ID3D11RasterizerState1 ID3D11RasterizerStateN; /// Settings for the Direct3D 11 swap chain description typedef DXGI_SWAP_CHAIN_DESC1 DXGI_SWAP_CHAIN_DESCN; #else // Direct3D 11.0 /// GPU interface through which rendering takes place typedef ID3D11Device ID3D11DeviceN; /// Manages the state of the GPU for rendering typedef ID3D11DeviceContext ID3D11DeviceContextN; /// Creates resources for the Direct3D 11 windows interface typedef IDXGIFactory IDXGIFactoryN; /// Manages the Direct3D 11 windows interface typedef IDXGIDevice IDXGIDeviceN; /// Direct3D graphics adapter interface typedef IDXGIAdapter IDXGIAdapterN; /// Direct3D windows interface swap chain typedef IDXGISwapChain IDXGISwapChainN; /// Blending state that can be bound to the output merger stage typedef ID3D11BlendState ID3DBlendStateN; /// Manages the rasterization options used by the GPU typedef ID3D11RasterizerState ID3D11RasterizerStateN; /// Settings for the Direct3D 11 swap chain description typedef DXGI_SWAP_CHAIN_DESC DXGI_SWAP_CHAIN_DESCN; #endif /// Interface ID of the Direct3D 11 GPU rendering interface extern const IID IID_ID3D11DeviceN; /// Interface ID of the Direct3D 11 GPU state interface extern const IID IID_ID3D11DeviceContextN; /// Interface to the Direct3D 11 windows interface resource factory extern const IID IID_IDXGIFactoryN; /// Interface to the Direct3D 11 windows interface device factory extern const IID IID_IDXGIDeviceN; /// Interface to the Direct3D 11 graphics adapter interface extern const IID IID_IDXGIAdapterN; /// Interface to the Direct3D 11 windows interface swap chain extern const IID IID_IDXGISwapChainN; /// Interface to the Direct3D 11 rasterizer state extern const IID IID_ID3D11RasterizerStateN; /// Meta data for the Direct3D 11 GPU rendering interface typedef _com_IIID ID3D11DeviceMeta; /// Smart pointer holding a Direct3D 11 GPU render device typedef _com_ptr_t ID3D11DevicePtr; /// Meta data for the Direct3D 11 GPU rendering interface typedef _com_IIID ID3D11DeviceNMeta; /// Smart pointer holding a Direct3D 11 GPU render device typedef _com_ptr_t ID3D11DeviceNPtr; /// Meta data for the Direct3D 11 GPU rendering context interface typedef _com_IIID ID3D11DeviceContextMeta; /// Smart pointer holding a Direct3D 11 render device context typedef _com_ptr_t ID3D11DeviceContextPtr; /// Meta data for the Direct3D 11 GPU rendering context interface typedef _com_IIID ID3D11DeviceContextNMeta; /// Smart pointer holding a Direct3D 11 render device context typedef _com_ptr_t ID3D11DeviceContextNPtr; /// Meta data for the Direct3D 11 resource factory interface typedef _com_IIID IDXGIFactoryNMeta; /// Smart pointer holding a Direct3D 11 resource factory typedef _com_ptr_t IDXGIFactoryNPtr; /// Meta data for the Direct3D 11 windows interface typedef _com_IIID IDXGIDeviceNMeta; /// Smart pointer holding a Direct3D 11 windows interface factory typedef _com_ptr_t IDXGIDeviceNPtr; /// Meta data for the Direct3D 11 graphics adapter interface typedef _com_IIID IDXGIAdapterMeta; /// Smart pointer holding a Direct3D 11 graphics adapter typedef _com_ptr_t IDXGIAdapterPtr; /// Meta data for the Direct3D 11 graphics adapter interface typedef _com_IIID IDXGIAdapterNMeta; /// Smart pointer holding a Direct3D 11 graphics adapter typedef _com_ptr_t IDXGIAdapterNPtr; /// Meta data for the Direct3D 11 windows interface swap chain typedef _com_IIID IDXGISwapChainMeta; /// Smart pointer holding a Direct3D 11 windows interface swap chain typedef _com_ptr_t IDXGISwapChainPtr; /// Meta data for the Direct3D 11 windows interface swap chain typedef _com_IIID IDXGISwapChainNMeta; /// Smart pointer holding a Direct3D 11 windows interface swap chain typedef _com_ptr_t IDXGISwapChainNPtr; /// Meta data for the Direct3D 11 2D texture interface typedef _com_IIID ID3D11Texture2DMeta; /// Smart pointer holding a Direct3D 11 2D texture typedef _com_ptr_t ID3D11Texture2DPtr; /// Meta data for the Direct3D 11 shader resource view interface typedef _com_IIID< ID3D11ShaderResourceView, &IID_ID3D11ShaderResourceView > ID3D11ShaderResourceViewMeta; /// Smart pointer holding a Direct3D 11 shader resource view typedef _com_ptr_t ID3D11ShaderResourceViewPtr; /// View of a Direct3D 11 render target texture typedef _com_IIID< ID3D11RenderTargetView, &IID_ID3D11RenderTargetView > ID3D11RenderTargetViewMeta; /// Smart pointer holding a view of a Direct3D 11 render target texture typedef _com_ptr_t ID3D11RenderTargetViewPtr; /// View of a Direct3D 11 depth and stencil texture typedef _com_IIID< ID3D11DepthStencilView, &IID_ID3D11DepthStencilView > ID3D11DepthStencilViewMeta; /// Smart pointer holding a view of a Direct3D 11 depth stencil texture typedef _com_ptr_t ID3D11DepthStencilViewPtr; /// Meta data for the Direct3D 11 vertex shader interface typedef _com_IIID ID3D11VertexShaderMeta; /// Smart pointer holding a Direct3D 11 vertex shader typedef _com_ptr_t ID3D11VertexShaderPtr; /// Meta data for the Direct3D 11 pixel shader interface typedef _com_IIID ID3D11PixelShaderMeta; /// Smart pointer holding a Direct3D 11 pixel shader typedef _com_ptr_t ID3D11PixelShaderPtr; /// Meta data for the Direct3D 11 buffer interface typedef _com_IIID ID3D11BufferMeta; /// Smart pointer holding a Direct3D 11 buffer typedef _com_ptr_t ID3D11BufferPtr; /// Meta data for the Direct3D 11 input layout interface typedef _com_IIID ID3D11InputLayoutMeta; /// Smart pointer holding a Direct3D 11 input layout typedef _com_ptr_t ID3D11InputLayoutPtr; /// Meta data for the Direct3D 11 rasterizer state interface typedef _com_IIID< ID3D11RasterizerStateN, &IID_ID3D11RasterizerStateN > ID3D11RasterizerStateNMeta; /// Smart pointer holding a Direct3D 11 rasterizer state typedef _com_ptr_t ID3D11RasterizerStateNPtr; /// Meta data for the Direct3D 11 sampler state interface typedef _com_IIID ID3D11SamplerStateMeta; /// Smart pointer holding a Direct3D 11 sampler state typedef _com_ptr_t ID3D11SamplerStatePtr; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Graphics::Rasterization #endif // NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11API_H