aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/swrast
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-25 08:24:51 +0100
committermarha <marha@users.sourceforge.net>2012-01-25 08:24:51 +0100
commite6432710d8a586386b3c7025e845cf4f80830da3 (patch)
treea403fa86779a287c97f5605f9b4d455d662ece66 /mesalib/src/mesa/drivers/dri/swrast
parentd3f0fe49b8cb29295f3e529cc699a2abde1515a1 (diff)
downloadvcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.tar.gz
vcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.tar.bz2
vcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.zip
mesa git update 25 jan 2012
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/swrast')
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/Makefile.sources3
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c104
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h21
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast_span.c347
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h223
5 files changed, 58 insertions, 640 deletions
diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources b/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources
index 9de5cb823..7630dba4b 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources
+++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources
@@ -1,6 +1,5 @@
SWRAST_DRIVER_FILES = \
- swrast.c \
- swrast_span.c
+ swrast.c
SWRAST_COMMON_FILES = \
../common/utils.c \
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index 4f6d0160f..d18dd0927 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -94,7 +94,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);
@@ -263,10 +263,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 */
@@ -282,17 +284,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;
@@ -302,24 +303,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;
@@ -327,48 +329,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:
@@ -386,10 +384,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;
@@ -402,18 +400,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;
@@ -431,7 +429,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;
@@ -441,12 +439,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;
}
}
@@ -457,7 +455,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;
@@ -482,12 +480,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 */
@@ -538,16 +536,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)
@@ -561,9 +559,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);
}
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h
index b57012aef..b25de931a 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h
@@ -31,6 +31,7 @@
#include <GL/internal/dri_interface.h>
#include "main/mtypes.h"
#include "dri_util.h"
+#include "swrast/s_context.h"
/**
@@ -100,8 +101,8 @@ swrast_drawable(struct gl_framebuffer *fb)
return (struct dri_drawable *) fb;
}
-struct swrast_renderbuffer {
- struct gl_renderbuffer Base;
+struct dri_swrast_renderbuffer {
+ struct swrast_renderbuffer Base;
__DRIdrawable *dPriv;
/* GL_MAP_*_BIT, used for mapping of front buffer. */
@@ -114,10 +115,10 @@ struct swrast_renderbuffer {
GLuint bpp;
};
-static INLINE struct swrast_renderbuffer *
-swrast_renderbuffer(struct gl_renderbuffer *rb)
+static INLINE struct dri_swrast_renderbuffer *
+dri_swrast_renderbuffer(struct gl_renderbuffer *rb)
{
- return (struct swrast_renderbuffer *) rb;
+ return (struct dri_swrast_renderbuffer *) rb;
}
@@ -130,14 +131,4 @@ swrast_renderbuffer(struct gl_renderbuffer *rb)
#define PF_X8R8G8B8 4 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */
-/* swrast_span.c */
-
-extern void
-swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb,
- GLuint pixel_format);
-
-extern void
-swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb,
- GLuint pixel_format);
-
#endif /* _SWRAST_PRIV_H_ */
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
deleted file mode 100644
index ba6174f9d..000000000
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright 2008, 2010 George Sapountzis <gsapountzis@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "swrast_priv.h"
-
-#define YFLIP(_xrb, Y) ((_xrb)->Base.Height - (Y) - 1)
-
-/*
- * Dithering support takes the "computation" extreme in the "computation vs.
- * storage" trade-off. This approach is very simple to implement and any
- * computational overhead should be acceptable. XMesa uses table lookups for
- * around 8KB of storage overhead per visual.
- */
-#define DITHER 1
-
-static const GLubyte kernel[16] = {
- 0*16, 8*16, 2*16, 10*16,
- 12*16, 4*16, 14*16, 6*16,
- 3*16, 11*16, 1*16, 9*16,
- 15*16, 7*16, 13*16, 5*16,
-};
-
-#if DITHER
-#define DITHER_COMP(X, Y) kernel[((X) & 0x3) | (((Y) & 0x3) << 2)]
-
-#define DITHER_CLAMP(X) (((X) < 255) ? (X) : 255)
-#else
-#define DITHER_COMP(X, Y) 0
-
-#define DITHER_CLAMP(X) (X)
-#endif
-
-
-/*
- * Pixel macros shared across front/back buffer span functions.
- */
-
-/* 32-bit BGRA */
-#define STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE) \
- *DST = VALUE[ACOMP] << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
-#define STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE) \
- *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
-#define FETCH_PIXEL_A8R8G8B8(DST, SRC) \
- DST[ACOMP] = *SRC >> 24; \
- DST[RCOMP] = (*SRC >> 16) & 0xff; \
- DST[GCOMP] = (*SRC >> 8) & 0xff; \
- DST[BCOMP] = *SRC & 0xff
-
-
-/* 32-bit BGRX */
-#define STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE) \
- *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
-#define STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE) \
- *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
-#define FETCH_PIXEL_X8R8G8B8(DST, SRC) \
- DST[ACOMP] = 0xff; \
- DST[RCOMP] = (*SRC >> 16) & 0xff; \
- DST[GCOMP] = (*SRC >> 8) & 0xff; \
- DST[BCOMP] = *SRC & 0xff
-
-
-/* 16-bit BGR */
-#define STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) \
- do { \
- int d = DITHER_COMP(X, Y) >> 6; \
- *DST = ( ((DITHER_CLAMP((VALUE[RCOMP]) + d) & 0xf8) << 8) | \
- ((DITHER_CLAMP((VALUE[GCOMP]) + d) & 0xfc) << 3) | \
- ((DITHER_CLAMP((VALUE[BCOMP]) + d) & 0xf8) >> 3) ); \
- } while(0)
-#define FETCH_PIXEL_R5G6B5(DST, SRC) \
- do { \
- DST[ACOMP] = 0xff; \
- DST[RCOMP] = ((*SRC >> 8) & 0xf8) * 255 / 0xf8; \
- DST[GCOMP] = ((*SRC >> 3) & 0xfc) * 255 / 0xfc; \
- DST[BCOMP] = ((*SRC << 3) & 0xf8) * 255 / 0xf8; \
- } while(0)
-
-
-/* 8-bit BGR */
-#define STORE_PIXEL_R3G3B2(DST, X, Y, VALUE) \
- do { \
- int d = DITHER_COMP(X, Y) >> 3; \
- GLubyte *p = (GLubyte *)DST; \
- *p = ( ((DITHER_CLAMP((VALUE[RCOMP]) + d) & 0xe0) >> 5) | \
- ((DITHER_CLAMP((VALUE[GCOMP]) + d) & 0xe0) >> 2) | \
- ((DITHER_CLAMP((VALUE[BCOMP]) + d) & 0xc0) >> 0) ); \
- } while(0)
-#define FETCH_PIXEL_R3G3B2(DST, SRC) \
- do { \
- GLubyte p = *(GLubyte *)SRC; \
- DST[ACOMP] = 0xff; \
- DST[RCOMP] = ((p << 5) & 0xe0) * 255 / 0xe0; \
- DST[GCOMP] = ((p << 2) & 0xe0) * 255 / 0xe0; \
- DST[BCOMP] = ((p << 0) & 0xc0) * 255 / 0xc0; \
- } while(0)
-
-
-/*
- * Generate code for back-buffer span functions.
- */
-
-/* 32-bit BGRA */
-#define NAME(FUNC) FUNC##_A8R8G8B8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 4 + (X)
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE)
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_A8R8G8B8(DST, SRC)
-
-#include "swrast/s_spantemp.h"
-
-
-/* 32-bit BGRX */
-#define NAME(FUNC) FUNC##_X8R8G8B8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 4 + (X);
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE)
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_X8R8G8B8(DST, SRC)
-
-#include "swrast/s_spantemp.h"
-
-
-/* 16-bit BGR */
-#define NAME(FUNC) FUNC##_R5G6B5
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 2 + (X);
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_R5G6B5(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_R5G6B5(DST, SRC)
-
-#include "swrast/s_spantemp.h"
-
-
-/* 8-bit BGR */
-#define NAME(FUNC) FUNC##_R3G3B2
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 1;
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_R3G3B2(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_R3G3B2(DST, SRC)
-
-#include "swrast/s_spantemp.h"
-
-
-/*
- * Generate code for front-buffer span functions.
- */
-
-/* 32-bit BGRA */
-#define NAME(FUNC) FUNC##_A8R8G8B8_front
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint *)row;
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE)
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_A8R8G8B8(DST, SRC)
-
-#include "swrast_spantemp.h"
-
-
-/* 32-bit BGRX */
-#define NAME(FUNC) FUNC##_X8R8G8B8_front
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint *)row;
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE)
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_X8R8G8B8(DST, SRC)
-
-#include "swrast_spantemp.h"
-
-
-/* 16-bit BGR */
-#define NAME(FUNC) FUNC##_R5G6B5_front
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *)row;
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_R5G6B5(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_R5G6B5(DST, SRC)
-
-#include "swrast_spantemp.h"
-
-
-/* 8-bit BGR */
-#define NAME(FUNC) FUNC##_R3G3B2_front
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)row;
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_R3G3B2(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_R3G3B2(DST, SRC)
-
-#include "swrast_spantemp.h"
-
-
-/*
- * Back-buffers are malloced memory and always private.
- *
- * BACK_PIXMAP (not supported)
- * BACK_XIMAGE
- */
-void
-swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb,
- GLuint pixel_format)
-{
- switch (pixel_format) {
- case PF_A8R8G8B8:
- xrb->Base.GetRow = get_row_A8R8G8B8;
- xrb->Base.GetValues = get_values_A8R8G8B8;
- xrb->Base.PutRow = put_row_A8R8G8B8;
- xrb->Base.PutValues = put_values_A8R8G8B8;
- break;
- case PF_X8R8G8B8:
- xrb->Base.GetRow = get_row_X8R8G8B8;
- xrb->Base.GetValues = get_values_X8R8G8B8;
- xrb->Base.PutRow = put_row_X8R8G8B8;
- xrb->Base.PutValues = put_values_X8R8G8B8;
- break;
- case PF_R5G6B5:
- xrb->Base.GetRow = get_row_R5G6B5;
- xrb->Base.GetValues = get_values_R5G6B5;
- xrb->Base.PutRow = put_row_R5G6B5;
- xrb->Base.PutValues = put_values_R5G6B5;
- break;
- case PF_R3G3B2:
- xrb->Base.GetRow = get_row_R3G3B2;
- xrb->Base.GetValues = get_values_R3G3B2;
- xrb->Base.PutRow = put_row_R3G3B2;
- xrb->Base.PutValues = put_values_R3G3B2;
- break;
- default:
- assert(0);
- return;
- }
-}
-
-
-/*
- * Front-buffers are provided by the loader, the xorg loader uses pixmaps.
- *
- * WINDOW, An X window
- * GLXWINDOW, GLX window
- * PIXMAP, GLX pixmap
- * PBUFFER GLX Pbuffer
- */
-void
-swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb,
- GLuint pixel_format)
-{
- switch (pixel_format) {
- case PF_A8R8G8B8:
- xrb->Base.GetRow = get_row_A8R8G8B8_front;
- xrb->Base.GetValues = get_values_A8R8G8B8_front;
- xrb->Base.PutRow = put_row_A8R8G8B8_front;
- xrb->Base.PutValues = put_values_A8R8G8B8_front;
- break;
- case PF_X8R8G8B8:
- xrb->Base.GetRow = get_row_X8R8G8B8_front;
- xrb->Base.GetValues = get_values_X8R8G8B8_front;
- xrb->Base.PutRow = put_row_X8R8G8B8_front;
- xrb->Base.PutValues = put_values_X8R8G8B8_front;
- break;
- case PF_R5G6B5:
- xrb->Base.GetRow = get_row_R5G6B5_front;
- xrb->Base.GetValues = get_values_R5G6B5_front;
- xrb->Base.PutRow = put_row_R5G6B5_front;
- xrb->Base.PutValues = put_values_R5G6B5_front;
- break;
- case PF_R3G3B2:
- xrb->Base.GetRow = get_row_R3G3B2_front;
- xrb->Base.GetValues = get_values_R3G3B2_front;
- xrb->Base.PutRow = put_row_R3G3B2_front;
- xrb->Base.PutValues = put_values_R3G3B2_front;
- break;
- default:
- assert(0);
- return;
- }
-}
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h
deleted file mode 100644
index 50671193e..000000000
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.1
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/*
- * Modified version of swrast/s_spantemp.h for front-buffer rendering. The
- * no-mask paths use a scratch row to avoid repeated calls to the loader.
- *
- * For the mask paths we always use an array of 4 elements of RB_TYPE. This is
- * to satisfy the xorg loader requirement of an image pitch of 32 bits and
- * should be ok for other loaders also.
- */
-
-
-#ifndef _SWRAST_SPANTEMP_ONCE
-#define _SWRAST_SPANTEMP_ONCE
-
-static INLINE void
-PUT_PIXEL( struct gl_context *glCtx, GLint x, GLint y, GLvoid *p )
-{
- __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
- __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv;
-
- __DRIscreen *screen = ctx->driScreenPriv;
-
- screen->swrast_loader->putImage(draw, __DRI_SWRAST_IMAGE_OP_DRAW,
- x, y, 1, 1, (char *)p,
- draw->loaderPrivate);
-}
-
-
-static INLINE void
-GET_PIXEL( struct gl_context *glCtx, GLint x, GLint y, GLubyte *p )
-{
- __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
- __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv;
-
- __DRIscreen *screen = ctx->driScreenPriv;
-
- screen->swrast_loader->getImage(read, x, y, 1, 1, (char *)p,
- read->loaderPrivate);
-}
-
-static INLINE void
-PUT_ROW( struct gl_context *glCtx, GLint x, GLint y, GLuint n, char *row )
-{
- __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
- __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv;
-
- __DRIscreen *screen = ctx->driScreenPriv;
-
- screen->swrast_loader->putImage(draw, __DRI_SWRAST_IMAGE_OP_DRAW,
- x, y, n, 1, row,
- draw->loaderPrivate);
-}
-
-static INLINE void
-GET_ROW( struct gl_context *glCtx, GLint x, GLint y, GLuint n, char *row )
-{
- __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
- __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv;
-
- __DRIscreen *screen = ctx->driScreenPriv;
-
- screen->swrast_loader->getImage(read, x, y, n, 1, row,
- read->loaderPrivate);
-}
-
-#endif /* _SWRAST_SPANTEMP_ONCE */
-
-
-/*
- * Templates for the span/pixel-array write/read functions called via
- * the gl_renderbuffer's GetRow, GetValues, PutRow and PutValues.
- *
- * Define the following macros before including this file:
- * NAME(BASE) to generate the function name (i.e. add prefix or suffix)
- * RB_TYPE the renderbuffer DataType
- * SPAN_VARS to declare any local variables
- * INIT_PIXEL_PTR(P, X, Y) to initialize a pointer to a pixel
- * INC_PIXEL_PTR(P) to increment a pixel pointer by one pixel
- * STORE_PIXEL(DST, X, Y, VALUE) to store pixel values in buffer
- * FETCH_PIXEL(DST, SRC) to fetch pixel values from buffer
- *
- * Note that in the STORE_PIXEL macros, we also pass in the (X,Y) coordinates
- * for the pixels to be stored. This is useful when dithering and probably
- * ignored otherwise.
- */
-
-#include "main/macros.h"
-
-
-#if !defined(RB_COMPONENTS)
-#define RB_COMPONENTS 4
-#endif
-
-
-static void
-NAME(get_row)( struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, GLint x, GLint y, void *values )
-{
-#ifdef SPAN_VARS
- SPAN_VARS
-#endif
- RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
- GLuint i;
- char *row = swrast_drawable(ctx->ReadBuffer)->row;
- INIT_PIXEL_PTR(pixel, x, y);
- GET_ROW( ctx, x, YFLIP(xrb, y), count, row );
- for (i = 0; i < count; i++) {
- FETCH_PIXEL(dest[i], pixel);
- INC_PIXEL_PTR(pixel);
- }
- (void) rb;
-}
-
-
-static void
-NAME(get_values)( struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, const GLint x[], const GLint y[], void *values )
-{
-#ifdef SPAN_VARS
- SPAN_VARS
-#endif
- RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
- GLuint i;
- for (i = 0; i < count; i++) {
- RB_TYPE pixel[4];
- GET_PIXEL(ctx, x[i], YFLIP(xrb, y[i]), pixel);
- FETCH_PIXEL(dest[i], pixel);
- }
- (void) rb;
-}
-
-
-static void
-NAME(put_row)( struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, GLint x, GLint y,
- const void *values, const GLubyte mask[] )
-{
-#ifdef SPAN_VARS
- SPAN_VARS
-#endif
- const RB_TYPE (*src)[RB_COMPONENTS] = (const RB_TYPE (*)[RB_COMPONENTS]) values;
- GLuint i;
- if (mask) {
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- RB_TYPE row[4];
- INIT_PIXEL_PTR(pixel, x, y);
- STORE_PIXEL(pixel, x + i, y, src[i]);
- PUT_PIXEL(ctx, x + i, YFLIP(xrb, y), pixel);
- }
- }
- }
- else {
- char *row = swrast_drawable(ctx->DrawBuffer)->row;
- INIT_PIXEL_PTR(pixel, x, y);
- for (i = 0; i < count; i++) {
- STORE_PIXEL(pixel, x + i, y, src[i]);
- INC_PIXEL_PTR(pixel);
- }
- PUT_ROW( ctx, x, YFLIP(xrb, y), count, row );
- }
- (void) rb;
-}
-
-
-static void
-NAME(put_values)( struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, const GLint x[], const GLint y[],
- const void *values, const GLubyte mask[] )
-{
-#ifdef SPAN_VARS
- SPAN_VARS
-#endif
- const RB_TYPE (*src)[RB_COMPONENTS] = (const RB_TYPE (*)[RB_COMPONENTS]) values;
- GLuint i;
- ASSERT(mask);
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- RB_TYPE row[4];
- INIT_PIXEL_PTR(pixel, x, y);
- STORE_PIXEL(pixel, x[i], y[i], src[i]);
- PUT_PIXEL(ctx, x[i], YFLIP(xrb, y[i]), pixel);
- }
- }
- (void) rb;
-}
-
-
-
-
-#undef NAME
-#undef RB_TYPE
-#undef RB_COMPONENTS
-#undef SPAN_VARS
-#undef INIT_PIXEL_PTR
-#undef INC_PIXEL_PTR
-#undef STORE_PIXEL
-#undef STORE_PIXEL_RGB
-#undef FETCH_PIXEL