OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreD3D11Prerequisites.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __D3D11PREREQUISITES_H__
29 #define __D3D11PREREQUISITES_H__
30 
31 
32 
33 #include "OgrePrerequisites.h"
34 #include "WIN32/OgreMinGWSupport.h" // extra defines for MinGW to deal with DX SDK
35 
36 #if OGRE_THREAD_SUPPORT
37 #define OGRE_LOCK_RECURSIVE_MUTEX(name) name.lock();
38 #define OGRE_UNLOCK_RECURSIVE_MUTEX(name) name.unlock();
39 #else
40 #define OGRE_LOCK_RECURSIVE_MUTEX(name)
41 #define OGRE_UNLOCK_RECURSIVE_MUTEX(name)
42 #endif
43 
44 
45 #if OGRE_THREAD_SUPPORT == 1
46 #define D3D11_DEVICE_ACCESS_LOCK OGRE_LOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
47 #define D3D11_DEVICE_ACCESS_UNLOCK OGRE_UNLOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
48 #define D3D11_DEVICE_ACCESS_CRITICAL_SECTION OGRE_LOCK_MUTEX(msDeviceAccessMutex)
49 #else
50 #define D3D11_DEVICE_ACCESS_LOCK
51 #define D3D11_DEVICE_ACCESS_UNLOCK
52 #define D3D11_DEVICE_ACCESS_CRITICAL_SECTION
53 #endif
54 
55 // some D3D commonly used macros
56 #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
57 #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
58 #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
59 
60 
61 #undef NOMINMAX
62 #define NOMINMAX // required to stop windows.h screwing up std::min definition
63 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
64 #include <d3d11.h>
65 #elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
66 #include <d3d11_1.h>
67 #endif
68 
69 #if (OGRE_PLATFORM == OGRE_PLATFORM_WINRT && OGRE_WINRT_TARGET_TYPE == PHONE)
70 # include <C:\Program Files (x86)\Windows Kits\8.0\Include\um\d3d11shader.h>
71 #else
72 # include <d3d11shader.h>
73 # include <D3Dcompiler.h>
74 #endif
75 
76 
77 namespace Ogre
78 {
79  // typedefs to work with Direct3D 11 or 11.1 as appropriate
80 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
81  typedef ID3D11Device ID3D11DeviceN;
82  typedef ID3D11DeviceContext ID3D11DeviceContextN;
83  typedef ID3D11RasterizerState ID3D11RasterizerStateN;
84  typedef IDXGIFactory1 IDXGIFactoryN;
85  typedef IDXGIAdapter1 IDXGIAdapterN;
86  typedef IDXGIDevice1 IDXGIDeviceN;
87  typedef IDXGISwapChain IDXGISwapChainN;
88  typedef DXGI_SWAP_CHAIN_DESC DXGI_SWAP_CHAIN_DESC_N;
89 #elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
90  typedef ID3D11Device1 ID3D11DeviceN;
91  typedef ID3D11DeviceContext1 ID3D11DeviceContextN;
92  typedef ID3D11RasterizerState1 ID3D11RasterizerStateN;
93  typedef IDXGIFactory2 IDXGIFactoryN;
94  typedef IDXGIAdapter1 IDXGIAdapterN; // we don`t need IDXGIAdapter2 functionality
95  typedef IDXGIDevice2 IDXGIDeviceN;
96  typedef IDXGISwapChain1 IDXGISwapChainN;
97  typedef DXGI_SWAP_CHAIN_DESC1 DXGI_SWAP_CHAIN_DESC_N;
98 #endif
99 
100  // Predefine classes
101  class D3D11RenderSystem;
102  class D3D11RenderWindowBase;
103  class D3D11Texture;
104  class D3D11TextureManager;
105  class D3D11DepthBuffer;
106  class D3D11Driver;
107  class D3D11DriverList;
108  class D3D11VideoMode;
109  class D3D11VideoModeList;
110  class D3D11GpuProgram;
115  class D3D11HLSLProgram;
117  class D3D11Device;
118  class D3D11HardwareBuffer;
120 
124 
125  //-------------------------------------------
126  // Windows setttings
127  //-------------------------------------------
128 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT) && !defined(OGRE_STATIC_LIB)
129 # ifdef OGRED3DENGINEDLL_EXPORTS
130 # define _OgreD3D11Export __declspec(dllexport)
131 # else
132 # if defined( __MINGW32__ )
133 # define _OgreD3D11Export
134 # else
135 # define _OgreD3D11Export __declspec(dllimport)
136 # endif
137 # endif
138 #else
139 # define _OgreD3D11Export
140 #endif // OGRE_WIN32
141 }
142 #endif
IDXGIAdapter1 IDXGIAdapterN
SharedPtr< D3D11HLSLProgram > D3D11HLSLProgramPtr
ID3D11RasterizerState ID3D11RasterizerStateN
SharedPtr< D3D11Texture > D3D11TexturePtr
IDXGIDevice1 IDXGIDeviceN
DXGI_SWAP_CHAIN_DESC DXGI_SWAP_CHAIN_DESC_N
ID3D11DeviceContext ID3D11DeviceContextN
ID3D11Device ID3D11DeviceN
D3D11HardwareBufferManagerBase as a Singleton.
IDXGISwapChain IDXGISwapChainN
IDXGIFactory1 IDXGIFactoryN
Base implementation of a D3D11 buffer, dealing with all the common aspects.
Specialisation of VertexDeclaration for D3D11.
Implementation of DirectX11 as a rendering system.
Reference-counted shared pointer, used for objects where implicit destruction is required.
Direct3D implementation of a few things common to low-level vertex & fragment programs.
Specialization of HighLevelGpuProgram to provide support for D3D11 High-Level Shader Language (HLSL)...
Factory class for D3D11 HLSL programs.
SharedPtr< D3D11GpuProgram > D3D11GpuProgramPtr