/* 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;
}
/* alloc bitmap cache object */
- st->bitmap.cache = CALLOC_STRUCT(bitmap_cache);
+ st->bitmap.cache = ST_CALLOC_STRUCT(bitmap_cache);
reset_cache(st);
}
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;
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;
{
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;
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;
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;
{
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++;
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++;
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;
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;
{
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);
}
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);
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;
}
+/** 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);
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();