#include <driver_opengl_vertex_buffer_hard.h>
Inheritance diagram for NL3D::CVertexBufferHardGLNVidia:
Definition at line 175 of file driver_opengl_vertex_buffer_hard.h.
Public Types | |
enum | TVBType { NVidiaVB, ATIVB, ATIMapObjectVB, UnknownVB } |
Public Member Functions | |
CVertexBufferHardGLNVidia (CDriverGL *drv) | |
void | finishFence () |
bool | getLockHintStatic () const |
void * | getNVidiaValueEx (uint value) |
const sint & | getRefCount () const |
void | initFormat (uint16 vertexFormat, const uint8 *typeArray, uint32 numVertices, const uint8 *uvRouting) |
void | initGL (CVertexArrayRangeNVidia *var, void *vertexPtr) |
bool | isFenceSet () const |
void | setFence () |
void | testFence () |
virtual | ~CVertexBufferHardGLNVidia () |
Profiling. Each VBHard has a name to profile its lock. | |
const std::string & | getName () const |
void | setName (const std::string &name) |
Misc Get. | |
uint32 | getNumVertices (void) const |
uint8 | getNumWeight () const |
const uint8 * | getUVRouting () const |
CVertexBuffer::TType | getValueType (uint value) const |
uint16 | getVertexFormat (void) const |
uint16 | getVertexSize (void) const |
Get component offsets. | |
sint | getValueOff (uint value) const |
Profiling. Each VBHard has a name to profile its lock. | |
const std::string & | getName () const |
void | setName (const std::string &name) |
Misc Get. | |
uint32 | getNumVertices (void) const |
uint8 | getNumWeight () const |
const uint8 * | getUVRouting () const |
CVertexBuffer::TType | getValueType (uint value) const |
uint16 | getVertexFormat (void) const |
uint16 | getVertexSize (void) const |
Get component offsets. | |
sint | getValueOff (uint value) const |
Implementation | |
virtual void | disable () |
virtual void | enable () |
virtual void * | lock () |
virtual void | lockHintStatic (bool staticLock) |
virtual void | unlock (uint startVert, uint endVert) |
virtual void | unlock () |
Profiling. Each VBHard has a name to profile its lock. | |
const std::string & | getName () const |
void | setName (const std::string &name) |
Misc Get. | |
uint32 | getNumVertices (void) const |
uint8 | getNumWeight () const |
const uint8 * | getUVRouting () const |
CVertexBuffer::TType | getValueType (uint value) const |
uint16 | getVertexFormat (void) const |
uint16 | getVertexSize (void) const |
Get component offsets. | |
sint | getValueOff (uint value) const |
Profiling. Each VBHard has a name to profile its lock. | |
const std::string & | getName () const |
void | setName (const std::string &name) |
Misc Get. | |
uint32 | getNumVertices (void) const |
uint8 | getNumWeight () const |
const uint8 * | getUVRouting () const |
CVertexBuffer::TType | getValueType (uint value) const |
uint16 | getVertexFormat (void) const |
uint16 | getVertexSize (void) const |
Get component offsets. | |
sint | getValueOff (uint value) const |
Profiling. Each VBHard has a name to profile its lock. | |
const std::string & | getName () const |
void | setName (const std::string &name) |
Misc Get. | |
uint32 | getNumVertices (void) const |
uint8 | getNumWeight () const |
const uint8 * | getUVRouting () const |
CVertexBuffer::TType | getValueType (uint value) const |
uint16 | getVertexFormat (void) const |
uint16 | getVertexSize (void) const |
Get component offsets. | |
sint | getValueOff (uint value) const |
Data Fields | |
sint | crefs |
bool | GPURenderingAfterFence |
CPtrInfo * | pinfo |
TVBType | VBType |
Static Public Attributes | |
CPtrInfo | NullPtrInfo |
Protected Attributes | |
CDriverGL * | _Driver |
uint16 | _Flags |
uint16 | _InternalFlags |
std::string | _Name |
uint32 | _NbVerts |
uint16 | _Offset [CVertexBuffer::NumValue] |
uint8 | _Pad |
uint8 | _Type [CVertexBuffer::NumValue] |
uint8 | _UVRouting [CVertexBuffer::MaxStage] |
uint16 | _VertexSize |
Private Attributes | |
GLuint | _Fence |
bool | _FenceSet |
bool | _LockHintStatic |
CVertexArrayRangeNVidia * | _VertexArrayRange |
void * | _VertexPtr |
Friends | |
struct | CPtrInfo |
|
Definition at line 95 of file driver_opengl_vertex_buffer_hard.h.
00095 { NVidiaVB, ATIVB, ATIMapObjectVB, UnknownVB }; |
|
Definition at line 259 of file driver_opengl_vertex_buffer_hard.cpp. References _FenceSet, _LockHintStatic, _VertexArrayRange, and _VertexPtr.
00259 : IVertexBufferHardGL(drv) 00260 { 00261 _VertexArrayRange= NULL; 00262 _VertexPtr= NULL; 00263 00264 GPURenderingAfterFence= false; 00265 _FenceSet= false; 00266 00267 // Flag our type 00268 VBType = NVidiaVB; 00269 00270 // default: dynamic Loick 00271 _LockHintStatic= false; 00272 } |
|
Definition at line 276 of file driver_opengl_vertex_buffer_hard.cpp. References _Fence, _VertexArrayRange, _VertexPtr, finishFence(), NL3D::CVertexArrayRangeNVidia::freeVB(), and nglDeleteFencesNV.
00277 { 00278 if(_VertexArrayRange) 00279 { 00280 // Destroy Fence. 00281 // First wait for completion. 00282 finishFence(); 00283 // then delete. 00284 nglDeleteFencesNV(1, &_Fence); 00285 00286 // Then free the VAR. 00287 _VertexArrayRange->freeVB(_VertexPtr); 00288 _VertexPtr= NULL; 00289 _VertexArrayRange= NULL; 00290 } 00291 } |
|
Implements NL3D::IVertexBufferHardGL. Definition at line 366 of file driver_opengl_vertex_buffer_hard.cpp. References NL3D::CDriverGL::_CurrentVertexBufferHard, _VertexArrayRange, NL3D::CVertexArrayRangeNVidia::disable(), and nlassert.
00367 { 00368 if(_Driver->_CurrentVertexBufferHard != NULL) 00369 { 00370 nlassert(_VertexArrayRange); 00371 _VertexArrayRange->disable(); 00372 _Driver->_CurrentVertexBufferHard= NULL; 00373 } 00374 } |
|
Implements NL3D::IVertexBufferHardGL. Definition at line 354 of file driver_opengl_vertex_buffer_hard.cpp. References NL3D::CDriverGL::_CurrentVertexBufferHard, _VertexArrayRange, NL3D::CVertexArrayRangeNVidia::enable(), and nlassert.
00355 { 00356 if(_Driver->_CurrentVertexBufferHard != this) 00357 { 00358 nlassert(_VertexArrayRange); 00359 _VertexArrayRange->enable(); 00360 _Driver->_CurrentVertexBufferHard= this; 00361 } 00362 } |
|
Definition at line 392 of file driver_opengl_vertex_buffer_hard.cpp. References _Fence, _FenceSet, isFenceSet(), and nglFinishFenceNV. Referenced by lock(), and ~CVertexBufferHardGLNVidia().
00393 { 00394 if(isFenceSet()) 00395 { 00396 // Stall CPU while the fence command is not reached in the GPU command stream. 00397 nglFinishFenceNV(_Fence); 00398 _FenceSet= false; 00399 } 00400 } |
|
Definition at line 207 of file driver_opengl_vertex_buffer_hard.h. References _LockHintStatic. Referenced by NL3D::CDriverGL::fenceOnCurVBHardIfNeeded().
00207 {return _LockHintStatic;} |
|
Definition at line 120 of file vertex_buffer_hard.h. Referenced by NL3D::CDriverGL::profileVBHardAllocation().
00120 {return _Name;} |
|
|
Definition at line 76 of file vertex_buffer_hard.cpp. References uint8. Referenced by NL3D::CVertexBufferInfo::setupVertexBufferHard().
00077 { 00078 // Num weight 00079 switch (_Type[CVertexBuffer::Weight]) 00080 { 00081 case CVertexBuffer::Float1: 00082 return 1; 00083 case CVertexBuffer::Float2: 00084 return 2; 00085 case CVertexBuffer::Float3: 00086 return 3; 00087 case CVertexBuffer::Float4: 00088 return 4; 00089 } 00090 00091 // No weight 00092 return 0; 00093 } |
|
Definition at line 210 of file driver_opengl_vertex_buffer_hard.h. References _VertexPtr, NL3D::IVertexBufferHard::getValueOff(), nlassert, uint, uint8, and value. Referenced by NL3D::CVertexBufferInfo::setupVertexBufferHard().
00211 { 00212 nlassert(_VertexPtr); 00213 return (uint8*)_VertexPtr + getValueOff (value); 00214 } |
|
Definition at line 70 of file smart_ptr.h. References NLMISC::CRefCount::crefs, and sint.
00071 { 00072 return crefs; 00073 } |
|
Definition at line 57 of file vertex_buffer_hard.h. References uint8. Referenced by NL3D::CVertexBufferInfo::setupVertexBufferHard().
00057 { return _UVRouting; } |
|
NB: the order of those methods follow the order in memory of the elements:
Definition at line 82 of file vertex_buffer_hard.h. References nlassert, sint, uint, and value. Referenced by NL3D::CVertexBufferHardGLMapObjectATI::getATIValueOffset(), NL3D::CVertexBufferHardGLATI::getATIValueOffset(), getNVidiaValueEx(), NL3D::CNearVertexBufferInfo::setupVertexBufferHard(), and NL3D::CFarVertexBufferInfo::setupVertexBufferHard().
|
|
Definition at line 55 of file vertex_buffer_hard.h. References nlassert, uint, and value. Referenced by NL3D::CVertexBufferInfo::setupVertexBufferHard().
|
|
Definition at line 52 of file vertex_buffer_hard.h. References uint16. Referenced by NL3D::CDriverGL::activeVertexBufferHard(), NL3D::CNearVertexBufferInfo::setupVertexBufferHard(), NL3D::CFarVertexBufferInfo::setupVertexBufferHard(), and NL3D::CVertexBufferInfo::setupVertexBufferHard().
00052 { return(_Flags); } |
|
|
Reimplemented from NL3D::IVertexBufferHard. Definition at line 104 of file driver_opengl_vertex_buffer_hard.h. References uint16, uint32, and uint8. Referenced by NL3D::CVertexArrayRangeMapObjectATI::createVBHardGL(), NL3D::CVertexArrayRangeATI::createVBHardGL(), and NL3D::CVertexArrayRangeNVidia::createVBHardGL().
00105 { 00106 IVertexBufferHard::initFormat(vertexFormat, typeArray, numVertices, uvRouting); 00107 } |
|
Definition at line 295 of file driver_opengl_vertex_buffer_hard.cpp. References _Fence, _VertexArrayRange, _VertexPtr, and nglGenFencesNV. Referenced by NL3D::CVertexArrayRangeNVidia::createVBHardGL().
00296 { 00297 _VertexArrayRange= var; 00298 _VertexPtr= vertexPtr; 00299 nglGenFencesNV(1, &_Fence); 00300 } |
|
Definition at line 199 of file driver_opengl_vertex_buffer_hard.h. References _FenceSet. Referenced by finishFence(), NL3D::CDriverGL::swapBuffers(), and testFence().
00199 {return _FenceSet;} |
|
Lock the entire VertexBuffer. The returned buffer is a write only buffer. (undefined result if you read it). Write note:
Implements NL3D::IVertexBufferHard. Definition at line 304 of file driver_opengl_vertex_buffer_hard.cpp. References _LockHintStatic, NL3D::CDriverGL::_VBHardProfiling, _VertexPtr, NL3D::CDriverGL::appendVBHardLockProfile(), finishFence(), setFence(), and NLMISC::TTicks.
00305 { 00306 // sync the 3d card with the system. 00307 00308 // If the user lock an activated VBHard, after rendering some primitives, we must stall the CPU 00309 // Also always do this for Static Lock VBHard (because no setFence are inserted after rendering 00310 if(GPURenderingAfterFence || _LockHintStatic) 00311 { 00312 // Set a new fence at the current position in the command stream, replacing the old one 00313 setFence(); 00314 // And so the GPU has rendered all our primitives. 00315 GPURenderingAfterFence= false; 00316 } 00317 00318 // Lock Profile? 00319 TTicks beforeLock; 00320 if(_Driver->_VBHardProfiling) 00321 { 00322 beforeLock= CTime::getPerformanceTime(); 00323 } 00324 00325 // Ensure the GPU has finished with the current VBHard. 00326 finishFence(); 00327 00328 // Lock Profile? 00329 if(_Driver->_VBHardProfiling) 00330 { 00331 TTicks afterLock; 00332 afterLock= CTime::getPerformanceTime(); 00333 _Driver->appendVBHardLockProfile(afterLock-beforeLock, this); 00334 } 00335 00336 return _VertexPtr; 00337 } |
|
Indicate what kind of lock to be done on this VertexBuffer (whatever AGP or VRAM buffer) User should set to true if the VBHard is static: nevers change or very rarely. NVidia OpenGL implementation: "Static lock" are slower, but no fences are inserted after a render with this VVBHard, hence, no slowdown because 1/ of fence overhead insertion 2/ of NVidia swapBuffers() and fence issues on GeForce2 cards. Default is false Implements NL3D::IVertexBufferHard. Definition at line 377 of file driver_opengl_vertex_buffer_hard.cpp. References _LockHintStatic.
00378 { 00379 // Store the flag. 00380 _LockHintStatic= staticLock; 00381 } |
|
Definition at line 384 of file driver_opengl_vertex_buffer_hard.cpp. References _Fence, _FenceSet, GL_ALL_COMPLETED_NV, and nglSetFenceNV. Referenced by NL3D::CDriverGL::fenceOnCurVBHardIfNeeded(), and lock().
00385 { 00386 // NB: if the Fence was set and not finished, then the new one will KICK the old. 00387 nglSetFenceNV(_Fence, GL_ALL_COMPLETED_NV); 00388 _FenceSet= true; 00389 } |
|
Definition at line 96 of file vertex_buffer_hard.cpp.
00097 { 00098 _Name= name; 00099 } |
|
Definition at line 403 of file driver_opengl_vertex_buffer_hard.cpp. References _Fence, _FenceSet, GLboolean(), isFenceSet(), and nglTestFenceNV. Referenced by NL3D::CDriverGL::swapBuffers().
00404 { 00405 if(isFenceSet()) 00406 { 00407 // Don't stall the CPU 00408 GLboolean b= nglTestFenceNV(_Fence); 00409 // if completed 00410 if(b==GL_TRUE) 00411 _FenceSet= false; 00412 } 00413 } |
|
Same as unlock() but give hints to driver on vertices that have changed. Used by ATI-OpenGL drivers. NB: driver may still ignore this information, and so take into acount all vertices
Implements NL3D::IVertexBufferHard. Definition at line 347 of file driver_opengl_vertex_buffer_hard.cpp. References uint.
00348 { 00349 // no op. 00350 // NB: start-end only usefull for ATI ext. 00351 } |
|
UnLock the VertexBuffer so the Gfx card can now use it. Implements NL3D::IVertexBufferHard. Definition at line 341 of file driver_opengl_vertex_buffer_hard.cpp.
00342 {
00343 // no op.
00344 }
|
|
Definition at line 67 of file smart_ptr.h. |
|
Definition at line 111 of file driver_opengl_vertex_buffer_hard.h. |
|
Definition at line 223 of file driver_opengl_vertex_buffer_hard.h. Referenced by finishFence(), initGL(), setFence(), testFence(), and ~CVertexBufferHardGLNVidia(). |
|
Definition at line 225 of file driver_opengl_vertex_buffer_hard.h. Referenced by CVertexBufferHardGLNVidia(), finishFence(), isFenceSet(), setFence(), and testFence(). |
|
Definition at line 134 of file vertex_buffer_hard.h. |
|
Definition at line 137 of file vertex_buffer_hard.h. |
|
Definition at line 227 of file driver_opengl_vertex_buffer_hard.h. Referenced by CVertexBufferHardGLNVidia(), getLockHintStatic(), lock(), and lockHintStatic(). |
|
Definition at line 146 of file vertex_buffer_hard.h. |
|
Definition at line 140 of file vertex_buffer_hard.h. |
|
Definition at line 143 of file vertex_buffer_hard.h. |
|
Definition at line 128 of file vertex_buffer_hard.h. |
|
Definition at line 127 of file vertex_buffer_hard.h. |
|
Definition at line 153 of file vertex_buffer_hard.h. |
|
Definition at line 219 of file driver_opengl_vertex_buffer_hard.h. Referenced by CVertexBufferHardGLNVidia(), disable(), enable(), initGL(), and ~CVertexBufferHardGLNVidia(). |
|
Definition at line 220 of file driver_opengl_vertex_buffer_hard.h. Referenced by CVertexBufferHardGLNVidia(), getNVidiaValueEx(), initGL(), lock(), and ~CVertexBufferHardGLNVidia(). |
|
Definition at line 131 of file vertex_buffer_hard.h. |
|
Definition at line 79 of file smart_ptr.h. Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount(). |
|
|
Referenced by NLMISC::CRefCount::CRefCount(). |
|
Definition at line 80 of file smart_ptr.h. Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount(). |
|
Definition at line 97 of file driver_opengl_vertex_buffer_hard.h. Referenced by NL3D::CDriverGL::fenceOnCurVBHardIfNeeded(), NL3D::IVertexBufferHardGL::IVertexBufferHardGL(), and NL3D::CVertexBufferInfo::setupVertexBufferHard(). |