#include <driver_opengl_vertex_buffer_hard.h>
Inheritance diagram for NL3D::CVertexBufferHardGLATI:
Definition at line 305 of file driver_opengl_vertex_buffer_hard.h.
Public Types | |
enum | TVBType { NVidiaVB, ATIVB, ATIMapObjectVB, UnknownVB } |
Public Member Functions | |
bool | createRAMMirror (uint memSize) |
try to create a RAM mirror that 'll contain a copy of the VB. | |
CVertexBufferHardGLATI (CDriverGL *drv) | |
uint | getATIValueOffset (uint value) |
uint | getATIVertexObjectId () const |
get Handle of the ATI buffer. | |
const sint & | getRefCount () const |
void | initFormat (uint16 vertexFormat, const uint8 *typeArray, uint32 numVertices, const uint8 *uvRouting) |
void | initGL (CVertexArrayRangeATI *var, void *vertexPtr) |
virtual | ~CVertexBufferHardGLATI () |
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 () |
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 | |
void * | _RAMMirrorVertexPtr |
uint | _RAMMirrorVertexSize |
CVertexArrayRangeATI * | _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 572 of file driver_opengl_vertex_buffer_hard.cpp. References _RAMMirrorVertexPtr, and _RAMMirrorVertexSize.
00572 : IVertexBufferHardGL(drv) 00573 { 00574 _VertexArrayRange= NULL; 00575 _VertexPtr= NULL; 00576 _RAMMirrorVertexPtr= NULL; 00577 _RAMMirrorVertexSize= 0; 00578 00579 // Flag our type 00580 VBType = ATIVB; 00581 } |
|
Definition at line 585 of file driver_opengl_vertex_buffer_hard.cpp. References _RAMMirrorVertexPtr, _RAMMirrorVertexSize, NL3D::CVertexArrayRangeATI::freeVB(), and uint8.
00586 { 00587 if(_VertexArrayRange) 00588 { 00589 // free the VAR. 00590 _VertexArrayRange->freeVB(_VertexPtr); 00591 _VertexPtr= NULL; 00592 _VertexArrayRange= NULL; 00593 } 00594 00595 if(_RAMMirrorVertexPtr) 00596 { 00597 delete [] ((uint8*)_RAMMirrorVertexPtr); 00598 _RAMMirrorVertexPtr= NULL; 00599 _RAMMirrorVertexSize= 0; 00600 } 00601 } |
|
try to create a RAM mirror that 'll contain a copy of the VB.
Definition at line 605 of file driver_opengl_vertex_buffer_hard.cpp. References _RAMMirrorVertexPtr, _RAMMirrorVertexSize, uint, and uint8. Referenced by NL3D::CVertexArrayRangeATI::createVBHardGL().
00606 { 00607 // delete old if any 00608 if(_RAMMirrorVertexPtr) 00609 { 00610 free(_RAMMirrorVertexPtr); 00611 _RAMMirrorVertexPtr= NULL; 00612 _RAMMirrorVertexSize= 0; 00613 } 00614 // create 00615 _RAMMirrorVertexPtr = (void*)new uint8[memSize]; 00616 if(_RAMMirrorVertexPtr) 00617 { 00618 _RAMMirrorVertexSize= memSize; 00619 return true; 00620 } 00621 else 00622 return false; 00623 } |
|
Implements NL3D::IVertexBufferHardGL. Definition at line 685 of file driver_opengl_vertex_buffer_hard.cpp. References NL3D::CDriverGL::_CurrentVertexBufferHard, NL3D::CVertexArrayRangeATI::disable(), and nlassert.
00686 { 00687 if(_Driver->_CurrentVertexBufferHard != NULL) 00688 { 00689 nlassert(_VertexArrayRange); 00690 _VertexArrayRange->disable(); 00691 _Driver->_CurrentVertexBufferHard= NULL; 00692 } 00693 } |
|
Implements NL3D::IVertexBufferHardGL. Definition at line 673 of file driver_opengl_vertex_buffer_hard.cpp. References NL3D::CDriverGL::_CurrentVertexBufferHard, NL3D::CVertexArrayRangeATI::enable(), and nlassert.
00674 { 00675 if(_Driver->_CurrentVertexBufferHard != this) 00676 { 00677 nlassert(_VertexArrayRange); 00678 _VertexArrayRange->enable(); 00679 _Driver->_CurrentVertexBufferHard= this; 00680 } 00681 } |
|
Definition at line 333 of file driver_opengl_vertex_buffer_hard.h. References NL3D::IVertexBufferHard::getValueOff(), NL3D_DRV_ATI_FAKE_MEM_START, nlassert, uint, and value. Referenced by NL3D::CVertexBufferInfo::setupVertexBufferHard().
00334 { 00335 nlassert(_VertexPtr); 00336 // To get the correct offset, remove the dummy MEM offset. 00337 return ((uint)_VertexPtr + getValueOff (value)) - NL3D_DRV_ATI_FAKE_MEM_START; 00338 } |
|
get Handle of the ATI buffer.
Definition at line 341 of file driver_opengl_vertex_buffer_hard.h. References NL3D::CVertexArrayRangeATI::getATIVertexObjectId(), and uint. Referenced by NL3D::CVertexBufferInfo::setupVertexBufferHard(), and unlock().
00341 {return _VertexArrayRange->getATIVertexObjectId();} |
|
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 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(), getATIValueOffset(), NL3D::CVertexBufferHardGLNVidia::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 } |
|
setup ptrs allocated by createVBHard() Definition at line 627 of file driver_opengl_vertex_buffer_hard.cpp. Referenced by NL3D::CVertexArrayRangeATI::createVBHardGL().
00628 { 00629 _VertexArrayRange= var; 00630 _VertexPtr= vertexPtr; 00631 } |
|
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 635 of file driver_opengl_vertex_buffer_hard.cpp. References _RAMMirrorVertexPtr.
00636 { 00637 // return directly the mirror one. => client will write into RAM. 00638 return _RAMMirrorVertexPtr; 00639 } |
|
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 696 of file driver_opengl_vertex_buffer_hard.cpp.
00697 {
00698 // no op.
00699 }
|
|
Definition at line 96 of file vertex_buffer_hard.cpp.
00097 { 00098 _Name= name; 00099 } |
|
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 652 of file driver_opengl_vertex_buffer_hard.cpp. References _RAMMirrorVertexPtr, getATIVertexObjectId(), NL3D::IVertexBufferHard::getNumVertices(), NL3D::IVertexBufferHard::getVertexSize(), GL_PRESERVE_ATI, nglUpdateObjectBufferATI, NL3D_DRV_ATI_FAKE_MEM_START, size, uint, and uint8.
00653 { 00654 // clamp endVert. 00655 if(endVert>getNumVertices()) 00656 endVert=getNumVertices(); 00657 00658 // verify bound. 00659 if(startVert>=endVert) 00660 return; 00661 00662 // Copy a subset of the mirror into the ATI Vertex Object 00663 uint size= (endVert-startVert)*getVertexSize(); 00664 uint srcOffStart= startVert*getVertexSize(); 00665 uint dstOffStart= ((uint)_VertexPtr - NL3D_DRV_ATI_FAKE_MEM_START) + srcOffStart; 00666 // copy. 00667 nglUpdateObjectBufferATI(getATIVertexObjectId(), dstOffStart, 00668 size, (uint8*)_RAMMirrorVertexPtr + srcOffStart, GL_PRESERVE_ATI); 00669 } |
|
UnLock the VertexBuffer so the Gfx card can now use it. Implements NL3D::IVertexBufferHard. Definition at line 643 of file driver_opengl_vertex_buffer_hard.cpp. References _RAMMirrorVertexPtr, _RAMMirrorVertexSize, getATIVertexObjectId(), GL_PRESERVE_ATI, nglUpdateObjectBufferATI, NL3D_DRV_ATI_FAKE_MEM_START, and uint.
00644 { 00645 // Copy All mirror into the ATI Vertex Object 00646 nglUpdateObjectBufferATI(getATIVertexObjectId(), (uint)_VertexPtr - NL3D_DRV_ATI_FAKE_MEM_START, 00647 _RAMMirrorVertexSize, _RAMMirrorVertexPtr, GL_PRESERVE_ATI); 00648 } |
|
Definition at line 67 of file smart_ptr.h. |
|
Definition at line 111 of file driver_opengl_vertex_buffer_hard.h. |
|
Definition at line 134 of file vertex_buffer_hard.h. |
|
Definition at line 137 of file vertex_buffer_hard.h. |
|
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 348 of file driver_opengl_vertex_buffer_hard.h. Referenced by createRAMMirror(), CVertexBufferHardGLATI(), lock(), unlock(), and ~CVertexBufferHardGLATI(). |
|
Definition at line 349 of file driver_opengl_vertex_buffer_hard.h. Referenced by createRAMMirror(), CVertexBufferHardGLATI(), unlock(), and ~CVertexBufferHardGLATI(). |
|
Definition at line 127 of file vertex_buffer_hard.h. |
|
Definition at line 153 of file vertex_buffer_hard.h. |
|
Definition at line 346 of file driver_opengl_vertex_buffer_hard.h. |
|
Definition at line 347 of file driver_opengl_vertex_buffer_hard.h. |
|
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(). |