OGRE  1.8
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-2013 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 #include "OgrePrerequisites.h"
32 #include "WIN32/OgreMinGWSupport.h" // extra defines for MinGW to deal with DX SDK
33 
34 #if OGRE_THREAD_SUPPORT
35 #define OGRE_LOCK_RECURSIVE_MUTEX(name) name.lock();
36 #define OGRE_UNLOCK_RECURSIVE_MUTEX(name) name.unlock();
37 #else
38 #define OGRE_LOCK_RECURSIVE_MUTEX(name)
39 #define OGRE_UNLOCK_RECURSIVE_MUTEX(name)
40 #endif
41 
42 
43 #if OGRE_THREAD_SUPPORT == 1
44 #define D3D11_DEVICE_ACCESS_LOCK OGRE_LOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
45 #define D3D11_DEVICE_ACCESS_UNLOCK OGRE_UNLOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
46 #define D3D11_DEVICE_ACCESS_CRITICAL_SECTION OGRE_LOCK_MUTEX(msDeviceAccessMutex)
47 #else
48 #define D3D11_DEVICE_ACCESS_LOCK
49 #define D3D11_DEVICE_ACCESS_UNLOCK
50 #define D3D11_DEVICE_ACCESS_CRITICAL_SECTION
51 #endif
52 
53 // Define versions for if DirectX is in use (Win32 only)
54 #define DIRECT3D_VERSION 0x1100
55 
56 // some D3D commonly used macros
57 #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
58 #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
59 #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
60 
61 
62 #undef NOMINMAX
63 #define NOMINMAX // required to stop windows.h screwing up std::min definition
64 #include <d3d11.h>
65 #include <d3dx11.h>
66 #include <d3d11shader.h>
67 #include <D3Dcompiler.h>
68 
69 
70 namespace Ogre
71 {
72  // Predefine classes
73  class D3D11RenderSystem;
74  class D3D11RenderWindow;
75  class D3D11Texture;
76  class D3D11TextureManager;
77  class D3D11DepthBuffer;
78  class D3D11Driver;
79  class D3D11DriverList;
80  class D3D11VideoMode;
81  class D3D11VideoModeList;
82  class D3D11GpuProgram;
83  class D3D11GpuProgramManager;
84  class D3D11HardwareBufferManager;
85  class D3D11HardwareIndexBuffer;
86  class D3D11HLSLProgramFactory;
87  class D3D11HLSLProgram;
88  class D3D11VertexDeclaration;
89  class D3D11Device;
90  class D3D11HardwareBuffer;
91  class D3D11HardwarePixelBuffer;
92 
93  // Should we ask D3D to manage vertex/index buffers automatically?
94  // Doing so avoids lost devices, but also has a performance impact
95  // which is unacceptably bad when using very large buffers
96 #define OGRE_D3D_MANAGE_BUFFERS 1
97 
98  //-------------------------------------------
99  // Windows setttings
100  //-------------------------------------------
101 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(OGRE_STATIC_LIB)
102 # ifdef OGRED3DENGINEDLL_EXPORTS
103 # define _OgreD3D11Export __declspec(dllexport)
104 # else
105 # if defined( __MINGW32__ )
106 # define _OgreD3D11Export
107 # else
108 # define _OgreD3D11Export __declspec(dllimport)
109 # endif
110 # endif
111 #else
112 # define _OgreD3D11Export
113 #endif // OGRE_WIN32
114 }
115 #endif