mesa: use new ST_CALLOC_STRUCT() macro in gallium state tracker
This commit is contained in:
parent
1a2f4dd876
commit
f1a59a6dd7
|
@ -165,7 +165,7 @@ find_translated_vp(struct st_context *st,
|
||||||
|
|
||||||
/* No? Allocate translated vp object now */
|
/* No? Allocate translated vp object now */
|
||||||
if (!xvp) {
|
if (!xvp) {
|
||||||
xvp = CALLOC_STRUCT(translated_vertex_program);
|
xvp = ST_CALLOC_STRUCT(translated_vertex_program);
|
||||||
xvp->frag_inputs = fragInputsRead;
|
xvp->frag_inputs = fragInputsRead;
|
||||||
xvp->master = stvp;
|
xvp->master = stvp;
|
||||||
|
|
||||||
|
|
|
@ -798,7 +798,7 @@ st_init_bitmap(struct st_context *st)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* alloc bitmap cache object */
|
/* alloc bitmap cache object */
|
||||||
st->bitmap.cache = CALLOC_STRUCT(bitmap_cache);
|
st->bitmap.cache = ST_CALLOC_STRUCT(bitmap_cache);
|
||||||
|
|
||||||
reset_cache(st);
|
reset_cache(st);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
static struct gl_buffer_object *
|
static struct gl_buffer_object *
|
||||||
st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target)
|
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)
|
if (!st_obj)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -232,7 +232,7 @@ st_new_framebuffer(GLcontext *ctx, GLuint name)
|
||||||
static struct gl_renderbuffer *
|
static struct gl_renderbuffer *
|
||||||
st_new_renderbuffer(GLcontext *ctx, GLuint name)
|
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) {
|
if (strb) {
|
||||||
_mesa_init_renderbuffer(&strb->Base, name);
|
_mesa_init_renderbuffer(&strb->Base, name);
|
||||||
strb->Base.Delete = st_renderbuffer_delete;
|
strb->Base.Delete = st_renderbuffer_delete;
|
||||||
|
@ -254,7 +254,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples)
|
||||||
{
|
{
|
||||||
struct st_renderbuffer *strb;
|
struct st_renderbuffer *strb;
|
||||||
|
|
||||||
strb = CALLOC_STRUCT(st_renderbuffer);
|
strb = ST_CALLOC_STRUCT(st_renderbuffer);
|
||||||
if (!strb) {
|
if (!strb) {
|
||||||
_mesa_error(NULL, GL_OUT_OF_MEMORY, "creating renderbuffer");
|
_mesa_error(NULL, GL_OUT_OF_MEMORY, "creating renderbuffer");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -184,7 +184,7 @@ feedback_destroy( struct draw_stage *stage )
|
||||||
static struct draw_stage *
|
static struct draw_stage *
|
||||||
draw_glfeedback_stage(GLcontext *ctx, struct draw_context *draw)
|
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.draw = draw;
|
||||||
fs->stage.next = NULL;
|
fs->stage.next = NULL;
|
||||||
|
@ -257,7 +257,7 @@ select_destroy( struct draw_stage *stage )
|
||||||
static struct draw_stage *
|
static struct draw_stage *
|
||||||
draw_glselect_stage(GLcontext *ctx, struct draw_context *draw)
|
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.draw = draw;
|
||||||
fs->stage.next = NULL;
|
fs->stage.next = NULL;
|
||||||
|
|
|
@ -99,7 +99,7 @@ static struct gl_program *st_new_program( GLcontext *ctx,
|
||||||
{
|
{
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case GL_VERTEX_PROGRAM_ARB: {
|
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++;
|
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_ARB:
|
||||||
case GL_FRAGMENT_PROGRAM_NV: {
|
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++;
|
prog->serialNo = SerialNo++;
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ st_query_object(struct gl_query_object *q)
|
||||||
static struct gl_query_object *
|
static struct gl_query_object *
|
||||||
st_NewQueryObject(GLcontext *ctx, GLuint id)
|
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) {
|
if (stq) {
|
||||||
stq->base.Id = id;
|
stq->base.Id = id;
|
||||||
stq->base.Ready = GL_TRUE;
|
stq->base.Ready = GL_TRUE;
|
||||||
|
|
|
@ -180,7 +180,7 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim)
|
||||||
static struct rastpos_stage *
|
static struct rastpos_stage *
|
||||||
new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw)
|
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;
|
GLuint i;
|
||||||
|
|
||||||
rs->stage.draw = draw;
|
rs->stage.draw = draw;
|
||||||
|
|
|
@ -114,7 +114,7 @@ st_NewTextureImage(GLcontext * ctx)
|
||||||
{
|
{
|
||||||
DBG("%s\n", __FUNCTION__);
|
DBG("%s\n", __FUNCTION__);
|
||||||
(void) ctx;
|
(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 *
|
static struct gl_texture_object *
|
||||||
st_NewTextureObject(GLcontext * ctx, GLuint name, GLenum target)
|
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__);
|
DBG("%s\n", __FUNCTION__);
|
||||||
_mesa_initialize_texture_object(&obj->base, name, target);
|
_mesa_initialize_texture_object(&obj->base, name, target);
|
||||||
|
|
|
@ -105,7 +105,7 @@ static struct st_context *
|
||||||
st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
|
st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
struct st_context *st = CALLOC_STRUCT( st_context );
|
struct st_context *st = ST_CALLOC_STRUCT( st_context );
|
||||||
|
|
||||||
ctx->st = st;
|
ctx->st = st;
|
||||||
|
|
||||||
|
|
|
@ -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
|
extern int
|
||||||
st_get_msaa(void);
|
st_get_msaa(void);
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ st_create_framebuffer( const __GLcontextModes *visual,
|
||||||
uint width, uint height,
|
uint width, uint height,
|
||||||
void *private)
|
void *private)
|
||||||
{
|
{
|
||||||
struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer);
|
struct st_framebuffer *stfb = ST_CALLOC_STRUCT(st_framebuffer);
|
||||||
if (stfb) {
|
if (stfb) {
|
||||||
int samples = st_get_msaa();
|
int samples = st_get_msaa();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue