static void nouveau_renderbuffer_del(struct gl_context *ctx, struct gl_renderbuffer *rb) { struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface; nouveau_surface_ref(NULL, s); _mesa_delete_renderbuffer(ctx, rb); }
/** * Called via gl_renderbuffer::Delete() */ static void soft_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb) { struct swrast_renderbuffer *srb = swrast_renderbuffer(rb); free(srb->Buffer); srb->Buffer = NULL; _mesa_delete_renderbuffer(ctx, rb); }
static void swrast_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb) { struct dri_swrast_renderbuffer *xrb = dri_swrast_renderbuffer(rb); TRACE; free(xrb->Base.Buffer); _mesa_delete_renderbuffer(ctx, rb); }
/** * gl_renderbuffer::Delete() */ static void st_renderbuffer_delete(struct gl_renderbuffer *rb) { struct st_renderbuffer *strb = st_renderbuffer(rb); ASSERT(strb); pipe_surface_reference(&strb->surface, NULL); pipe_resource_reference(&strb->texture, NULL); free(strb->data); _mesa_delete_renderbuffer(rb); }
/** Called by gl_renderbuffer::Delete() */ static void intel_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb) { struct intel_renderbuffer *irb = intel_renderbuffer(rb); ASSERT(irb); intel_miptree_release(&irb->mt); _mesa_delete_renderbuffer(ctx, rb); }
/** * gl_renderbuffer::Delete() */ static void st_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb) { struct st_renderbuffer *strb = st_renderbuffer(rb); if (ctx) { struct st_context *st = st_context(ctx); pipe_surface_release(st->pipe, &strb->surface); } pipe_resource_reference(&strb->texture, NULL); free(strb->data); _mesa_delete_renderbuffer(ctx, rb); }
/** * Don't use _mesa_delete_renderbuffer since we can't free rb->Buffer. */ static void osmesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb) { _mesa_delete_renderbuffer(ctx, rb); }
/** * Create a renderbuffer for a window's color, depth and/or stencil buffer. * Not used for user-created renderbuffers. */ struct radeon_renderbuffer * radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv) { struct radeon_renderbuffer *rrb; rrb = CALLOC_STRUCT(radeon_renderbuffer); radeon_print(RADEON_TEXTURE, RADEON_TRACE, "%s( rrb %p ) \n", __func__, rrb); if (!rrb) return NULL; _mesa_init_renderbuffer(&rrb->base, 0); rrb->base.ClassID = RADEON_RB_CLASS; rrb->base.Format = format; switch (format) { case MESA_FORMAT_RGB565: assert(_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case MESA_FORMAT_RGB565_REV: assert(!_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case MESA_FORMAT_XRGB8888: assert(_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case MESA_FORMAT_XRGB8888_REV: assert(!_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case MESA_FORMAT_ARGB8888: assert(_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGBA; break; case MESA_FORMAT_ARGB8888_REV: assert(!_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGBA; break; case MESA_FORMAT_S8: rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_STENCIL_INDEX; break; case MESA_FORMAT_Z16: rrb->base.DataType = GL_UNSIGNED_SHORT; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case MESA_FORMAT_X8_Z24: rrb->base.DataType = GL_UNSIGNED_INT; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case MESA_FORMAT_S8_Z24: rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; rrb->base._BaseFormat = GL_DEPTH_STENCIL; break; default: fprintf(stderr, "%s: Unknown format %s\n", __FUNCTION__, _mesa_get_format_name(format)); _mesa_delete_renderbuffer(&rrb->base); return NULL; } rrb->dPriv = driDrawPriv; rrb->base.InternalFormat = _mesa_get_format_base_format(format); rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_alloc_window_storage; rrb->base.GetPointer = radeon_get_pointer; rrb->bo = NULL; return rrb; }