return NULL;
}
+
+/**
+ * Prior to context destruction, this function unbinds all state objects.
+ */
static void cso_release_all( struct cso_context *ctx )
{
unsigned i;
ctx->pipe->bind_vs_state( ctx->pipe, NULL );
}
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
+ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
pipe_texture_reference(&ctx->textures[i], NULL);
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
pipe_texture_reference(&ctx->textures_saved[i], NULL);
+ }
if (ctx->cache) {
cso_cache_delete( ctx->cache );
void cso_destroy_context( struct cso_context *ctx )
{
- if (ctx)
+ if (ctx) {
cso_release_all( ctx );
-
- FREE( ctx );
+ FREE( ctx );
+ }
}