OgreD3D11Prerequisites.h
Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004 (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2012 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 #ifndef __D3D11PREREQUISITES_H__
00029 #define __D3D11PREREQUISITES_H__
00030 
00031 #include "OgrePrerequisites.h"
00032 #include "WIN32/OgreMinGWSupport.h" // extra defines for MinGW to deal with DX SDK
00033 
00034 #if OGRE_THREAD_SUPPORT
00035 #define OGRE_LOCK_RECURSIVE_MUTEX(name)   name.lock();
00036 #define OGRE_UNLOCK_RECURSIVE_MUTEX(name) name.unlock();
00037 #else
00038 #define OGRE_LOCK_RECURSIVE_MUTEX(name) 
00039 #define OGRE_UNLOCK_RECURSIVE_MUTEX(name)
00040 #endif
00041 
00042 
00043 #if OGRE_THREAD_SUPPORT == 1
00044 #define D3D11_DEVICE_ACCESS_LOCK                OGRE_LOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
00045 #define D3D11_DEVICE_ACCESS_UNLOCK          OGRE_UNLOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
00046 #define D3D11_DEVICE_ACCESS_CRITICAL_SECTION    OGRE_LOCK_MUTEX(msDeviceAccessMutex)
00047 #else
00048 #define D3D11_DEVICE_ACCESS_LOCK    
00049 #define D3D11_DEVICE_ACCESS_UNLOCK
00050 #define D3D11_DEVICE_ACCESS_CRITICAL_SECTION
00051 #endif
00052 
00053 // Define versions for if DirectX is in use (Win32 only)
00054 #define DIRECT3D_VERSION 0x1100
00055 
00056 // some D3D commonly used macros
00057 #define SAFE_DELETE(p)       { if(p) { delete (p);     (p)=NULL; } }
00058 #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p);   (p)=NULL; } }
00059 #define SAFE_RELEASE(p)      { if(p) { (p)->Release(); (p)=NULL; } }
00060 
00061 
00062 #undef NOMINMAX
00063 #define NOMINMAX // required to stop windows.h screwing up std::min definition
00064 #include <d3d11.h>
00065 #include <d3dx11.h>
00066 #include <d3d11shader.h>
00067 #include <D3Dcompiler.h>
00068 
00069 
00070 namespace Ogre
00071 {
00072     // Predefine classes
00073     class D3D11RenderSystem;
00074     class D3D11RenderWindow;
00075     class D3D11Texture;
00076     class D3D11TextureManager;
00077     class D3D11DepthBuffer;
00078     class D3D11Driver;
00079     class D3D11DriverList;
00080     class D3D11VideoMode;
00081     class D3D11VideoModeList;
00082     class D3D11GpuProgram;
00083     class D3D11GpuProgramManager;
00084     class D3D11HardwareBufferManager;
00085     class D3D11HardwareIndexBuffer;
00086     class D3D11HLSLProgramFactory;
00087     class D3D11HLSLProgram;
00088     class D3D11VertexDeclaration;
00089     class D3D11Device;
00090     class D3D11HardwareBuffer;
00091     class D3D11HardwarePixelBuffer;
00092 
00093     // Should we ask D3D to manage vertex/index buffers automatically?
00094     // Doing so avoids lost devices, but also has a performance impact
00095     // which is unacceptably bad when using very large buffers
00096 #define OGRE_D3D_MANAGE_BUFFERS 1
00097 
00098     //-------------------------------------------
00099     // Windows setttings
00100     //-------------------------------------------
00101 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(OGRE_STATIC_LIB)
00102 #   ifdef OGRED3DENGINEDLL_EXPORTS
00103 #       define _OgreD3D11Export __declspec(dllexport)
00104 #   else
00105 #       if defined( __MINGW32__ )
00106 #           define _OgreD3D11Export
00107 #       else
00108 #           define _OgreD3D11Export __declspec(dllimport)
00109 #       endif
00110 #   endif
00111 #else
00112 #   define _OgreD3D11Export
00113 #endif  // OGRE_WIN32
00114 }
00115 #endif

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 2012 21:48:49