Changed: Implement GL_NV_vertex_array_range for GLX
This commit is contained in:
parent
032811b374
commit
0c5c352a78
4 changed files with 32 additions and 4 deletions
|
@ -444,6 +444,9 @@ PFNWGLGETEXTENSIONSSTRINGARBPROC nwglGetExtensionsStringARB;
|
|||
#elif defined(NL_OS_MAC)
|
||||
#elif defined(NL_OS_UNIX)
|
||||
|
||||
NEL_PFNGLXLALLOCATEMEMORYNVPROC nglXAllocateMemoryNV;
|
||||
NEL_PFNGLXFREEMEMORYNVPROC nglXFreeMemoryNV;
|
||||
|
||||
// Swap control extensions
|
||||
NEL_PFNGLXSWAPINTERVALEXTPROC nglXSwapIntervalEXT;
|
||||
|
||||
|
@ -562,9 +565,6 @@ static bool setupARBTextureNonPowerOfTwo(const char *glext)
|
|||
static bool setupNVVertexArrayRange(const char *glext)
|
||||
{
|
||||
H_AUTO_OGL(setupNVVertexArrayRange);
|
||||
#ifndef NL_OS_WINDOWS
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Test if VAR is present.
|
||||
CHECK_EXT("GL_NV_vertex_array_range");
|
||||
|
@ -575,9 +575,13 @@ static bool setupNVVertexArrayRange(const char *glext)
|
|||
// Get VAR address.
|
||||
CHECK_ADDRESS(NEL_PFNGLFLUSHVERTEXARRAYRANGENVPROC, glFlushVertexArrayRangeNV);
|
||||
CHECK_ADDRESS(NEL_PFNGLVERTEXARRAYRANGENVPROC, glVertexArrayRangeNV);
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
CHECK_ADDRESS(PFNWGLALLOCATEMEMORYNVPROC, wglAllocateMemoryNV);
|
||||
CHECK_ADDRESS(PFNWGLFREEMEMORYNVPROC, wglFreeMemoryNV);
|
||||
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
||||
CHECK_ADDRESS(NEL_PFNGLXLALLOCATEMEMORYNVPROC, glXAllocateMemoryNV);
|
||||
CHECK_ADDRESS(NEL_PFNGLXFREEMEMORYNVPROC, glXFreeMemoryNV);
|
||||
#endif
|
||||
|
||||
// Get fence address.
|
||||
|
|
|
@ -332,6 +332,9 @@ extern NEL_PFNGLVERTEXARRAYRANGENVPROC nglVertexArrayRangeNV;
|
|||
#ifdef NL_OS_WINDOWS
|
||||
extern PFNWGLALLOCATEMEMORYNVPROC nwglAllocateMemoryNV;
|
||||
extern PFNWGLFREEMEMORYNVPROC nwglFreeMemoryNV;
|
||||
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
||||
extern NEL_PFNGLXLALLOCATEMEMORYNVPROC nglXAllocateMemoryNV;
|
||||
extern NEL_PFNGLXFREEMEMORYNVPROC nglXFreeMemoryNV;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -403,6 +403,12 @@ typedef GLint (APIENTRY * NEL_PFNGLXGETSWAPINTERVALMESAPROC) ();
|
|||
|
||||
#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
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -116,7 +116,20 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM
|
|||
else
|
||||
_VertexArrayPtr= nwglAllocateMemoryNV(size, 0, 0, 0.5f);
|
||||
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
|
||||
|
||||
|
||||
|
@ -158,6 +171,8 @@ void CVertexArrayRangeNVidia::free()
|
|||
#ifdef NL_OS_WINDOWS
|
||||
// Free special memory.
|
||||
nwglFreeMemoryNV(_VertexArrayPtr);
|
||||
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
||||
nglXFreeMemoryNV(_VertexArrayPtr);
|
||||
#endif // NL_OS_WINDOWS
|
||||
|
||||
_VertexArrayPtr= NULL;
|
||||
|
|
Loading…
Reference in a new issue