int dims, int width, int height, int depth,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing,
- GLuint *tmp_pbo, GLuint *tmp_tex)
+ struct gl_buffer_object **tmp_pbo, GLuint *tmp_tex)
{
uint32_t pbo_format;
GLenum internal_format;
row_stride = _mesa_image_row_stride(packing, width, format, type);
if (_mesa_is_bufferobj(packing->BufferObj)) {
- *tmp_pbo = 0;
+ *tmp_pbo = NULL;
buffer_obj = packing->BufferObj;
first_pixel += (intptr_t)pixels;
} else {
assert(create_pbo);
- _mesa_CreateBuffers(1, tmp_pbo);
+ *tmp_pbo = ctx->Driver.NewBufferObject(ctx, 0xDEADBEEF);
+ if (*tmp_pbo == NULL)
+ return NULL;
/* In case of GL_PIXEL_PACK_BUFFER, pass null pointer for the pixel
- * data to avoid unnecessary data copying in _mesa_NamedBufferData().
+ * data to avoid unnecessary data copying in _mesa_buffer_data.
*/
if (is_pixel_pack)
- _mesa_NamedBufferData(*tmp_pbo,
- last_pixel - first_pixel,
- NULL,
- GL_STREAM_READ);
+ _mesa_buffer_data(ctx, *tmp_pbo, GL_NONE,
+ last_pixel - first_pixel,
+ NULL,
+ GL_STREAM_READ,
+ __func__);
else
- _mesa_NamedBufferData(*tmp_pbo,
- last_pixel - first_pixel,
- (char *)pixels + first_pixel,
- GL_STREAM_DRAW);
+ _mesa_buffer_data(ctx, *tmp_pbo, GL_NONE,
+ last_pixel - first_pixel,
+ (char *)pixels + first_pixel,
+ GL_STREAM_DRAW,
+ __func__);
- buffer_obj = _mesa_lookup_bufferobj(ctx, *tmp_pbo);
+ buffer_obj = *tmp_pbo;
first_pixel = 0;
}
row_stride,
read_only)) {
_mesa_DeleteTextures(1, tmp_tex);
- _mesa_DeleteBuffers(1, tmp_pbo);
+ _mesa_reference_buffer_object(ctx, tmp_pbo, NULL);
return NULL;
}
bool allocate_storage, bool create_pbo,
const struct gl_pixelstore_attrib *packing)
{
- GLuint pbo = 0, pbo_tex = 0, fbos[2] = { 0, 0 };
+ struct gl_buffer_object *pbo = NULL;
+ GLuint pbo_tex = 0, fbos[2] = { 0, 0 };
int image_height;
struct gl_texture_image *pbo_tex_image;
GLenum status;
fail:
_mesa_DeleteFramebuffers(2, fbos);
_mesa_DeleteTextures(1, &pbo_tex);
- _mesa_DeleteBuffers(1, &pbo);
+ _mesa_reference_buffer_object(ctx, &pbo, NULL);
_mesa_meta_end(ctx);
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing)
{
- GLuint pbo = 0, pbo_tex = 0, fbos[2] = { 0, 0 };
+ struct gl_buffer_object *pbo = NULL;
+ GLuint pbo_tex = 0, fbos[2] = { 0, 0 };
int image_height;
struct gl_texture_image *pbo_tex_image;
struct gl_renderbuffer *rb = NULL;
fail:
_mesa_DeleteFramebuffers(2, fbos);
_mesa_DeleteTextures(1, &pbo_tex);
- _mesa_DeleteBuffers(1, &pbo);
+ _mesa_reference_buffer_object(ctx, &pbo, NULL);
_mesa_meta_end(ctx);