Changed: Implement GL_NV_vertex_array_range for GLX

This commit is contained in:
kervala 2010-12-20 16:43:05 +01:00
parent 032811b374
commit 0c5c352a78
4 changed files with 32 additions and 4 deletions

View file

@ -444,6 +444,9 @@ PFNWGLGETEXTENSIONSSTRINGARBPROC nwglGetExtensionsStringARB;
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX) #elif defined(NL_OS_UNIX)
NEL_PFNGLXLALLOCATEMEMORYNVPROC nglXAllocateMemoryNV;
NEL_PFNGLXFREEMEMORYNVPROC nglXFreeMemoryNV;
// Swap control extensions // Swap control extensions
NEL_PFNGLXSWAPINTERVALEXTPROC nglXSwapIntervalEXT; NEL_PFNGLXSWAPINTERVALEXTPROC nglXSwapIntervalEXT;
@ -562,9 +565,6 @@ static bool setupARBTextureNonPowerOfTwo(const char *glext)
static bool setupNVVertexArrayRange(const char *glext) static bool setupNVVertexArrayRange(const char *glext)
{ {
H_AUTO_OGL(setupNVVertexArrayRange); H_AUTO_OGL(setupNVVertexArrayRange);
#ifndef NL_OS_WINDOWS
return false;
#endif
// Test if VAR is present. // Test if VAR is present.
CHECK_EXT("GL_NV_vertex_array_range"); CHECK_EXT("GL_NV_vertex_array_range");
@ -575,9 +575,13 @@ static bool setupNVVertexArrayRange(const char *glext)
// Get VAR address. // Get VAR address.
CHECK_ADDRESS(NEL_PFNGLFLUSHVERTEXARRAYRANGENVPROC, glFlushVertexArrayRangeNV); CHECK_ADDRESS(NEL_PFNGLFLUSHVERTEXARRAYRANGENVPROC, glFlushVertexArrayRangeNV);
CHECK_ADDRESS(NEL_PFNGLVERTEXARRAYRANGENVPROC, glVertexArrayRangeNV); CHECK_ADDRESS(NEL_PFNGLVERTEXARRAYRANGENVPROC, glVertexArrayRangeNV);
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
CHECK_ADDRESS(PFNWGLALLOCATEMEMORYNVPROC, wglAllocateMemoryNV); CHECK_ADDRESS(PFNWGLALLOCATEMEMORYNVPROC, wglAllocateMemoryNV);
CHECK_ADDRESS(PFNWGLFREEMEMORYNVPROC, wglFreeMemoryNV); CHECK_ADDRESS(PFNWGLFREEMEMORYNVPROC, wglFreeMemoryNV);
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
CHECK_ADDRESS(NEL_PFNGLXLALLOCATEMEMORYNVPROC, glXAllocateMemoryNV);
CHECK_ADDRESS(NEL_PFNGLXFREEMEMORYNVPROC, glXFreeMemoryNV);
#endif #endif
// Get fence address. // Get fence address.

View file

@ -332,6 +332,9 @@ extern NEL_PFNGLVERTEXARRAYRANGENVPROC nglVertexArrayRangeNV;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
extern PFNWGLALLOCATEMEMORYNVPROC nwglAllocateMemoryNV; extern PFNWGLALLOCATEMEMORYNVPROC nwglAllocateMemoryNV;
extern PFNWGLFREEMEMORYNVPROC nwglFreeMemoryNV; extern PFNWGLFREEMEMORYNVPROC nwglFreeMemoryNV;
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
extern NEL_PFNGLXLALLOCATEMEMORYNVPROC nglXAllocateMemoryNV;
extern NEL_PFNGLXFREEMEMORYNVPROC nglXFreeMemoryNV;
#endif #endif

View file

@ -403,6 +403,12 @@ typedef GLint (APIENTRY * NEL_PFNGLXGETSWAPINTERVALMESAPROC) ();
#endif // NL_GLX_MESA_swap_control #endif // NL_GLX_MESA_swap_control
#ifndef NL_GLX_NV_vertex_array_range
#define NL_GLX_NV_vertex_array_range 1
typedef void* (APIENTRY * NEL_PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
typedef void (APIENTRY * NEL_PFNGLXFREEMEMORYNVPROC) (void *pointer);
#endif // NL_GLX_NV_vertex_array_range
#endif // NL_OS_MAC #endif // NL_OS_MAC
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -116,7 +116,20 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM
else else
_VertexArrayPtr= nwglAllocateMemoryNV(size, 0, 0, 0.5f); _VertexArrayPtr= nwglAllocateMemoryNV(size, 0, 0, 0.5f);
break; break;
}; }
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
switch(vbType)
{
case CVertexBuffer::AGPPreferred:
_VertexArrayPtr= nglXAllocateMemoryNV(size, 0, 0, 0.5f);
break;
case CVertexBuffer::StaticPreferred:
if (_Driver->getStaticMemoryToVRAM())
_VertexArrayPtr= nglXAllocateMemoryNV(size, 0, 0, 1.0f);
else
_VertexArrayPtr= nglXAllocateMemoryNV(size, 0, 0, 0.5f);
break;
}
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
@ -158,6 +171,8 @@ void CVertexArrayRangeNVidia::free()
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// Free special memory. // Free special memory.
nwglFreeMemoryNV(_VertexArrayPtr); nwglFreeMemoryNV(_VertexArrayPtr);
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
nglXFreeMemoryNV(_VertexArrayPtr);
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
_VertexArrayPtr= NULL; _VertexArrayPtr= NULL;