Added OpenGL state caching for decent speed improvement.

This commit is contained in:
Sam Lantinga 2011-02-19 21:51:21 -08:00
parent 8c64c50659
commit ee61cc3170
4 changed files with 340 additions and 238 deletions

View file

@ -60,7 +60,6 @@ struct GL_ShaderContext
SDL_bool GL_ARB_texture_rectangle_supported;
GL_Shader current_shader;
GL_ShaderData shaders[NUM_SHADERS];
};
@ -341,18 +340,7 @@ GL_CreateShaderContext()
void
GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader)
{
/* Nothing to do if there's no shader support */
if (!ctx) {
return;
}
/* Nothing to do if there's no shader change */
if (shader == ctx->current_shader) {
return;
}
ctx->glUseProgramObjectARB(ctx->shaders[shader].program);
ctx->current_shader = shader;
}
void