diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl.cpp b/code/nel/src/3d/driver/OpenGL3/driver_opengl.cpp index 9dc3ba33e..595dbee11 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl.cpp @@ -455,29 +455,9 @@ bool CDriverGL3::setupDisplay() _NVCurrentVARPtr= NULL; _NVCurrentVARSize= 0; - if (_SupportVBHard) - { - // try to allocate 16Mo by default of AGP Ram. + if( _SupportVBHard ) initVertexBufferHard(NL3D_DRV_VERTEXARRAY_AGP_INIT_SIZE, 0); - // If not success to allocate at least a minimum space in AGP, then disable completely VBHard feature - if( _AGPVertexArrayRange->sizeAllocated()==0 ) - { - // reset any allocated VRAM space. - resetVertexArrayRange(); - - // delete containers - delete _AGPVertexArrayRange; - delete _VRAMVertexArrayRange; - _AGPVertexArrayRange= NULL; - _VRAMVertexArrayRange= NULL; - - // disable. - _SupportVBHard= false; - _SlowUnlockVBHard= false; - _MaxVerticesByVBHard= 0; - } - } // Init embm if present //=========================================================== diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl.h b/code/nel/src/3d/driver/OpenGL3/driver_opengl.h index e9fb62fe8..f26f6c09f 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl.h +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl.h @@ -332,8 +332,8 @@ public: virtual bool copyTextToClipboard(const ucstring &text); virtual bool pasteTextFromClipboard(ucstring &text); - virtual uint32 getAvailableVertexAGPMemory (); - virtual uint32 getAvailableVertexVRAMMemory (); + uint32 getAvailableVertexAGPMemory (){ return 0; }; + uint32 getAvailableVertexVRAMMemory (){ return 0; }; virtual emptyProc getWindowProc(); diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex.cpp b/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex.cpp index febeb4094..00eb66ffb 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex.cpp @@ -1483,12 +1483,6 @@ void CDriverGL3::resetVertexArrayRange() } // Clear any VertexBufferHard created. _VertexBufferHardSet.clear(); - - // After, Clear the 2 vertexArrayRange, if any. - if(_AGPVertexArrayRange) - _AGPVertexArrayRange->free(); - if(_VRAMVertexArrayRange) - _VRAMVertexArrayRange->free(); } @@ -1505,83 +1499,8 @@ bool CDriverGL3::initVertexBufferHard(uint agpMem, uint vramMem) // First, reset any VBHard created. resetVertexArrayRange(); - bool ok= true; - - // Try to allocate AGPMemory. - if(agpMem>0) - { - agpMem&= ~15; // ensure 16-bytes aligned mem count (maybe useful :) ). - agpMem= max(agpMem, (uint)NL3D_DRV_VERTEXARRAY_MINIMUM_SIZE); - while(agpMem>= NL3D_DRV_VERTEXARRAY_MINIMUM_SIZE) - { - if(_AGPVertexArrayRange->allocate(agpMem, CVertexBuffer::AGPPreferred)) - { - nlinfo("3D: %.u vertices supported", _MaxVerticesByVBHard); - nlinfo("3D: Success to allocate %.1f Mo of AGP VAR Ram", agpMem / 1000000.f); - break; - } - else - { - agpMem/=2; - agpMem &=~15; - } - } - - if(agpMem< NL3D_DRV_VERTEXARRAY_MINIMUM_SIZE) - { - nlinfo("3D: %.u vertices supported", _MaxVerticesByVBHard); - nlinfo("3D: Failed to allocate %.1f Mo of AGP VAR Ram", NL3D_DRV_VERTEXARRAY_MINIMUM_SIZE / 1000000.f); - ok= false; - } - } - - - // Try to allocate VRAMMemory. - if(vramMem>0) - { - vramMem&= ~15; // ensure 16-bytes aligned mem count (maybe useful :) ). - vramMem= max(vramMem, (uint)NL3D_DRV_VERTEXARRAY_MINIMUM_SIZE); - while(vramMem>= NL3D_DRV_VERTEXARRAY_MINIMUM_SIZE) - { - if(_VRAMVertexArrayRange->allocate(vramMem, CVertexBuffer::StaticPreferred)) - break; - else - { - vramMem/=2; - vramMem &=~15; - } - } - - if(vramMem< NL3D_DRV_VERTEXARRAY_MINIMUM_SIZE) - { - ok= false; - } - } - - - return ok; -} - -// *************************************************************************** -uint32 CDriverGL3::getAvailableVertexAGPMemory () -{ - H_AUTO_OGL(CDriverGL3_getAvailableVertexAGPMemory ) - if (_AGPVertexArrayRange) - return _AGPVertexArrayRange->sizeAllocated(); - else - return 0; -} - - -// *************************************************************************** -uint32 CDriverGL3::getAvailableVertexVRAMMemory () -{ - H_AUTO_OGL(CDriverGL3_getAvailableVertexVRAMMemory ) - if (_VRAMVertexArrayRange) - return _VRAMVertexArrayRange->sizeAllocated(); - else - return 0; + return true; } diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_buffer_hard.cpp b/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_buffer_hard.cpp index 6903d8b31..2dedb389b 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_buffer_hard.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_buffer_hard.cpp @@ -92,50 +92,6 @@ CVertexArrayRangeARB::CVertexArrayRangeARB(CDriverGL3 *drv) : IVertexArrayRange( H_AUTO_OGL(CVertexArrayRangeARB_CVertexArrayRangeARB) } -// *************************************************************************** -bool CVertexArrayRangeARB::allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType) -{ - H_AUTO_OGL(CVertexArrayRangeARB_allocate) - nlassert(_SizeAllocated == 0); - /* - // We don't manage memory ourselves, but test if there's enough room anyway - GLuint vertexBufferID; - glGetError(); - glGenBuffersARB(1, &vertexBufferID); - if (glGetError() != GL_NO_ERROR) return false; - - switch(vbType) - { - case CVertexBuffer::AGPPreferred: - glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); - break; - case CVertexBuffer::VRAMPreferred: - glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB); - break; - default: - nlassert(0); - break; - } - - if (glGetError() != GL_NO_ERROR) - { - glDeleteBuffersARB(1, &vertexBufferID); - return false; - } - glDeleteBuffersARB(1, &vertexBufferID); - */ - _SizeAllocated = size; - _VBType = vbType; - return true; -} - -// *************************************************************************** -void CVertexArrayRangeARB::free() -{ - H_AUTO_OGL(CVertexArrayRangeARB_free) - _SizeAllocated = 0; -} - // *************************************************************************** IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuffer *vb) { diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_buffer_hard.h b/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_buffer_hard.h index 0f5a0dfee..82c3098ec 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_buffer_hard.h +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_buffer_hard.h @@ -50,14 +50,8 @@ public: IVertexArrayRange(CDriverGL3 *drv); virtual ~IVertexArrayRange(); - /// allocate a vertex array space. false if error. client must free before re-allocate. - virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType)= 0; - /// free this space. - virtual void free()= 0; /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb) =0; - /// return the size allocated. 0 if not allocated or failure - virtual uint sizeAllocated() const =0; // Check & invalidate lost buffers. Default assume they can't be lost virtual void updateLostBuffers() {} // Get driver @@ -124,21 +118,7 @@ class CVertexArrayRangeARB : public IVertexArrayRange public: CVertexArrayRangeARB(CDriverGL3 *drv); - - /// \name Implementation - // @{ - /** Allocate a vertex array space. false if error. must free before re-allocate. - * Will always succeed, because vb are not managed in a heap, but are rather kept as separate objects - */ - virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType); - /// free this space. - virtual void free(); - /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb); - /// return the size allocated. 0 if not allocated or failure - virtual uint sizeAllocated() const { return _SizeAllocated; } - // @} - // Those methods read/write in _Driver->_CurrentVertexArrayRange. /** active this VertexArrayRange as the current vertex array range used. no-op if already setup.