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 );
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();
}

View file

@ -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();