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-2013 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 
00032 
00033 #include "OgrePrerequisites.h"
00034 #include "WIN32/OgreMinGWSupport.h" // extra defines for MinGW to deal with DX SDK
00035 
00036 #if OGRE_THREAD_SUPPORT
00037 #define OGRE_LOCK_RECURSIVE_MUTEX(name)   name.lock();
00038 #define OGRE_UNLOCK_RECURSIVE_MUTEX(name) name.unlock();
00039 #else
00040 #define OGRE_LOCK_RECURSIVE_MUTEX(name) 
00041 #define OGRE_UNLOCK_RECURSIVE_MUTEX(name)
00042 #endif
00043 
00044 
00045 #if OGRE_THREAD_SUPPORT == 1
00046 #define D3D11_DEVICE_ACCESS_LOCK                OGRE_LOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
00047 #define D3D11_DEVICE_ACCESS_UNLOCK          OGRE_UNLOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
00048 #define D3D11_DEVICE_ACCESS_CRITICAL_SECTION    OGRE_LOCK_MUTEX(msDeviceAccessMutex)
00049 #else
00050 #define D3D11_DEVICE_ACCESS_LOCK    
00051 #define D3D11_DEVICE_ACCESS_UNLOCK
00052 #define D3D11_DEVICE_ACCESS_CRITICAL_SECTION
00053 #endif
00054 
00055 // some D3D commonly used macros
00056 #define SAFE_DELETE(p)       { if(p) { delete (p);     (p)=NULL; } }
00057 #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p);   (p)=NULL; } }
00058 #define SAFE_RELEASE(p)      { if(p) { (p)->Release(); (p)=NULL; } }
00059 
00060 
00061 #undef NOMINMAX
00062 #define NOMINMAX // required to stop windows.h screwing up std::min definition
00063 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
00064 #include <d3d11.h>
00065 #elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
00066 #include <d3d11_1.h>
00067 #endif
00068 
00069 #if (OGRE_PLATFORM == OGRE_PLATFORM_WINRT && OGRE_WINRT_TARGET_TYPE == PHONE)
00070 #   include <C:\Program Files (x86)\Windows Kits\8.0\Include\um\d3d11shader.h>
00071 #else
00072 #   include <d3d11shader.h>
00073 #   include <D3Dcompiler.h>
00074 #endif
00075  
00076 
00077 namespace Ogre
00078 {
00079     // typedefs to work with Direct3D 11 or 11.1 as appropriate
00080 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
00081     typedef ID3D11Device            ID3D11DeviceN;
00082     typedef ID3D11DeviceContext     ID3D11DeviceContextN;
00083     typedef ID3D11RasterizerState   ID3D11RasterizerStateN;
00084     typedef IDXGIFactory1           IDXGIFactoryN;
00085     typedef IDXGIAdapter1           IDXGIAdapterN;
00086     typedef IDXGIDevice1            IDXGIDeviceN;
00087     typedef IDXGISwapChain          IDXGISwapChainN;
00088     typedef DXGI_SWAP_CHAIN_DESC    DXGI_SWAP_CHAIN_DESC_N;
00089 #elif  OGRE_PLATFORM == OGRE_PLATFORM_WINRT
00090     typedef ID3D11Device1           ID3D11DeviceN;
00091     typedef ID3D11DeviceContext1    ID3D11DeviceContextN;
00092     typedef ID3D11RasterizerState1  ID3D11RasterizerStateN;
00093     typedef IDXGIFactory2           IDXGIFactoryN;
00094     typedef IDXGIAdapter1           IDXGIAdapterN;          // we don`t need IDXGIAdapter2 functionality
00095     typedef IDXGIDevice2            IDXGIDeviceN;
00096     typedef IDXGISwapChain1         IDXGISwapChainN;
00097     typedef DXGI_SWAP_CHAIN_DESC1   DXGI_SWAP_CHAIN_DESC_N;
00098 #endif
00099 
00100     // Predefine classes
00101     class D3D11RenderSystem;
00102     class D3D11RenderWindowBase;
00103     class D3D11Texture;
00104     class D3D11TextureManager;
00105     class D3D11DepthBuffer;
00106     class D3D11Driver;
00107     class D3D11DriverList;
00108     class D3D11VideoMode;
00109     class D3D11VideoModeList;
00110     class D3D11GpuProgram;
00111     class D3D11GpuProgramManager;
00112     class D3D11HardwareBufferManager;
00113     class D3D11HardwareIndexBuffer;
00114     class D3D11HLSLProgramFactory;
00115     class D3D11HLSLProgram;
00116     class D3D11VertexDeclaration;
00117     class D3D11Device;
00118     class D3D11HardwareBuffer;
00119     class D3D11HardwarePixelBuffer;
00120 
00121     typedef SharedPtr<D3D11GpuProgram>  D3D11GpuProgramPtr;
00122     typedef SharedPtr<D3D11HLSLProgram> D3D11HLSLProgramPtr;
00123     typedef SharedPtr<D3D11Texture>     D3D11TexturePtr;
00124 
00125     //-------------------------------------------
00126     // Windows setttings
00127     //-------------------------------------------
00128 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT) && !defined(OGRE_STATIC_LIB)
00129 #   ifdef OGRED3DENGINEDLL_EXPORTS
00130 #       define _OgreD3D11Export __declspec(dllexport)
00131 #   else
00132 #       if defined( __MINGW32__ )
00133 #           define _OgreD3D11Export
00134 #       else
00135 #           define _OgreD3D11Export __declspec(dllimport)
00136 #       endif
00137 #   endif
00138 #else
00139 #   define _OgreD3D11Export
00140 #endif  // OGRE_WIN32
00141 }
00142 #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 Mon Jul 27 2020 13:40:41