From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03691.html | 716 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 716 insertions(+) create mode 100644 docs/doxygen/nel/a03691.html (limited to 'docs/doxygen/nel/a03691.html') diff --git a/docs/doxygen/nel/a03691.html b/docs/doxygen/nel/a03691.html new file mode 100644 index 00000000..774c31e6 --- /dev/null +++ b/docs/doxygen/nel/a03691.html @@ -0,0 +1,716 @@ + + +NeL: NL3D::CVertexArrayRangeNVidia class Reference + + + +
+

NL3D::CVertexArrayRangeNVidia Class Reference

#include <driver_opengl_vertex_buffer_hard.h> +

+

Inheritance diagram for NL3D::CVertexArrayRangeNVidia: +

+ +NL3D::IVertexArrayRange + +

Detailed Description

+Work only if ARRAY_RANGE_NV is enabled. else, only call to ctor/dtor/free() is valid. any call to allocateVB() will return NULL. +

+ +

+Definition at line 127 of file driver_opengl_vertex_buffer_hard.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 CVertexArrayRangeNVidia (CDriverGL *drv)
void disable ()
 disable this VertexArrayRange. _Driver->_CurrentVertexArrayRange= NULL;

void enable ()
 active this VertexArrayRange as the current vertex array range used. no-op if already setup.

void freeVB (void *ptr)
 free a VB allocated with allocateVB. No-op if NULL.

Implementation
virtual bool allocate (uint32 size, IDriver::TVBHardType vbType)
 allocate a vertex array sapce. false if error. must free before re-allocate.

virtual IVertexBufferHardGLcreateVBHardGL (uint16 vertexFormat, const uint8 *typeArray, uint32 numVertices, const uint8 *uvRouting)
 create a IVertexBufferHardGL

virtual void free ()
 free this space.

virtual uint sizeAllocated () const
 return the size allocated. 0 if not allocated or failure


Protected Attributes

CDriverGL_Driver

Private Member Functions

bool allocated () const
 true if allocated.

void * allocateVB (uint32 size)
 Allocate a small subset of the memory. NULL if not enough mem.


Private Attributes

NLMISC::CHeapMemory _HeapMemory
void * _VertexArrayPtr
uint32 _VertexArraySize
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + +
NL3D::CVertexArrayRangeNVidia::CVertexArrayRangeNVidia CDriverGL drv  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 93 of file driver_opengl_vertex_buffer_hard.cpp. +

+References _VertexArrayPtr, and _VertexArraySize. +

+

00093                                                                : IVertexArrayRange(drv)
+00094 {
+00095         _VertexArrayPtr= NULL;
+00096         _VertexArraySize= 0;
+00097 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NL3D::CVertexArrayRangeNVidia::allocate uint32  size,
IDriver::TVBHardType  vbType
[virtual]
+
+ + + + + +
+   + + +

+allocate a vertex array sapce. false if error. must free before re-allocate. +

+ +

+Implements NL3D::IVertexArrayRange. +

+Definition at line 101 of file driver_opengl_vertex_buffer_hard.cpp. +

+References _HeapMemory, _VertexArrayPtr, _VertexArraySize, NLMISC::CHeapMemory::initHeap(), nlassert, size, and uint32. +

+

00102 {
+00103         nlassert(_VertexArrayPtr==NULL);
+00104 
+00105 #ifdef  NL_OS_WINDOWS
+00106         // try to allocate AGP or VRAM data.
+00107         switch(vbType)
+00108         {
+00109         case IDriver::VBHardAGP: 
+00110                 _VertexArrayPtr= wglAllocateMemoryNV(size, 0, 0, 0.5f);
+00111                 break;
+00112         case IDriver::VBHardVRAM:
+00113                 _VertexArrayPtr= wglAllocateMemoryNV(size, 0, 0, 1.0f);
+00114                 break;
+00115         };
+00116 #endif  // NL_OS_WINDOWS
+00117 
+00118 
+00119         // init the allocator.
+00120         if(_VertexArrayPtr)
+00121         {
+00122                 /* Init with an alignment of 8. Not sure it is usefull, but GDC01_Performance.pdf papers talks about
+00123                   "Data arrays must be 8-byte aligned". Don't know what "Data" is.
+00124                 */
+00125                 _HeapMemory.initHeap(_VertexArrayPtr, size, 8);
+00126 
+00127                 // set the size
+00128                 _VertexArraySize= size;
+00129         }
+00130 
+00131 
+00132         return _VertexArrayPtr!=NULL;
+00133 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CVertexArrayRangeNVidia::allocated  )  const [inline, private]
+
+ + + + + +
+   + + +

+true if allocated. +

+ +

+Definition at line 165 of file driver_opengl_vertex_buffer_hard.h. +

+References _VertexArrayPtr. +

+Referenced by createVBHardGL(). +

+

00165 {return _VertexArrayPtr!=NULL;}
+
+

+ + + + +
+ + + + + + + + + + +
void * NL3D::CVertexArrayRangeNVidia::allocateVB uint32  size  )  [private]
+
+ + + + + +
+   + + +

