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 __D3D11DEVICE_H__ 00029 #define __D3D11DEVICE_H__ 00030 00031 00032 #include "OgreD3D11Prerequisites.h" 00033 00034 namespace Ogre 00035 { 00036 class D3D11Device 00037 { 00038 private: 00039 ID3D11DeviceN * mD3D11Device; 00040 ID3D11DeviceContextN * mImmediateContext; 00041 ID3D11InfoQueue * mInfoQueue; 00042 00043 // Storing class linkage 00044 ID3D11ClassLinkage* mClassLinkage; 00045 00046 struct ThreadInfo 00047 { 00048 ID3D11DeviceContextN* mContext; 00049 void* mEventHandle; 00050 00051 ThreadInfo(ID3D11DeviceContextN* context) 00052 : mContext(context) 00053 , mEventHandle(0) 00054 { 00055 mEventHandle = CreateEventEx(0, TEXT("ThreadContextEvent"), 0, EVENT_ALL_ACCESS); 00056 } 00057 00058 ~ThreadInfo() 00059 { 00060 SAFE_RELEASE(mContext); 00061 00062 CloseHandle(mEventHandle); 00063 } 00064 }; 00065 00066 D3D11Device(); 00067 public: 00068 00069 00070 D3D11Device(ID3D11DeviceN * device); 00071 00072 ~D3D11Device(); 00073 00074 inline ID3D11DeviceContextN * GetImmediateContext() 00075 { 00076 return mImmediateContext; 00077 } 00078 00079 inline ID3D11ClassLinkage* GetClassLinkage() 00080 { 00081 return mClassLinkage; 00082 } 00083 00084 inline ID3D11DeviceN * operator->() const 00085 { 00086 assert(mD3D11Device); 00087 if (D3D_NO_EXCEPTION != mExceptionsErrorLevel) 00088 { 00089 clearStoredErrorMessages(); 00090 } 00091 return mD3D11Device; 00092 } 00093 00094 const void clearStoredErrorMessages( ) const; 00095 00096 ID3D11DeviceN * operator=(ID3D11DeviceN * device); 00097 const bool isNull(); 00098 const String getErrorDescription(const HRESULT hr = NO_ERROR) const; 00099 00100 inline const bool isError( ) const 00101 { 00102 if (D3D_NO_EXCEPTION == mExceptionsErrorLevel) 00103 { 00104 return false; 00105 } 00106 00107 return _getErrorsFromQueue(); 00108 } 00109 00110 const bool _getErrorsFromQueue() const; 00111 void release(); 00112 ID3D11DeviceN * get(); 00113 00114 enum eExceptionsErrorLevel 00115 { 00116 D3D_NO_EXCEPTION, 00117 D3D_CORRUPTION, 00118 D3D_ERROR, 00119 D3D_WARNING, 00120 D3D_INFO, 00121 }; 00122 00123 static eExceptionsErrorLevel mExceptionsErrorLevel; 00124 static void setExceptionsErrorLevel(const eExceptionsErrorLevel exceptionsErrorLevel); 00125 static const eExceptionsErrorLevel getExceptionsErrorLevel(); 00126 00127 00128 }; 00129 } 00130 #endif
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:41