gfxD3D11PrimitiveBuffer.h
Engine/source/gfx/D3D11/gfxD3D11PrimitiveBuffer.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 _GFXD3D11PRIMITIVEBUFFER_H_ 25#define _GFXD3D11PRIMITIVEBUFFER_H_ 26 27#include "gfx/gfxPrimitiveBuffer.h" 28 29class GFXD3D11PrimitiveBuffer : public GFXPrimitiveBuffer 30{ 31public: 32 ID3D11Buffer *ib; 33 StrongRefPtr<GFXD3D11PrimitiveBuffer> mVolatileBuffer; 34 U32 mVolatileStart; 35 U32 mIndexStart; 36 U32 mIndexEnd; 37 38#ifdef TORQUE_DEBUG 39 #define _PBGuardString "GFX_PRIMTIVE_BUFFER_GUARD_STRING" 40 U8 *mDebugGuardBuffer; 41 U32 mLockedSize; 42#endif TORQUE_DEBUG 43 44 void *mLockedBuffer; 45 bool mLocked; 46 bool mIsFirstLock; 47 48 GFXD3D11PrimitiveBuffer( GFXDevice *device, 49 U32 indexCount, 50 U32 primitiveCount, 51 GFXBufferType bufferType ); 52 53 virtual ~GFXD3D11PrimitiveBuffer(); 54 55 virtual void lock(U32 indexStart, U32 indexEnd, void **indexPtr); 56 virtual void unlock(); 57 58 virtual void prepare(); 59 60 // GFXResource interface 61 virtual void zombify(); 62 virtual void resurrect(); 63}; 64 65inline GFXD3D11PrimitiveBuffer::GFXD3D11PrimitiveBuffer( GFXDevice *device, 66 U32 indexCount, 67 U32 primitiveCount, 68 GFXBufferType bufferType ) 69 : GFXPrimitiveBuffer( device, indexCount, primitiveCount, bufferType ) 70{ 71 mVolatileStart = 0; 72 ib = NULL; 73 mIsFirstLock = true; 74 mLocked = false; 75#ifdef TORQUE_DEBUG 76 mDebugGuardBuffer = NULL; 77 mLockedSize = 0; 78#endif 79 mIndexStart = 0; 80 mIndexEnd = 0; 81 mLockedBuffer = NULL; 82} 83 84#endif 85