aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/swrast/swrast.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-25 08:32:49 +0100
committermarha <marha@users.sourceforge.net>2012-01-25 08:32:49 +0100
commit0c1cee47049afdcf74d87a23f4f4fd57867f6798 (patch)
tree14c117114d1b996e5b04e6546b1580ea53bc26f2 /mesalib/src/mesa/drivers/dri/swrast/swrast.c
parent5be921907008288d6465962063bc10fd7a5b1906 (diff)
parente6432710d8a586386b3c7025e845cf4f80830da3 (diff)
downloadvcxsrv-0c1cee47049afdcf74d87a23f4f4fd57867f6798.tar.gz
vcxsrv-0c1cee47049afdcf74d87a23f4f4fd57867f6798.tar.bz2
vcxsrv-0c1cee47049afdcf74d87a23f4f4fd57867f6798.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/swrast/swrast.c')
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c104
1 files changed, 51 insertions, 53 deletions
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index f8d749453..ff26e2769 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -99,7 +99,7 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
_mesa_init_teximage_fields(&dri_ctx->Base, texImage,
w, h, 1, 0, internalFormat, texFormat);
- sPriv->swrast_loader->getImage(dPriv, x, y, w, h, (char *)swImage->Data,
+ sPriv->swrast_loader->getImage(dPriv, x, y, w, h, (char *)swImage->Buffer,
dPriv->loaderPrivate);
_mesa_unlock_texture(&dri_ctx->Base, texObj);
@@ -268,10 +268,12 @@ choose_pixel_format(const struct gl_config *v)
static void
swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
{
+ struct dri_swrast_renderbuffer *xrb = dri_swrast_renderbuffer(rb);
+
TRACE;
- free(rb->Data);
- free(rb);
+ free(xrb->Base.Buffer);
+ free(xrb);
}
/* see bytes_per_line in libGL */
@@ -287,17 +289,16 @@ static GLboolean
swrast_alloc_front_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
+ struct dri_swrast_renderbuffer *xrb = dri_swrast_renderbuffer(rb);
TRACE;
(void) ctx;
(void) internalFormat;
- rb->Data = NULL;
+ xrb->Base.Buffer = NULL;
rb->Width = width;
rb->Height = height;
- rb->RowStride = width;
xrb->pitch = bytes_per_line(width * xrb->bpp, 32);
return GL_TRUE;
@@ -307,24 +308,25 @@ static GLboolean
swrast_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
+ struct dri_swrast_renderbuffer *xrb = dri_swrast_renderbuffer(rb);
TRACE;
- free(rb->Data);
+ free(xrb->Base.Buffer);
swrast_alloc_front_storage(ctx, rb, internalFormat, width, height);
- rb->Data = malloc(height * xrb->pitch);
+ xrb->Base.Buffer = malloc(height * xrb->pitch);
return GL_TRUE;
}
-static struct swrast_renderbuffer *
+static struct dri_swrast_renderbuffer *
swrast_new_renderbuffer(const struct gl_config *visual, __DRIdrawable *dPriv,
GLboolean front)
{
- struct swrast_renderbuffer *xrb = calloc(1, sizeof *xrb);
+ struct dri_swrast_renderbuffer *xrb = calloc(1, sizeof *xrb);
+ struct gl_renderbuffer *rb;
GLuint pixel_format;
TRACE;
@@ -332,48 +334,44 @@ swrast_new_renderbuffer(const struct gl_config *visual, __DRIdrawable *dPriv,
if (!xrb)
return NULL;
- _mesa_init_renderbuffer(&xrb->Base, 0);
+ rb = &xrb->Base.Base;
+
+ _mesa_init_renderbuffer(rb, 0);
pixel_format = choose_pixel_format(visual);
xrb->dPriv = dPriv;
- xrb->Base.Delete = swrast_delete_renderbuffer;
+ xrb->Base.Base.Delete = swrast_delete_renderbuffer;
if (front) {
- xrb->Base.AllocStorage = swrast_alloc_front_storage;
- swrast_set_span_funcs_front(xrb, pixel_format);
+ rb->AllocStorage = swrast_alloc_front_storage;
}
else {
- xrb->Base.AllocStorage = swrast_alloc_back_storage;
- swrast_set_span_funcs_back(xrb, pixel_format);
+ rb->AllocStorage = swrast_alloc_back_storage;
}
switch (pixel_format) {
case PF_A8R8G8B8:
- xrb->Base.Format = MESA_FORMAT_ARGB8888;
- xrb->Base.InternalFormat = GL_RGBA;
- xrb->Base._BaseFormat = GL_RGBA;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
+ rb->Format = MESA_FORMAT_ARGB8888;
+ rb->InternalFormat = GL_RGBA;
+ rb->_BaseFormat = GL_RGBA;
xrb->bpp = 32;
break;
case PF_X8R8G8B8:
- xrb->Base.Format = MESA_FORMAT_ARGB8888; /* XXX */
- xrb->Base.InternalFormat = GL_RGB;
- xrb->Base._BaseFormat = GL_RGB;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
+ rb->Format = MESA_FORMAT_ARGB8888; /* XXX */
+ rb->InternalFormat = GL_RGB;
+ rb->_BaseFormat = GL_RGB;
xrb->bpp = 32;
break;
case PF_R5G6B5:
- xrb->Base.Format = MESA_FORMAT_RGB565;
- xrb->Base.InternalFormat = GL_RGB;
- xrb->Base._BaseFormat = GL_RGB;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
+ rb->Format = MESA_FORMAT_RGB565;
+ rb->InternalFormat = GL_RGB;
+ rb->_BaseFormat = GL_RGB;
xrb->bpp = 16;
break;
case PF_R3G3B2:
- xrb->Base.Format = MESA_FORMAT_RGB332;
- xrb->Base.InternalFormat = GL_RGB;
- xrb->Base._BaseFormat = GL_RGB;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
+ rb->Format = MESA_FORMAT_RGB332;
+ rb->InternalFormat = GL_RGB;
+ rb->_BaseFormat = GL_RGB;
xrb->bpp = 8;
break;
default:
@@ -391,10 +389,10 @@ swrast_map_renderbuffer(struct gl_context *ctx,
GLubyte **out_map,
GLint *out_stride)
{
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
- GLubyte *map = rb->Data;
+ struct dri_swrast_renderbuffer *xrb = dri_swrast_renderbuffer(rb);
+ GLubyte *map = xrb->Base.Buffer;
int cpp = _mesa_get_format_bytes(rb->Format);
- int stride = rb->RowStride * cpp;
+ int stride = rb->Width * cpp;
if (rb->AllocStorage == swrast_alloc_front_storage) {
__DRIdrawable *dPriv = xrb->dPriv;
@@ -407,18 +405,18 @@ swrast_map_renderbuffer(struct gl_context *ctx,
xrb->map_h = h;
stride = w * cpp;
- rb->Data = malloc(h * stride);
+ xrb->Base.Buffer = malloc(h * stride);
sPriv->swrast_loader->getImage(dPriv, x, y, w, h,
- (char *)rb->Data,
+ (char *) xrb->Base.Buffer,
dPriv->loaderPrivate);
- *out_map = rb->Data;
+ *out_map = xrb->Base.Buffer;
*out_stride = stride;
return;
}
- ASSERT(rb->Data);
+ ASSERT(xrb->Base.Buffer);
if (rb->AllocStorage == swrast_alloc_back_storage) {
map += (rb->Height - 1) * stride;
@@ -436,7 +434,7 @@ static void
swrast_unmap_renderbuffer(struct gl_context *ctx,
struct gl_renderbuffer *rb)
{
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
+ struct dri_swrast_renderbuffer *xrb = dri_swrast_renderbuffer(rb);
if (rb->AllocStorage == swrast_alloc_front_storage) {
__DRIdrawable *dPriv = xrb->dPriv;
@@ -446,12 +444,12 @@ swrast_unmap_renderbuffer(struct gl_context *ctx,
sPriv->swrast_loader->putImage(dPriv, __DRI_SWRAST_IMAGE_OP_DRAW,
xrb->map_x, xrb->map_y,
xrb->map_w, xrb->map_h,
- rb->Data,
+ (char *) xrb->Base.Buffer,
dPriv->loaderPrivate);
}
- free(rb->Data);
- rb->Data = NULL;
+ free(xrb->Base.Buffer);
+ xrb->Base.Buffer = NULL;
}
}
@@ -462,7 +460,7 @@ dri_create_buffer(__DRIscreen * sPriv,
{
struct dri_drawable *drawable = NULL;
struct gl_framebuffer *fb;
- struct swrast_renderbuffer *frontrb, *backrb;
+ struct dri_swrast_renderbuffer *frontrb, *backrb;
TRACE;
@@ -487,12 +485,12 @@ dri_create_buffer(__DRIscreen * sPriv,
/* add front renderbuffer */
frontrb = swrast_new_renderbuffer(visual, dPriv, GL_TRUE);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontrb->Base);
+ _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontrb->Base.Base);
/* add back renderbuffer */
if (visual->doubleBufferMode) {
backrb = swrast_new_renderbuffer(visual, dPriv, GL_FALSE);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backrb->Base);
+ _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backrb->Base.Base);
}
/* add software renderbuffers */
@@ -543,16 +541,16 @@ dri_swap_buffers(__DRIdrawable * dPriv)
struct dri_drawable *drawable = dri_drawable(dPriv);
struct gl_framebuffer *fb;
- struct swrast_renderbuffer *frontrb, *backrb;
+ struct dri_swrast_renderbuffer *frontrb, *backrb;
TRACE;
fb = &drawable->Base;
frontrb =
- swrast_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
+ dri_swrast_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
backrb =
- swrast_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
+ dri_swrast_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
/* check for signle-buffered */
if (backrb == NULL)
@@ -566,9 +564,9 @@ dri_swap_buffers(__DRIdrawable * dPriv)
sPriv->swrast_loader->putImage(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
0, 0,
- frontrb->Base.Width,
- frontrb->Base.Height,
- backrb->Base.Data,
+ frontrb->Base.Base.Width,
+ frontrb->Base.Base.Height,
+ (char *) backrb->Base.Buffer,
dPriv->loaderPrivate);
}