Torque3D Documentation / _generateds / gfxD3D11VertexBuffer.h

gfxD3D11VertexBuffer.h

Engine/source/gfx/D3D11/gfxD3D11VertexBuffer.h

More...

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 _GFXD3D_VERTEXBUFFER_H_
25#define _GFXD3D_VERTEXBUFFER_H_
26
27#include "gfx/D3D11/gfxD3D11Device.h"
28#include "core/util/safeDelete.h"
29
30class GFXD3D11VertexBuffer : public GFXVertexBuffer
31{
32public:
33   ID3D11Buffer *vb;
34   StrongRefPtr<GFXD3D11VertexBuffer> mVolatileBuffer;
35   void *mLockedBuffer;
36#ifdef TORQUE_DEBUG
37   #define _VBGuardString "GFX_VERTEX_BUFFER_GUARD_STRING"
38   U8 *mDebugGuardBuffer;
39   
40#endif TORQUE_DEBUG
41
42   bool mIsFirstLock;
43   bool mClearAtFrameEnd;
44
45   GFXD3D11VertexBuffer();
46   GFXD3D11VertexBuffer( GFXDevice *device, 
47                        U32 numVerts, 
48                        const GFXVertexFormat *vertexFormat,
49                        U32 vertexSize, 
50                        GFXBufferType bufferType );
51   virtual ~GFXD3D11VertexBuffer();
52
53   void lock(U32 vertexStart, U32 vertexEnd, void **vertexPtr);
54   void unlock();
55   void prepare() {}
56
57   // GFXResource interface
58   virtual void zombify();
59   virtual void resurrect();
60};
61
62//-----------------------------------------------------------------------------
63// This is for debugging vertex buffers and trying to track down which vbs
64// aren't getting free'd
65
66inline GFXD3D11VertexBuffer::GFXD3D11VertexBuffer() : GFXVertexBuffer(0,0,0,0,(GFXBufferType)0)
67{
68   vb = NULL;
69   mIsFirstLock = true;
70   lockedVertexEnd = lockedVertexStart = 0;
71   mClearAtFrameEnd = false;
72   mLockedBuffer = NULL;
73
74#ifdef TORQUE_DEBUG
75   mDebugGuardBuffer = NULL;
76#endif
77}
78
79inline GFXD3D11VertexBuffer::GFXD3D11VertexBuffer(   GFXDevice *device, 
80                                                   U32 numVerts, 
81                                                   const GFXVertexFormat *vertexFormat, 
82                                                   U32 vertexSize, 
83                                                   GFXBufferType bufferType )
84   : GFXVertexBuffer( device, numVerts, vertexFormat, vertexSize, bufferType )
85{
86   vb = NULL;
87   mIsFirstLock = true;
88   mClearAtFrameEnd = false;
89   lockedVertexEnd = lockedVertexStart = 0;
90   mLockedBuffer = NULL;
91#ifdef TORQUE_DEBUG
92   mDebugGuardBuffer = NULL;   
93#endif
94}
95
96#endif // _GFXD3D_VERTEXBUFFER_H_
97