Skip to content

Commit 1f5cfef

Browse files
committed
NUKE R_CreateStaticIBO2()
Use `R_CreateStaticIBO()` instead.
1 parent 6d73965 commit 1f5cfef

File tree

4 files changed

+3
-39
lines changed

4 files changed

+3
-39
lines changed

src/engine/renderer/VBO.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ VBO_t* R_CreateStaticVBO(
6666
uint32_t numVerts, uint32_t numFrames = 0 );
6767

6868
IBO_t* R_CreateStaticIBO( const char* name, glIndex_t* indexes, int numIndexes );
69-
IBO_t* R_CreateStaticIBO2( const char* name, int numTriangles, glIndex_t* indexes );
7069

7170
void R_BindVBO( VBO_t* vbo );
7271
void R_BindNullVBO();

src/engine/renderer/tr_bsp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2733,7 +2733,7 @@ static void R_CreateWorldVBO() {
27332733

27342734
s_worldData.vbo = R_CreateStaticVBO(
27352735
"staticWorld_VBO", std::begin( attrs ), std::end( attrs ), numVerts );
2736-
s_worldData.ibo = R_CreateStaticIBO2( "staticWorld_IBO", numTriangles, vboIdxs );
2736+
s_worldData.ibo = R_CreateStaticIBO( "staticWorld_IBO", vboIdxs, numTriangles * 3 );
27372737

27382738
ri.Hunk_FreeTempMemory( vboIdxs );
27392739
ri.Hunk_FreeTempMemory( vboVerts );

src/engine/renderer/tr_model_md3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ bool R_LoadMD3( model_t *mod, int lod, const void *buffer, const char *modName )
359359
indexes[ f++ ] = surf->triangles[ j ].indexes[ k ];
360360
}
361361
}
362-
vboSurf->ibo = R_CreateStaticIBO2( ( "MD3 surface IBO " + name ).c_str(), surf->numTriangles, indexes );
362+
vboSurf->ibo = R_CreateStaticIBO( ( "MD3 surface IBO " + name ).c_str(), indexes, surf->numTriangles * 3 );
363363

364364
ri.Hunk_FreeTempMemory(indexes);
365365
}

src/engine/renderer/tr_vbo.cpp

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ R_CreateIBO2
410410
*/
411411
IBO_t *R_CreateStaticIBO( const char *name, glIndex_t *indexes, int numIndexes )
412412
{
413-
IBO_t *ibo;
413+
IBO_t *ibo;
414414

415415
if ( !numIndexes )
416416
{
@@ -445,41 +445,6 @@ IBO_t *R_CreateStaticIBO( const char *name, glIndex_t *indexes, int numIndexes )
445445
return ibo;
446446
}
447447

448-
IBO_t *R_CreateStaticIBO2( const char *name, int numTriangles, glIndex_t *indexes )
449-
{
450-
IBO_t *ibo;
451-
452-
if ( !numTriangles )
453-
{
454-
return nullptr;
455-
}
456-
457-
// make sure the render thread is stopped
458-
R_SyncRenderThread();
459-
460-
ibo = ( IBO_t * ) ri.Hunk_Alloc( sizeof( *ibo ), ha_pref::h_low );
461-
tr.ibos.push_back( ibo );
462-
463-
Q_strncpyz( ibo->name, name, sizeof( ibo->name ) );
464-
ibo->indexesNum = numTriangles * 3;
465-
ibo->indexesSize = ibo->indexesNum * sizeof( glIndex_t );
466-
467-
glGenBuffers( 1, &ibo->indexesVBO );
468-
R_BindIBO( ibo );
469-
470-
if( glConfig2.bufferStorageAvailable ) {
471-
glBufferStorage( GL_ELEMENT_ARRAY_BUFFER, ibo->indexesSize,
472-
indexes, 0 );
473-
} else {
474-
glBufferData( GL_ELEMENT_ARRAY_BUFFER, ibo->indexesSize,
475-
indexes, GL_STATIC_DRAW );
476-
}
477-
478-
R_BindNullIBO();
479-
480-
return ibo;
481-
}
482-
483448
/*
484449
============
485450
R_BindVBO

0 commit comments

Comments
 (0)