mesa: use new ST_CALLOC_STRUCT() macro in gallium state tracker

This commit is contained in:
Brian Paul 2009-02-12 10:14:36 -07:00
parent 1a2f4dd876
commit f1a59a6dd7
12 changed files with 19 additions and 15 deletions

View File

@ -165,7 +165,7 @@ find_translated_vp(struct st_context *st,
/* No? Allocate translated vp object now */
if (!xvp) {
xvp = CALLOC_STRUCT(translated_vertex_program);
xvp = ST_CALLOC_STRUCT(translated_vertex_program);
xvp->frag_inputs = fragInputsRead;
xvp->master = stvp;

View File

@ -798,7 +798,7 @@ st_init_bitmap(struct st_context *st)
}
/* alloc bitmap cache object */
st->bitmap.cache = CALLOC_STRUCT(bitmap_cache);
st->bitmap.cache = ST_CALLOC_STRUCT(bitmap_cache);
reset_cache(st);
}

View File

@ -55,7 +55,7 @@
static struct gl_buffer_object *
st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target)
{
struct st_buffer_object *st_obj = CALLOC_STRUCT(st_buffer_object);
struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object);
if (!st_obj)
return NULL;

View File

@ -232,7 +232,7 @@ st_new_framebuffer(GLcontext *ctx, GLuint name)
static struct gl_renderbuffer *
st_new_renderbuffer(GLcontext *ctx, GLuint name)
{
struct st_renderbuffer *strb = CALLOC_STRUCT(st_renderbuffer);
struct st_renderbuffer *strb = ST_CALLOC_STRUCT(st_renderbuffer);
if (strb) {
_mesa_init_renderbuffer(&strb->Base, name);
strb->Base.Delete = st_renderbuffer_delete;
@ -254,7 +254,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples)
{
struct st_renderbuffer *strb;
strb = CALLOC_STRUCT(st_renderbuffer);
strb = ST_CALLOC_STRUCT(st_renderbuffer);
if (!strb) {
_mesa_error(NULL, GL_OUT_OF_MEMORY, "creating renderbuffer");
return NULL;

View File

@ -184,7 +184,7 @@ feedback_destroy( struct draw_stage *stage )
static struct draw_stage *
draw_glfeedback_stage(GLcontext *ctx, struct draw_context *draw)
{
struct feedback_stage *fs = CALLOC_STRUCT(feedback_stage);
struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage);
fs->stage.draw = draw;
fs->stage.next = NULL;
@ -257,7 +257,7 @@ select_destroy( struct draw_stage *stage )
static struct draw_stage *
draw_glselect_stage(GLcontext *ctx, struct draw_context *draw)
{
struct feedback_stage *fs = CALLOC_STRUCT(feedback_stage);
struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage);
fs->stage.draw = draw;
fs->stage.next = NULL;

View File

@ -99,7 +99,7 @@ static struct gl_program *st_new_program( GLcontext *ctx,
{
switch (target) {
case GL_VERTEX_PROGRAM_ARB: {
struct st_vertex_program *prog = CALLOC_STRUCT(st_vertex_program);
struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program);
prog->serialNo = SerialNo++;
@ -111,7 +111,7 @@ static struct gl_program *st_new_program( GLcontext *ctx,
case GL_FRAGMENT_PROGRAM_ARB:
case GL_FRAGMENT_PROGRAM_NV: {
struct st_fragment_program *prog = CALLOC_STRUCT(st_fragment_program);
struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program);
prog->serialNo = SerialNo++;

View File

@ -64,7 +64,7 @@ st_query_object(struct gl_query_object *q)
static struct gl_query_object *
st_NewQueryObject(GLcontext *ctx, GLuint id)
{
struct st_query_object *stq = CALLOC_STRUCT(st_query_object);
struct st_query_object *stq = ST_CALLOC_STRUCT(st_query_object);
if (stq) {
stq->base.Id = id;
stq->base.Ready = GL_TRUE;

View File

@ -180,7 +180,7 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim)
static struct rastpos_stage *
new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw)
{
struct rastpos_stage *rs = CALLOC_STRUCT(rastpos_stage);
struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage);
GLuint i;
rs->stage.draw = draw;

View File

@ -114,7 +114,7 @@ st_NewTextureImage(GLcontext * ctx)
{
DBG("%s\n", __FUNCTION__);
(void) ctx;
return (struct gl_texture_image *) CALLOC_STRUCT(st_texture_image);
return (struct gl_texture_image *) ST_CALLOC_STRUCT(st_texture_image);
}
@ -122,7 +122,7 @@ st_NewTextureImage(GLcontext * ctx)
static struct gl_texture_object *
st_NewTextureObject(GLcontext * ctx, GLuint name, GLenum target)
{
struct st_texture_object *obj = CALLOC_STRUCT(st_texture_object);
struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object);
DBG("%s\n", __FUNCTION__);
_mesa_initialize_texture_object(&obj->base, name, target);

View File

@ -105,7 +105,7 @@ static struct st_context *
st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
{
uint i;
struct st_context *st = CALLOC_STRUCT( st_context );
struct st_context *st = ST_CALLOC_STRUCT( st_context );
ctx->st = st;

View File

@ -242,6 +242,10 @@ st_fb_orientation(const struct gl_framebuffer *fb)
}
/** clear-alloc a struct-sized object, with casting */
#define ST_CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T))
extern int
st_get_msaa(void);

View File

@ -49,7 +49,7 @@ st_create_framebuffer( const __GLcontextModes *visual,
uint width, uint height,
void *private)
{
struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer);
struct st_framebuffer *stfb = ST_CALLOC_STRUCT(st_framebuffer);
if (stfb) {
int samples = st_get_msaa();