/**
 * Allocate space for and store data in a buffer object.  Any data that was
 * previously stored in the buffer object is lost.  If data is NULL,
 * memory will be allocated, but no copy will occur.
 * Called via glBufferDataARB().
 */
static void intel_bufferobj_data( GLcontext *ctx,
                                  GLenum target,
                                  GLsizeiptrARB size,
                                  const GLvoid *data,
                                  GLenum usage,
                                  struct gl_buffer_object *obj )
{
    struct intel_context *intel = intel_context(ctx);
    struct intel_buffer_object *intel_obj = intel_buffer_object(obj);

    /* XXX: do something useful with 'usage' (eg. populate flags
     * argument below)
     */
    assert(intel_obj);

    obj->Size = size;
    obj->Usage = usage;

    bmBufferData(intel->bm, intel_obj->buffer, size, data, 0);
}
示例#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;
}