Reserve FBOs before shaders, as recommended in nvidia docs

Minor tweak in VBO allocation.
This commit is contained in:
James Canete 2012-04-06 01:49:07 +00:00
parent 63216cd936
commit a458a2401b
2 changed files with 5 additions and 20 deletions

View file

@ -896,10 +896,6 @@ void GL_SetDefaultState( void )
qglShadeModel( GL_SMOOTH ); qglShadeModel( GL_SMOOTH );
qglDepthFunc( GL_LEQUAL ); 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 // make sure our GL state vector is set correctly
// //
@ -1368,10 +1364,10 @@ void R_Init( void ) {
R_InitImages(); R_InitImages();
GLSL_InitGPUShaders();
FBO_Init(); FBO_Init();
GLSL_InitGPUShaders();
R_InitVBOs(); R_InitVBOs();
R_InitShaders(); R_InitShaders();
@ -1417,9 +1413,9 @@ void RE_Shutdown( qboolean destroyWindow ) {
R_SyncRenderThread(); R_SyncRenderThread();
R_ShutdownCommandBuffers(); R_ShutdownCommandBuffers();
R_ShutDownQueries(); R_ShutDownQueries();
FBO_Shutdown();
R_DeleteTextures(); R_DeleteTextures();
R_ShutdownVBOs(); R_ShutdownVBOs();
FBO_Shutdown();
GLSL_ShutdownGPUShaders(); GLSL_ShutdownGPUShaders();
} }

View file

@ -678,7 +678,6 @@ R_InitVBOs
void R_InitVBOs(void) void R_InitVBOs(void)
{ {
int dataSize; int dataSize;
byte *data;
ri.Printf(PRINT_ALL, "------- R_InitVBOs -------\n"); ri.Printf(PRINT_ALL, "------- R_InitVBOs -------\n");
@ -694,12 +693,7 @@ void R_InitVBOs(void)
dataSize += sizeof(tess.lightdir[0]); dataSize += sizeof(tess.lightdir[0]);
dataSize *= SHADER_MAX_VERTEXES; dataSize *= SHADER_MAX_VERTEXES;
data = ri.Malloc(dataSize); tess.vbo = R_CreateVBO("tessVertexArray_VBO", NULL, dataSize, VBO_USAGE_DYNAMIC);
memset(data, 0, dataSize);
tess.vbo = R_CreateVBO("tessVertexArray_VBO", data, dataSize, VBO_USAGE_DYNAMIC);
ri.Free(data);
tess.vbo->ofs_xyz = 0; tess.vbo->ofs_xyz = 0;
tess.vbo->ofs_normal = tess.vbo->ofs_xyz + sizeof(tess.xyz[0]) * SHADER_MAX_VERTEXES; 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; dataSize = sizeof(tess.indexes[0]) * SHADER_MAX_INDEXES;
data = ri.Malloc(dataSize); tess.ibo = R_CreateIBO("tessVertexArray_IBO", NULL, dataSize, VBO_USAGE_DYNAMIC);
memset(data, 0, dataSize);
tess.ibo = R_CreateIBO("tessVertexArray_IBO", data, dataSize, VBO_USAGE_DYNAMIC);
ri.Free(data);
R_BindNullVBO(); R_BindNullVBO();
R_BindNullIBO(); R_BindNullIBO();