OgreD3D9Prerequisites.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 __D3D9PREREQUISITES_H__
00029 #define __D3D9PREREQUISITES_H__
00030 
00031 #include "OgrePrerequisites.h"
00032 #ifdef __MINGW32__
00033 #  include "WIN32/OgreMinGWSupport.h" // extra defines for MinGW to deal with DX SDK
00034 #endif
00035 
00036 #include "Threading/OgreThreadHeaders.h"
00037 
00038 #if OGRE_THREAD_SUPPORT
00039 #   define OGRE_LOCK_RECURSIVE_MUTEX(name)   name.lock();
00040 #   define OGRE_UNLOCK_RECURSIVE_MUTEX(name) name.unlock();
00041 #else
00042 #   define OGRE_LOCK_RECURSIVE_MUTEX(name) 
00043 #   define OGRE_UNLOCK_RECURSIVE_MUTEX(name)
00044 #endif
00045 
00046 #if OGRE_THREAD_SUPPORT == 1
00047 #   define D3D9_DEVICE_ACCESS_LOCK              OGRE_LOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
00048 #   define D3D9_DEVICE_ACCESS_UNLOCK            OGRE_UNLOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
00049 #   define D3D9_DEVICE_ACCESS_CRITICAL_SECTION  OGRE_LOCK_MUTEX(msDeviceAccessMutex);
00050 #else
00051 #   define D3D9_DEVICE_ACCESS_LOCK  
00052 #   define D3D9_DEVICE_ACCESS_UNLOCK
00053 #   define D3D9_DEVICE_ACCESS_CRITICAL_SECTION
00054 #endif
00055 
00056 // Define versions for if DirectX is in use (Win32 only)
00057 #define DIRECT3D_VERSION 0x0900
00058 
00059 // some D3D commonly used macros
00060 #define SAFE_DELETE(p)       { if(p) { delete (p);     (p)=NULL; } }
00061 #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p);   (p)=NULL; } }
00062 #define SAFE_RELEASE(p)      { if(p) { (p)->Release(); (p)=NULL; } }
00063 
00064 // enable extended d3d debug 
00065 #if OGRE_DEBUG_MODE
00066 #   define D3D_DEBUG_INFO
00067 #endif
00068 
00069 #define WIN32_LEAN_AND_MEAN
00070 #if !defined(NOMINMAX) && defined(_MSC_VER)
00071 #   define NOMINMAX // required to stop windows.h messing up std::min
00072 #endif
00073 #include <d3d9.h>
00074 #include <d3dx9.h>
00075 #include <DxErr.h>
00076 
00077 
00078 namespace Ogre
00079 {
00080     // Predefine classes
00081     class D3D9DepthBuffer;
00082     class D3D9RenderSystem;
00083     class D3D9RenderWindow;
00084     class D3D9Texture;
00085     class D3D9TextureManager;
00086     class D3D9Driver;
00087     class D3D9DriverList;
00088     class D3D9VideoMode;
00089     class D3D9VideoModeList;
00090     class D3D9GpuProgram;
00091     class D3D9GpuProgramManager;
00092     class D3D9HardwareBufferManager;
00093     class D3D9HardwareIndexBuffer;
00094     class D3D9HLSLProgramFactory;
00095     class D3D9HLSLProgram;
00096     class D3D9VertexDeclaration;
00097     class D3D9Resource;
00098 
00099     typedef SharedPtr<D3D9GpuProgram>  D3D9GpuProgramPtr;
00100     typedef SharedPtr<D3D9HLSLProgram> D3D9HLSLProgramPtr;
00101     typedef SharedPtr<D3D9Texture>     D3D9TexturePtr;
00102 
00103 // Should we ask D3D to manage vertex/index buffers automatically?
00104 // Doing so avoids lost devices, but also has a performance impact
00105 // which is unacceptably bad when using very large buffers
00106 #define OGRE_D3D_MANAGE_BUFFERS 1
00107 
00108     //-------------------------------------------
00109     // Windows setttings
00110     //-------------------------------------------
00111 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(OGRE_STATIC_LIB)
00112 #   ifdef OGRED3DENGINEDLL_EXPORTS
00113 #       define _OgreD3D9Export __declspec(dllexport)
00114 #   else
00115 #       if defined( __MINGW32__ )
00116 #           define _OgreD3D9Export
00117 #       else
00118 #           define _OgreD3D9Export __declspec(dllimport)
00119 #       endif
00120 #   endif
00121 #else
00122 #   define _OgreD3D9Export
00123 #endif  // OGRE_WIN32
00124 }
00125 #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:42