/**
 * There is some duplication between mesa's bufferobjects and our
 * bufmgr buffers.  Both have an integer handle and a hashtable to
 * lookup an opaque structure.  It would be nice if the handles and
 * internal structure where somehow shared.
 */
static struct gl_buffer_object *intel_bufferobj_alloc( GLcontext *ctx,
        GLuint name,
        GLenum target )
{
    struct intel_context *intel = intel_context(ctx);
    struct intel_buffer_object *obj = MALLOC_STRUCT(intel_buffer_object);

    _mesa_initialize_buffer_object(&obj->Base, name, target);

    /* XXX:  We generate our own handle, which is different to 'name' above.
     */
    bmGenBuffers(intel->bm, 1, &obj->buffer, 0);

    return &obj->Base;
}
示例#2
0
struct intel_region *intel_region_alloc( struct intel_context *intel, 
					 GLuint cpp,
					 GLuint pitch, 
					 GLuint height )
{
   struct intel_region *region = calloc(sizeof(*region), 1);

   DBG("%s %dx%dx%d == 0x%x bytes\n", __FUNCTION__,
       cpp, pitch, height, cpp*pitch*height);

   region->cpp = cpp;
   region->pitch = pitch;
   region->height = height; 	/* needed? */
   region->refcount = 1;

   bmGenBuffers(intel, "tex", 1, &region->buffer, 6);
   bmBufferData(intel, region->buffer, pitch * cpp * height, NULL, 0);

   return region;
}