From 1aa234af4d22015cdfc576c831393586ad8be513 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Sun, 21 Nov 2021 19:47:42 +0300 Subject: [PATCH] togles: use GL_EXT_buffer_storage if avalible --- public/togles/linuxwin/glfuncs.h | 4 ++-- togles/linuxwin/cglmbuffer.cpp | 10 +++++----- togles/linuxwin/glentrypoints.cpp | 4 ++-- togles/linuxwin/glmgr.cpp | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/public/togles/linuxwin/glfuncs.h b/public/togles/linuxwin/glfuncs.h index e55c8f19..72a5bb0f 100644 --- a/public/togles/linuxwin/glfuncs.h +++ b/public/togles/linuxwin/glfuncs.h @@ -273,8 +273,8 @@ GL_EXT(GL_EXT_texture_compression_dxt1,-1,-1) GL_EXT(GL_ANGLE_texture_compression_dxt3,-1,-1) GL_EXT(GL_ANGLE_texture_compression_dxt5,-1,-1) -GL_EXT( GL_ARB_buffer_storage, 4, 4 ) -GL_FUNC_VOID( GL_ARB_buffer_storage, false, glBufferStorage, (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags), (target, size, data, flags) ) +GL_EXT( GL_EXT_buffer_storage, -1, -1 ) +GL_FUNC_VOID( GL_EXT_buffer_storage, false, glBufferStorageEXT, (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags), (target, size, data, flags) ) // This one is an OS extension. We'll add a little helper function to look for it. #ifdef _WIN32 diff --git a/togles/linuxwin/cglmbuffer.cpp b/togles/linuxwin/cglmbuffer.cpp index 23480c22..2aa1727e 100644 --- a/togles/linuxwin/cglmbuffer.cpp +++ b/togles/linuxwin/cglmbuffer.cpp @@ -93,7 +93,7 @@ CPersistentBuffer::~CPersistentBuffer() void CPersistentBuffer::Init( EGLMBufferType type,uint nSize ) { - Assert( gGL->m_bHave_GL_ARB_buffer_storage ); + Assert( gGL->m_bHave_GL_EXT_buffer_storage ); Assert( gGL->m_bHave_GL_ARB_map_buffer_range ); m_nSize = nSize; @@ -115,10 +115,10 @@ void CPersistentBuffer::Init( EGLMBufferType type,uint nSize ) // Create persistent immutable buffer that we will permanently map. This buffer can be written from any thread (not just // the renderthread) - gGL->glBufferStorage( m_buffGLTarget, m_nSize, (const GLvoid *)NULL, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT ); // V_GL_REQ: GL_ARB_buffer_storage, GL_ARB_map_buffer_range, GL_VERSION_4_4 + gGL->glBufferStorageEXT( m_buffGLTarget, m_nSize, (const GLvoid *)NULL, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT ); // V_GL_REQ: GL_EXT_buffer_storage, GL_ARB_map_buffer_range, GL_VERSION_4_4 // Map the buffer for all of eternity. Pointer can be used from multiple threads. - m_pImmutablePersistentBuf = gGL->glMapBufferRange( m_buffGLTarget, 0, m_nSize, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT ); // V_GL_REQ: GL_ARB_map_buffer_range, GL_ARB_buffer_storage, GL_VERSION_4_4 + m_pImmutablePersistentBuf = gGL->glMapBufferRange( m_buffGLTarget, 0, m_nSize, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT ); // V_GL_REQ: GL_ARB_map_buffer_range, GL_EXT_buffer_storage, GL_VERSION_4_4 Assert( m_pImmutablePersistentBuf != NULL ); } } @@ -687,7 +687,7 @@ void CGLMBuffer::Lock( GLMBuffLockParams *pParams, char **pAddressOut ) bool bUsingPersistentBuffer = false; uint padding = 0; - if ( m_bDynamic && gGL->m_bHave_GL_ARB_buffer_storage ) + if ( m_bDynamic && gGL->m_bHave_GL_EXT_buffer_storage ) { // Compute padding to add to make sure the start offset is valid CPersistentBuffer *pTempBuffer = m_pCtx->GetCurPersistentBuffer( m_type ); @@ -747,7 +747,7 @@ void CGLMBuffer::Lock( GLMBuffLockParams *pParams, char **pAddressOut ) } #endif } - else if ( m_bDynamic && gGL->m_bHave_GL_ARB_buffer_storage && ( m_pCtx->GetCurPersistentBuffer( m_type )->GetBytesRemaining() >= ( pParams->m_nSize + padding ) ) ) + else if ( m_bDynamic && gGL->m_bHave_GL_EXT_buffer_storage && ( m_pCtx->GetCurPersistentBuffer( m_type )->GetBytesRemaining() >= ( pParams->m_nSize + padding ) ) ) { CPersistentBuffer *pTempBuffer = m_pCtx->GetCurPersistentBuffer( m_type ); diff --git a/togles/linuxwin/glentrypoints.cpp b/togles/linuxwin/glentrypoints.cpp index fc9fcfe2..7349b000 100644 --- a/togles/linuxwin/glentrypoints.cpp +++ b/togles/linuxwin/glentrypoints.cpp @@ -448,12 +448,12 @@ COpenGLEntryPoints::COpenGLEntryPoints() // So disable it for now. if ( ( m_nDriverProvider == cGLDriverProviderAMD ) || CommandLine()->CheckParm( "-gl_disable_arb_buffer_storage" ) ) { - m_bHave_GL_ARB_buffer_storage = false; + m_bHave_GL_EXT_buffer_storage = false; } printf( "GL_NV_bindless_texture: %s\n", m_bHave_GL_NV_bindless_texture ? "ENABLED" : "DISABLED" ); printf( "GL_AMD_pinned_memory: %s\n", m_bHave_GL_AMD_pinned_memory ? "ENABLED" : "DISABLED" ); - printf( "GL_ARB_buffer_storage: %s\n", m_bHave_GL_ARB_buffer_storage ? "AVAILABLE" : "NOT AVAILABLE" ); + printf( "GL_EXT_buffer_storage: %s\n", m_bHave_GL_EXT_buffer_storage ? "AVAILABLE" : "NOT AVAILABLE" ); printf( "GL_EXT_texture_sRGB_decode: %s\n", m_bHave_GL_EXT_texture_sRGB_decode ? "AVAILABLE" : "NOT AVAILABLE" ); bool bGLCanDecodeS3TCTextures = m_bHave_GL_EXT_texture_compression_s3tc || ( m_bHave_GL_EXT_texture_compression_dxt1 && m_bHave_GL_ANGLE_texture_compression_dxt3 && m_bHave_GL_ANGLE_texture_compression_dxt5 ); diff --git a/togles/linuxwin/glmgr.cpp b/togles/linuxwin/glmgr.cpp index ec888347..255aa84d 100644 --- a/togles/linuxwin/glmgr.cpp +++ b/togles/linuxwin/glmgr.cpp @@ -2452,7 +2452,7 @@ GLMContext::GLMContext( IDirect3DDevice9 *pDevice, GLMDisplayParams *params ) ClearCurAttribs(); m_nCurPersistentBuffer = 0; - if ( gGL->m_bHave_GL_ARB_buffer_storage ) + if ( gGL->m_bHave_GL_EXT_buffer_storage ) { for ( uint lpType = 0; lpType < kGLMNumBufferTypes; ++lpType ) {