togles: use GL_EXT_buffer_storage if avalible

This commit is contained in:
nillerusr 2021-11-21 19:47:42 +03:00
parent e8dd3cece3
commit 1aa234af4d
4 changed files with 10 additions and 10 deletions

View File

@ -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_dxt3,-1,-1)
GL_EXT(GL_ANGLE_texture_compression_dxt5,-1,-1) GL_EXT(GL_ANGLE_texture_compression_dxt5,-1,-1)
GL_EXT( GL_ARB_buffer_storage, 4, 4 ) GL_EXT( GL_EXT_buffer_storage, -1, -1 )
GL_FUNC_VOID( GL_ARB_buffer_storage, false, glBufferStorage, (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags), (target, size, data, flags) ) 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. // This one is an OS extension. We'll add a little helper function to look for it.
#ifdef _WIN32 #ifdef _WIN32

View File

@ -93,7 +93,7 @@ CPersistentBuffer::~CPersistentBuffer()
void CPersistentBuffer::Init( EGLMBufferType type,uint nSize ) 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 ); Assert( gGL->m_bHave_GL_ARB_map_buffer_range );
m_nSize = nSize; 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 // Create persistent immutable buffer that we will permanently map. This buffer can be written from any thread (not just
// the renderthread) // 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. // 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 ); Assert( m_pImmutablePersistentBuf != NULL );
} }
} }
@ -687,7 +687,7 @@ void CGLMBuffer::Lock( GLMBuffLockParams *pParams, char **pAddressOut )
bool bUsingPersistentBuffer = false; bool bUsingPersistentBuffer = false;
uint padding = 0; 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 // Compute padding to add to make sure the start offset is valid
CPersistentBuffer *pTempBuffer = m_pCtx->GetCurPersistentBuffer( m_type ); CPersistentBuffer *pTempBuffer = m_pCtx->GetCurPersistentBuffer( m_type );
@ -747,7 +747,7 @@ void CGLMBuffer::Lock( GLMBuffLockParams *pParams, char **pAddressOut )
} }
#endif #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 ); CPersistentBuffer *pTempBuffer = m_pCtx->GetCurPersistentBuffer( m_type );

View File

@ -448,12 +448,12 @@ COpenGLEntryPoints::COpenGLEntryPoints()
// So disable it for now. // So disable it for now.
if ( ( m_nDriverProvider == cGLDriverProviderAMD ) || CommandLine()->CheckParm( "-gl_disable_arb_buffer_storage" ) ) 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_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_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" ); 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 ); 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 );

View File

@ -2452,7 +2452,7 @@ GLMContext::GLMContext( IDirect3DDevice9 *pDevice, GLMDisplayParams *params )
ClearCurAttribs(); ClearCurAttribs();
m_nCurPersistentBuffer = 0; 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 ) for ( uint lpType = 0; lpType < kGLMNumBufferTypes; ++lpType )
{ {