+Allocate a small subset of the memory. NULL if not enough mem. +

+ +

+Definition at line 205 of file driver_opengl_vertex_buffer_hard.cpp. +

+References _HeapMemory, NLMISC::CHeapMemory::allocate(), size, and uint32. +

+Referenced by createVBHardGL(). +

+

00206 {
+00207         return _HeapMemory.allocate(size);
+00208 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IVertexBufferHardGL * NL3D::CVertexArrayRangeNVidia::createVBHardGL uint16  vertexFormat,
const uint8 typeArray,
uint32  numVertices,
const uint8 uvRouting
[virtual]
+
+ + + + + +
+   + + +

+create a IVertexBufferHardGL +

+ +

+Implements NL3D::IVertexArrayRange. +

+Definition at line 219 of file driver_opengl_vertex_buffer_hard.cpp. +

+References allocated(), allocateVB(), NL3D::IVertexBufferHard::getNumVertices(), NL3D::IVertexBufferHard::getVertexSize(), NL3D::IVertexBufferHardGL::initFormat(), NL3D::CVertexBufferHardGLNVidia::initGL(), size, uint16, uint32, and uint8. +

+

00220 {
+00221         // create a NVidia VBHard
+00222         CVertexBufferHardGLNVidia       *newVbHard= new CVertexBufferHardGLNVidia(_Driver);
+00223 
+00224         // Init the format of the VB.
+00225         newVbHard->initFormat(vertexFormat, typeArray, numVertices, uvRouting);
+00226 
+00227         // compute size to allocate.
+00228         uint32  size= newVbHard->getVertexSize() * newVbHard->getNumVertices();
+00229 
+00230         // try to allocate
+00231         void    *vertexPtr;
+00232         if( allocated() )
+00233         {
+00234                  vertexPtr= allocateVB(size);
+00235         }
+00236 
+00237         // If allocation fails.
+00238         if( !vertexPtr )
+00239         {
+00240                 // just destroy this object (no free()).
+00241                 delete newVbHard;
+00242                 return NULL;
+00243         }
+00244         else
+00245         {
+00246                 // Ok, setup, and allocate the fence.
+00247                 newVbHard->initGL(this, vertexPtr);
+00248                 return newVbHard;
+00249         }
+00250 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CVertexArrayRangeNVidia::disable  ) 
+
+ + + + + +
+   + + +

+disable this VertexArrayRange. _Driver->_CurrentVertexArrayRange= NULL; +

+ +

+Definition at line 191 of file driver_opengl_vertex_buffer_hard.cpp. +

+References NL3D::CDriverGL::_CurrentVertexArrayRange, NL3D::CDriverGL::_Extensions, and NL3D::CGlExtensions::NVStateVARWithoutFlush. +

+Referenced by NL3D::CVertexBufferHardGLNVidia::disable(). +

+

00192 {
+00193         // if not already disabled.
+00194         if(_Driver->_CurrentVertexArrayRange!=NULL)
+00195         {
+00196                 // just disable the state, don't change VAR ptr setup.
+00197                 // NB: flush is unesufull, so don't flush if extension is OK
+00198                 glDisableClientState(_Driver->_Extensions.NVStateVARWithoutFlush);
+00199                 _Driver->_CurrentVertexArrayRange= NULL;
+00200         }
+00201 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CVertexArrayRangeNVidia::enable  ) 
+
+ + + + + +
+   + + +

+active this VertexArrayRange as the current vertex array range used. no-op if already setup. +

+ +

+Definition at line 166 of file driver_opengl_vertex_buffer_hard.cpp. +

+References NL3D::CDriverGL::_CurrentVertexArrayRange, NL3D::CDriverGL::_Extensions, NL3D::CDriverGL::_NVCurrentVARPtr, NL3D::CDriverGL::_NVCurrentVARSize, _VertexArrayPtr, _VertexArraySize, nglVertexArrayRangeNV, and NL3D::CGlExtensions::NVStateVARWithoutFlush. +

+Referenced by NL3D::CVertexBufferHardGLNVidia::enable(). +

+

00167 {
+00168         // if not already enabled.
+00169         if(_Driver->_CurrentVertexArrayRange!=this)
+00170         {
+00171                 // Setup the ptrs only if differnets from last time (may rarely happens)
+00172                 if( _Driver->_NVCurrentVARSize != _VertexArraySize || _Driver->_NVCurrentVARPtr != _VertexArrayPtr)
+00173                 {
+00174                         // Yoyo: fucking NVidia Bug ?? must do this strange thing, this ensure that it is correclty setuped.
+00175                         glFinish();
+00176                         nglVertexArrayRangeNV(_VertexArraySize, _VertexArrayPtr);
+00177                         glEnableClientState(GL_VERTEX_ARRAY_RANGE_NV);
+00178                         glVertexPointer(3,GL_FLOAT, 0, _VertexArrayPtr);
+00179                         // cache.
+00180                         _Driver->_NVCurrentVARSize= _VertexArraySize;
+00181                         _Driver->_NVCurrentVARPtr= _VertexArrayPtr;
+00182                 }
+00183                 // enable VAR. NB: flush is unesufull, so don't flush if extension is OK
+00184                 glEnableClientState(_Driver->_Extensions.NVStateVARWithoutFlush);
+00185                 _Driver->_CurrentVertexArrayRange= this;
+00186         }
+00187 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CVertexArrayRangeNVidia::free  )  [virtual]
+
+ + + + + +
+   + + +

+free this space. +

+ +

+Implements NL3D::IVertexArrayRange. +

+Definition at line 144 of file driver_opengl_vertex_buffer_hard.cpp. +

+References _HeapMemory, _VertexArrayPtr, _VertexArraySize, and NLMISC::CHeapMemory::reset(). +

+

00145 {
+00146         // release the ptr.
+00147         if(_VertexArrayPtr)
+00148         {
+00149                 // reset the allocator.
+00150                 _HeapMemory.reset();
+00151 
+00152 
+00153                 // Free special memory.
+00154 #ifdef  NL_OS_WINDOWS
+00155                 wglFreeMemoryNV(_VertexArrayPtr);
+00156 #endif  // NL_OS_WINDOWS
+00157 
+00158 
+00159                 _VertexArrayPtr= NULL;
+00160                 _VertexArraySize= 0;
+00161         }
+00162 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CVertexArrayRangeNVidia::freeVB void *  ptr  ) 
+
+ + + + + +
+   + + +

+free a VB allocated with allocateVB. No-op if NULL. +

+ +

+Definition at line 212 of file driver_opengl_vertex_buffer_hard.cpp. +

+References _HeapMemory, and NLMISC::CHeapMemory::free(). +

+Referenced by NL3D::CVertexBufferHardGLNVidia::~CVertexBufferHardGLNVidia(). +

+

00213 {
+00214         _HeapMemory.free(ptr);
+00215 }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CVertexArrayRangeNVidia::sizeAllocated  )  const [virtual]
+
+ + + + + +
+   + + +

