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