From a458a2401bed1d7621b4bef1d980ff2bcef29a12 Mon Sep 17 00:00:00 2001 From: James Canete Date: Fri, 6 Apr 2012 01:49:07 +0000 Subject: [PATCH] Reserve FBOs before shaders, as recommended in nvidia docs Minor tweak in VBO allocation. --- reaction/code/renderergl2/tr_init.c | 10 +++------- reaction/code/renderergl2/tr_vbo.c | 15 ++------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/reaction/code/renderergl2/tr_init.c b/reaction/code/renderergl2/tr_init.c index 8878e1bf..a2f8cccd 100644 --- a/reaction/code/renderergl2/tr_init.c +++ b/reaction/code/renderergl2/tr_init.c @@ -896,10 +896,6 @@ void GL_SetDefaultState( void ) qglShadeModel( GL_SMOOTH ); qglDepthFunc( GL_LEQUAL ); - // the vertex array is always enabled, but the color and texture - // arrays are enabled and disabled around the compiled vertex array call - qglEnableClientState (GL_VERTEX_ARRAY); - // // make sure our GL state vector is set correctly // @@ -1368,10 +1364,10 @@ void R_Init( void ) { R_InitImages(); - GLSL_InitGPUShaders(); - FBO_Init(); + GLSL_InitGPUShaders(); + R_InitVBOs(); R_InitShaders(); @@ -1417,9 +1413,9 @@ void RE_Shutdown( qboolean destroyWindow ) { R_SyncRenderThread(); R_ShutdownCommandBuffers(); R_ShutDownQueries(); + FBO_Shutdown(); R_DeleteTextures(); R_ShutdownVBOs(); - FBO_Shutdown(); GLSL_ShutdownGPUShaders(); } diff --git a/reaction/code/renderergl2/tr_vbo.c b/reaction/code/renderergl2/tr_vbo.c index 31aa954a..b4ac5f8c 100644 --- a/reaction/code/renderergl2/tr_vbo.c +++ b/reaction/code/renderergl2/tr_vbo.c @@ -678,7 +678,6 @@ R_InitVBOs void R_InitVBOs(void) { int dataSize; - byte *data; ri.Printf(PRINT_ALL, "------- R_InitVBOs -------\n"); @@ -694,12 +693,7 @@ void R_InitVBOs(void) dataSize += sizeof(tess.lightdir[0]); dataSize *= SHADER_MAX_VERTEXES; - data = ri.Malloc(dataSize); - memset(data, 0, dataSize); - - tess.vbo = R_CreateVBO("tessVertexArray_VBO", data, dataSize, VBO_USAGE_DYNAMIC); - - ri.Free(data); + tess.vbo = R_CreateVBO("tessVertexArray_VBO", NULL, dataSize, VBO_USAGE_DYNAMIC); tess.vbo->ofs_xyz = 0; tess.vbo->ofs_normal = tess.vbo->ofs_xyz + sizeof(tess.xyz[0]) * SHADER_MAX_VERTEXES; @@ -723,12 +717,7 @@ void R_InitVBOs(void) dataSize = sizeof(tess.indexes[0]) * SHADER_MAX_INDEXES; - data = ri.Malloc(dataSize); - memset(data, 0, dataSize); - - tess.ibo = R_CreateIBO("tessVertexArray_IBO", data, dataSize, VBO_USAGE_DYNAMIC); - - ri.Free(data); + tess.ibo = R_CreateIBO("tessVertexArray_IBO", NULL, dataSize, VBO_USAGE_DYNAMIC); R_BindNullVBO(); R_BindNullIBO();