gfxD3D11TextureObject.h
Engine/source/gfx/D3D11/gfxD3D11TextureObject.h
Classes:
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2015 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _GFXD3D11TEXTUREOBJECT_H_ 25#define _GFXD3D11TEXTUREOBJECT_H_ 26 27#include "gfx/D3D11/gfxD3D11Device.h" 28#include "gfx/gfxTextureHandle.h" 29#include "gfx/gfxTextureManager.h" 30 31class GFXD3D11TextureObject : public GFXTextureObject 32{ 33protected: 34 static U32 mTexCount; 35 GFXTexHandle mStagingTex; 36 DXGI_MAPPED_RECT mLockRect; 37 D3D11_BOX mLockBox; 38 bool mLocked; 39 40 U32 mLockedSubresource; 41 ID3D11Resource *mD3DTexture; 42 43 // used for z buffers... 44 ID3D11Texture2D *mD3DSurface; 45 46 ID3D11ShaderResourceView* mSRView; // for shader resource input 47 ID3D11RenderTargetView* mRTView; // for render targets 48 ID3D11DepthStencilView* mDSView; //render target view for depth stencil 49 50public: 51 52 GFXD3D11TextureObject( GFXDevice * d, GFXTextureProfile *profile); 53 ~GFXD3D11TextureObject(); 54 55 ID3D11Resource* getResource(){ return mD3DTexture; } 56 ID3D11Texture2D* get2DTex(){ return (ID3D11Texture2D*) mD3DTexture; } 57 ID3D11Texture2D** get2DTexPtr(){ return (ID3D11Texture2D**) &mD3DTexture; } 58 ID3D11Texture3D* get3DTex(){ return (ID3D11Texture3D*) mD3DTexture; } 59 ID3D11Texture3D** get3DTexPtr(){ return (ID3D11Texture3D**) &mD3DTexture; } 60 61 ID3D11ShaderResourceView* getSRView(); 62 ID3D11RenderTargetView* getRTView(); 63 ID3D11DepthStencilView* getDSView(); 64 65 ID3D11ShaderResourceView** getSRViewPtr(); 66 ID3D11RenderTargetView** getRTViewPtr(); 67 ID3D11DepthStencilView** getDSViewPtr(); 68 69 70 void release(); 71 72 bool isManaged; //setting to true tells this texture not to be released from being zombify 73 74 virtual GFXLockedRect * lock(U32 mipLevel = 0, RectI *inRect = NULL); 75 virtual void unlock(U32 mipLevel = 0 ); 76 77 virtual bool copyToBmp(GBitmap* bmp); 78 ID3D11Texture2D* getSurface() {return mD3DSurface;} 79 ID3D11Texture2D** getSurfacePtr() {return &mD3DSurface;} 80 81 // GFXResource 82 void zombify(); 83 void resurrect(); 84 85#ifdef TORQUE_DEBUG 86 virtual void pureVirtualCrash() {}; 87#endif 88}; 89 90 91#endif 92