+return the size allocated. 0 if not allocated or failure +

+ +

+Implements NL3D::IVertexArrayRange. +

+Definition at line 137 of file driver_opengl_vertex_buffer_hard.cpp. +

+References _VertexArraySize, and uint. +

+

00138 {
+00139         return _VertexArraySize;
+00140 }
+
+


Field Documentation

+

+ + + + +
+ + +
CDriverGL* NL3D::IVertexArrayRange::_Driver [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 69 of file driver_opengl_vertex_buffer_hard.h.

+

+ + + + +
+ + +
NLMISC::CHeapMemory NL3D::CVertexArrayRangeNVidia::_HeapMemory [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 162 of file driver_opengl_vertex_buffer_hard.h. +

+Referenced by allocate(), allocateVB(), free(), and freeVB().

+

+ + + + +
+ + +
void* NL3D::CVertexArrayRangeNVidia::_VertexArrayPtr [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 158 of file driver_opengl_vertex_buffer_hard.h. +

+Referenced by allocate(), allocated(), CVertexArrayRangeNVidia(), enable(), and free().

+

+ + + + +
+ + +
uint32 NL3D::CVertexArrayRangeNVidia::_VertexArraySize [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 159 of file driver_opengl_vertex_buffer_hard.h. +

+Referenced by allocate(), CVertexArrayRangeNVidia(), enable(), free(), and sizeAllocated().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 08:23:14 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1