mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
mesa: alloc/free shared sampler objects
This commit is contained in:
parent
0308beebc2
commit
6bb4d807f7
1 changed files with 27 additions and 0 deletions
|
|
@ -40,6 +40,9 @@
|
|||
#include "shared.h"
|
||||
#include "program/program.h"
|
||||
#include "dlist.h"
|
||||
#if FEATURE_ARB_sampler_objects
|
||||
#include "samplerobj.h"
|
||||
#endif
|
||||
#include "shaderobj.h"
|
||||
#include "syncobj.h"
|
||||
|
||||
|
|
@ -91,6 +94,11 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
|
|||
shared->BufferObjects = _mesa_NewHashTable();
|
||||
#endif
|
||||
|
||||
#if FEATURE_ARB_sampler_objects
|
||||
/* GL_ARB_sampler_objects */
|
||||
shared->SamplerObjects = _mesa_NewHashTable();
|
||||
#endif
|
||||
|
||||
/* Allocate the default buffer object */
|
||||
shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0, 0);
|
||||
|
||||
|
|
@ -270,6 +278,20 @@ delete_renderbuffer_cb(GLuint id, void *data, void *userData)
|
|||
}
|
||||
|
||||
|
||||
#if FEATURE_ARB_sampler_objects
|
||||
/**
|
||||
* Callback for deleting a sampler object. Called by _mesa_HashDeleteAll()
|
||||
*/
|
||||
static void
|
||||
delete_sampler_object_cb(GLuint id, void *data, void *userData)
|
||||
{
|
||||
struct gl_context *ctx = (struct gl_context *) userData;
|
||||
struct gl_sampler_object *sampObj = (struct gl_sampler_object *) data;
|
||||
_mesa_reference_sampler_object(ctx, &sampObj, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Deallocate a shared state object and all children structures.
|
||||
*
|
||||
|
|
@ -345,6 +367,11 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
|
|||
}
|
||||
}
|
||||
|
||||
#if FEATURE_ARB_sampler_objects
|
||||
_mesa_HashDeleteAll(shared->SamplerObjects, delete_sampler_object_cb, ctx);
|
||||
_mesa_DeleteHashTable(shared->SamplerObjects);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Free texture objects (after FBOs since some textures might have
|
||||
* been bound to FBOs).
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue