mesa: rename gl_renderbuffer::Data to Buffer
To better indicate that this pointer to the malloc'd memory.
This commit is contained in:
@@ -132,11 +132,11 @@ intel_map_renderbuffer(struct gl_context *ctx,
|
|||||||
void *map;
|
void *map;
|
||||||
int stride;
|
int stride;
|
||||||
|
|
||||||
if (!irb && rb->Data) {
|
if (!irb && rb->Buffer) {
|
||||||
/* this is a malloc'd renderbuffer (accum buffer) */
|
/* this is a malloc'd renderbuffer (accum buffer) */
|
||||||
GLint bpp = _mesa_get_format_bytes(rb->Format);
|
GLint bpp = _mesa_get_format_bytes(rb->Format);
|
||||||
GLint rowStride = rb->RowStrideBytes;
|
GLint rowStride = rb->RowStrideBytes;
|
||||||
*out_map = (GLubyte *) rb->Data + y * rowStride + x * bpp;
|
*out_map = (GLubyte *) rb->Buffer + y * rowStride + x * bpp;
|
||||||
*out_stride = rowStride;
|
*out_stride = rowStride;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@ intel_unmap_renderbuffer(struct gl_context *ctx,
|
|||||||
DBG("%s: rb %d (%s)\n", __FUNCTION__,
|
DBG("%s: rb %d (%s)\n", __FUNCTION__,
|
||||||
rb->Name, _mesa_get_format_name(rb->Format));
|
rb->Name, _mesa_get_format_name(rb->Format));
|
||||||
|
|
||||||
if (!irb && rb->Data) {
|
if (!irb && rb->Buffer) {
|
||||||
/* this is a malloc'd renderbuffer (accum buffer) */
|
/* this is a malloc'd renderbuffer (accum buffer) */
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
return;
|
return;
|
||||||
|
@@ -265,7 +265,7 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
|
|||||||
{
|
{
|
||||||
TRACE;
|
TRACE;
|
||||||
|
|
||||||
free(rb->Data);
|
free(rb->Buffer);
|
||||||
free(rb);
|
free(rb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ swrast_alloc_front_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||||||
(void) ctx;
|
(void) ctx;
|
||||||
(void) internalFormat;
|
(void) internalFormat;
|
||||||
|
|
||||||
rb->Data = NULL;
|
rb->Buffer = NULL;
|
||||||
rb->Width = width;
|
rb->Width = width;
|
||||||
rb->Height = height;
|
rb->Height = height;
|
||||||
xrb->pitch = bytes_per_line(width * xrb->bpp, 32);
|
xrb->pitch = bytes_per_line(width * xrb->bpp, 32);
|
||||||
@@ -305,11 +305,11 @@ swrast_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||||||
|
|
||||||
TRACE;
|
TRACE;
|
||||||
|
|
||||||
free(rb->Data);
|
free(rb->Buffer);
|
||||||
|
|
||||||
swrast_alloc_front_storage(ctx, rb, internalFormat, width, height);
|
swrast_alloc_front_storage(ctx, rb, internalFormat, width, height);
|
||||||
|
|
||||||
rb->Data = malloc(height * xrb->pitch);
|
rb->Buffer = malloc(height * xrb->pitch);
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
@@ -380,7 +380,7 @@ swrast_map_renderbuffer(struct gl_context *ctx,
|
|||||||
GLint *out_stride)
|
GLint *out_stride)
|
||||||
{
|
{
|
||||||
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
|
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
|
||||||
GLubyte *map = rb->Data;
|
GLubyte *map = rb->Buffer;
|
||||||
int cpp = _mesa_get_format_bytes(rb->Format);
|
int cpp = _mesa_get_format_bytes(rb->Format);
|
||||||
int stride = rb->Width * cpp;
|
int stride = rb->Width * cpp;
|
||||||
|
|
||||||
@@ -395,18 +395,18 @@ swrast_map_renderbuffer(struct gl_context *ctx,
|
|||||||
xrb->map_h = h;
|
xrb->map_h = h;
|
||||||
|
|
||||||
stride = w * cpp;
|
stride = w * cpp;
|
||||||
rb->Data = malloc(h * stride);
|
rb->Buffer = malloc(h * stride);
|
||||||
|
|
||||||
sPriv->swrast_loader->getImage(dPriv, x, y, w, h,
|
sPriv->swrast_loader->getImage(dPriv, x, y, w, h,
|
||||||
(char *)rb->Data,
|
(char *)rb->Buffer,
|
||||||
dPriv->loaderPrivate);
|
dPriv->loaderPrivate);
|
||||||
|
|
||||||
*out_map = rb->Data;
|
*out_map = rb->Buffer;
|
||||||
*out_stride = stride;
|
*out_stride = stride;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(rb->Data);
|
ASSERT(rb->Buffer);
|
||||||
|
|
||||||
if (rb->AllocStorage == swrast_alloc_back_storage) {
|
if (rb->AllocStorage == swrast_alloc_back_storage) {
|
||||||
map += (rb->Height - 1) * stride;
|
map += (rb->Height - 1) * stride;
|
||||||
@@ -434,12 +434,12 @@ swrast_unmap_renderbuffer(struct gl_context *ctx,
|
|||||||
sPriv->swrast_loader->putImage(dPriv, __DRI_SWRAST_IMAGE_OP_DRAW,
|
sPriv->swrast_loader->putImage(dPriv, __DRI_SWRAST_IMAGE_OP_DRAW,
|
||||||
xrb->map_x, xrb->map_y,
|
xrb->map_x, xrb->map_y,
|
||||||
xrb->map_w, xrb->map_h,
|
xrb->map_w, xrb->map_h,
|
||||||
rb->Data,
|
rb->Buffer,
|
||||||
dPriv->loaderPrivate);
|
dPriv->loaderPrivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(rb->Data);
|
free(rb->Buffer);
|
||||||
rb->Data = NULL;
|
rb->Buffer = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,7 +556,7 @@ dri_swap_buffers(__DRIdrawable * dPriv)
|
|||||||
0, 0,
|
0, 0,
|
||||||
frontrb->Base.Width,
|
frontrb->Base.Width,
|
||||||
frontrb->Base.Height,
|
frontrb->Base.Height,
|
||||||
backrb->Base.Data,
|
backrb->Base.Buffer,
|
||||||
dPriv->loaderPrivate);
|
dPriv->loaderPrivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -354,7 +354,7 @@ static void
|
|||||||
compute_row_addresses( OSMesaContext osmesa )
|
compute_row_addresses( OSMesaContext osmesa )
|
||||||
{
|
{
|
||||||
GLint bytesPerRow, i;
|
GLint bytesPerRow, i;
|
||||||
GLubyte *origin = (GLubyte *) osmesa->rb->Data;
|
GLubyte *origin = (GLubyte *) osmesa->rb->Buffer;
|
||||||
GLint rowlength; /* in pixels */
|
GLint rowlength; /* in pixels */
|
||||||
GLint height = osmesa->rb->Height;
|
GLint height = osmesa->rb->Height;
|
||||||
|
|
||||||
@@ -383,7 +383,7 @@ compute_row_addresses( OSMesaContext osmesa )
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Don't use _mesa_delete_renderbuffer since we can't free rb->Data.
|
* Don't use _mesa_delete_renderbuffer since we can't free rb->Buffer.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
osmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
|
osmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
|
||||||
@@ -891,7 +891,7 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
|
|||||||
/* Set renderbuffer fields. Set width/height = 0 to force
|
/* Set renderbuffer fields. Set width/height = 0 to force
|
||||||
* osmesa_renderbuffer_storage() being called by _mesa_resize_framebuffer()
|
* osmesa_renderbuffer_storage() being called by _mesa_resize_framebuffer()
|
||||||
*/
|
*/
|
||||||
osmesa->rb->Data = buffer;
|
osmesa->rb->Buffer = buffer;
|
||||||
osmesa->rb->Width = osmesa->rb->Height = 0;
|
osmesa->rb->Width = osmesa->rb->Height = 0;
|
||||||
|
|
||||||
/* Set the framebuffer's size. This causes the
|
/* Set the framebuffer's size. This causes the
|
||||||
@@ -1024,7 +1024,7 @@ OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height,
|
|||||||
if (c->gl_buffer)
|
if (c->gl_buffer)
|
||||||
rb = c->gl_buffer->Attachment[BUFFER_DEPTH].Renderbuffer;
|
rb = c->gl_buffer->Attachment[BUFFER_DEPTH].Renderbuffer;
|
||||||
|
|
||||||
if (!rb || !rb->Data) {
|
if (!rb || !rb->Buffer) {
|
||||||
*width = 0;
|
*width = 0;
|
||||||
*height = 0;
|
*height = 0;
|
||||||
*bytesPerValue = 0;
|
*bytesPerValue = 0;
|
||||||
@@ -1038,7 +1038,7 @@ OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height,
|
|||||||
*bytesPerValue = sizeof(GLushort);
|
*bytesPerValue = sizeof(GLushort);
|
||||||
else
|
else
|
||||||
*bytesPerValue = sizeof(GLuint);
|
*bytesPerValue = sizeof(GLuint);
|
||||||
*buffer = rb->Data;
|
*buffer = (void *) rb->Buffer;
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1056,11 +1056,11 @@ GLAPI GLboolean GLAPIENTRY
|
|||||||
OSMesaGetColorBuffer( OSMesaContext osmesa, GLint *width,
|
OSMesaGetColorBuffer( OSMesaContext osmesa, GLint *width,
|
||||||
GLint *height, GLint *format, void **buffer )
|
GLint *height, GLint *format, void **buffer )
|
||||||
{
|
{
|
||||||
if (osmesa->rb && osmesa->rb->Data) {
|
if (osmesa->rb && osmesa->rb->Buffer) {
|
||||||
*width = osmesa->rb->Width;
|
*width = osmesa->rb->Width;
|
||||||
*height = osmesa->rb->Height;
|
*height = osmesa->rb->Height;
|
||||||
*format = osmesa->format;
|
*format = osmesa->format;
|
||||||
*buffer = osmesa->rb->Data;
|
*buffer = (void *) osmesa->rb->Buffer;
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -1484,7 +1484,7 @@ GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height,
|
|||||||
{
|
{
|
||||||
struct gl_renderbuffer *rb
|
struct gl_renderbuffer *rb
|
||||||
= b->mesa_buffer.Attachment[BUFFER_DEPTH].Renderbuffer;
|
= b->mesa_buffer.Attachment[BUFFER_DEPTH].Renderbuffer;
|
||||||
if (!rb || !rb->Data) {
|
if (!rb || !rb->Buffer) {
|
||||||
*width = 0;
|
*width = 0;
|
||||||
*height = 0;
|
*height = 0;
|
||||||
*bytesPerValue = 0;
|
*bytesPerValue = 0;
|
||||||
@@ -1496,7 +1496,7 @@ GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height,
|
|||||||
*height = b->mesa_buffer.Height;
|
*height = b->mesa_buffer.Height;
|
||||||
*bytesPerValue = b->mesa_buffer.Visual.depthBits <= 16
|
*bytesPerValue = b->mesa_buffer.Visual.depthBits <= 16
|
||||||
? sizeof(GLushort) : sizeof(GLuint);
|
? sizeof(GLushort) : sizeof(GLuint);
|
||||||
*buffer = rb->Data;
|
*buffer = (void *) rb->Buffer;
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2559,7 +2559,7 @@ struct gl_renderbuffer
|
|||||||
gl_format Format; /**< The actual renderbuffer memory format */
|
gl_format Format; /**< The actual renderbuffer memory format */
|
||||||
|
|
||||||
/* XXX the following fields are obsolete and wil go away */
|
/* XXX the following fields are obsolete and wil go away */
|
||||||
GLvoid *Data; /**< This may not be used by some kinds of RBs */
|
GLvoid *Buffer; /**< Malloc'd memory for software buffers */
|
||||||
|
|
||||||
/** The following fields are only valid while the buffer is mapped */
|
/** The following fields are only valid while the buffer is mapped */
|
||||||
GLubyte *Map;
|
GLubyte *Map;
|
||||||
|
@@ -113,18 +113,18 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* free old buffer storage */
|
/* free old buffer storage */
|
||||||
if (rb->Data) {
|
if (rb->Buffer) {
|
||||||
free(rb->Data);
|
free(rb->Buffer);
|
||||||
rb->Data = NULL;
|
rb->Buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->RowStrideBytes = width * _mesa_get_format_bytes(rb->Format);
|
rb->RowStrideBytes = width * _mesa_get_format_bytes(rb->Format);
|
||||||
|
|
||||||
if (width > 0 && height > 0) {
|
if (width > 0 && height > 0) {
|
||||||
/* allocate new buffer storage */
|
/* allocate new buffer storage */
|
||||||
rb->Data = malloc(width * height * _mesa_get_format_bytes(rb->Format));
|
rb->Buffer = malloc(width * height * _mesa_get_format_bytes(rb->Format));
|
||||||
|
|
||||||
if (rb->Data == NULL) {
|
if (rb->Buffer == NULL) {
|
||||||
rb->Width = 0;
|
rb->Width = 0;
|
||||||
rb->Height = 0;
|
rb->Height = 0;
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY,
|
_mesa_error(ctx, GL_OUT_OF_MEMORY,
|
||||||
@@ -162,9 +162,9 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||||||
static void
|
static void
|
||||||
soft_renderbuffer_delete(struct gl_renderbuffer *rb)
|
soft_renderbuffer_delete(struct gl_renderbuffer *rb)
|
||||||
{
|
{
|
||||||
if (rb->Data) {
|
if (rb->Buffer) {
|
||||||
free(rb->Data);
|
free(rb->Buffer);
|
||||||
rb->Data = NULL;
|
rb->Buffer = NULL;
|
||||||
}
|
}
|
||||||
free(rb);
|
free(rb);
|
||||||
}
|
}
|
||||||
@@ -178,11 +178,14 @@ _swrast_map_soft_renderbuffer(struct gl_context *ctx,
|
|||||||
GLubyte **out_map,
|
GLubyte **out_map,
|
||||||
GLint *out_stride)
|
GLint *out_stride)
|
||||||
{
|
{
|
||||||
GLubyte *map = rb->Data;
|
GLubyte *map = rb->Buffer;
|
||||||
int cpp = _mesa_get_format_bytes(rb->Format);
|
int cpp = _mesa_get_format_bytes(rb->Format);
|
||||||
int stride = rb->Width * cpp;
|
int stride = rb->Width * cpp;
|
||||||
|
|
||||||
ASSERT(rb->Data);
|
if (!map) {
|
||||||
|
*out_map = NULL;
|
||||||
|
*out_stride = 0;
|
||||||
|
}
|
||||||
|
|
||||||
map += y * stride;
|
map += y * stride;
|
||||||
map += x * cpp;
|
map += x * cpp;
|
||||||
|
@@ -135,12 +135,12 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
|
|||||||
*/
|
*/
|
||||||
if (att->Texture->Target == GL_TEXTURE_3D ||
|
if (att->Texture->Target == GL_TEXTURE_3D ||
|
||||||
att->Texture->Target == GL_TEXTURE_2D_ARRAY_EXT) {
|
att->Texture->Target == GL_TEXTURE_2D_ARRAY_EXT) {
|
||||||
trb->Base.Data = trb->TexImage->Buffer +
|
trb->Base.Buffer = trb->TexImage->Buffer +
|
||||||
trb->TexImage->ImageOffsets[trb->Zoffset] *
|
trb->TexImage->ImageOffsets[trb->Zoffset] *
|
||||||
_mesa_get_format_bytes(trb->TexImage->Base.TexFormat);
|
_mesa_get_format_bytes(trb->TexImage->Base.TexFormat);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
trb->Base.Data = trb->TexImage->Buffer;
|
trb->Base.Buffer = trb->TexImage->Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX may need more special cases here */
|
/* XXX may need more special cases here */
|
||||||
|
Reference in New Issue
Block a user