aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/swrast
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-04-02 14:47:58 +0000
committermarha <marha@users.sourceforge.net>2010-04-02 14:47:58 +0000
commit7933658107276f9d5491f8736a743cf8f8bbd5f2 (patch)
treef2893a761364e7abc9d934e9c5427e5cf5190c7a /mesalib/src/mesa/drivers/dri/swrast
parent83fa9a9811e2c18cffd83a020757f7fb51ffddaa (diff)
downloadvcxsrv-7933658107276f9d5491f8736a743cf8f8bbd5f2.tar.gz
vcxsrv-7933658107276f9d5491f8736a743cf8f8bbd5f2.tar.bz2
vcxsrv-7933658107276f9d5491f8736a743cf8f8bbd5f2.zip
Updated to following packages:
mesa-7.8
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/swrast')
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c86
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h13
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast_span.c52
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h33
4 files changed, 56 insertions, 128 deletions
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index 8340861af..03c672ecf 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -132,7 +132,8 @@ swrastFillInModes(__DRIscreen *psp,
configs = driCreateConfigs(fb_format, fb_type,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
- back_buffer_factor, msaa_samples_array, 1);
+ back_buffer_factor, msaa_samples_array, 1,
+ GL_TRUE);
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);
@@ -154,7 +155,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
TRACE;
- psp = _mesa_calloc(sizeof(*psp));
+ psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
@@ -183,7 +184,7 @@ static void driDestroyScreen(__DRIscreen *psp)
TRACE;
if (psp) {
- _mesa_free(psp);
+ free(psp);
}
}
@@ -202,34 +203,28 @@ static const __DRIextension **driGetExtensions(__DRIscreen *psp)
static GLuint
choose_pixel_format(const GLvisual *v)
{
- if (v->rgbMode) {
- int depth = v->rgbBits;
-
- if (depth == 32
- && v->redMask == 0xff0000
- && v->greenMask == 0x00ff00
- && v->blueMask == 0x0000ff)
- return PF_A8R8G8B8;
- else if (depth == 24
- && v->redMask == 0xff0000
- && v->greenMask == 0x00ff00
- && v->blueMask == 0x0000ff)
- return PF_X8R8G8B8;
- else if (depth == 16
- && v->redMask == 0xf800
- && v->greenMask == 0x07e0
- && v->blueMask == 0x001f)
- return PF_R5G6B5;
- else if (depth == 8
- && v->redMask == 0x07
- && v->greenMask == 0x38
- && v->blueMask == 0xc0)
- return PF_R3G3B2;
- }
- else {
- if (v->indexBits == 8)
- return PF_CI8;
- }
+ int depth = v->rgbBits;
+
+ if (depth == 32
+ && v->redMask == 0xff0000
+ && v->greenMask == 0x00ff00
+ && v->blueMask == 0x0000ff)
+ return PF_A8R8G8B8;
+ else if (depth == 24
+ && v->redMask == 0xff0000
+ && v->greenMask == 0x00ff00
+ && v->blueMask == 0x0000ff)
+ return PF_X8R8G8B8;
+ else if (depth == 16
+ && v->redMask == 0xf800
+ && v->greenMask == 0x07e0
+ && v->blueMask == 0x001f)
+ return PF_R5G6B5;
+ else if (depth == 8
+ && v->redMask == 0x07
+ && v->greenMask == 0x38
+ && v->blueMask == 0xc0)
+ return PF_R3G3B2;
_mesa_problem( NULL, "unexpected format in %s", __FUNCTION__ );
return 0;
@@ -240,8 +235,8 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
{
TRACE;
- _mesa_free(rb->Data);
- _mesa_free(rb);
+ free(rb->Data);
+ free(rb);
}
static GLboolean
@@ -271,11 +266,11 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
TRACE;
- _mesa_free(rb->Data);
+ free(rb->Data);
swrast_alloc_front_storage(ctx, rb, internalFormat, width, height);
- rb->Data = _mesa_malloc(height * xrb->pitch);
+ rb->Data = malloc(height * xrb->pitch);
return GL_TRUE;
}
@@ -283,7 +278,7 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
static struct swrast_renderbuffer *
swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
{
- struct swrast_renderbuffer *xrb = _mesa_calloc(sizeof *xrb);
+ struct swrast_renderbuffer *xrb = calloc(1, sizeof *xrb);
GLuint pixel_format;
TRACE;
@@ -334,13 +329,6 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->bpp = 8;
break;
- case PF_CI8:
- xrb->Base.Format = MESA_FORMAT_CI8;
- xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT;
- xrb->Base._BaseFormat = GL_COLOR_INDEX;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
- xrb->bpp = 8;
- break;
default:
return NULL;
}
@@ -357,7 +345,7 @@ driCreateNewDrawable(__DRIscreen *screen,
TRACE;
- buf = _mesa_calloc(sizeof *buf);
+ buf = calloc(1, sizeof *buf);
if (!buf)
return NULL;
@@ -365,10 +353,10 @@ driCreateNewDrawable(__DRIscreen *screen,
buf->driScreenPriv = screen;
- buf->row = _mesa_malloc(MAX_WIDTH * 4);
+ buf->row = malloc(MAX_WIDTH * 4);
/* basic framebuffer setup */
- _mesa_initialize_framebuffer(&buf->Base, &config->modes);
+ _mesa_initialize_window_framebuffer(&buf->Base, &config->modes);
/* add front renderbuffer */
frontrb = swrast_new_renderbuffer(&config->modes, GL_TRUE);
@@ -400,7 +388,7 @@ driDestroyDrawable(__DRIdrawable *buf)
if (buf) {
struct gl_framebuffer *fb = &buf->Base;
- _mesa_free(buf->row);
+ free(buf->row);
fb->DeletePending = GL_TRUE;
_mesa_reference_framebuffer(&fb, NULL);
@@ -524,7 +512,7 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
TRACE;
- ctx = _mesa_calloc(sizeof *ctx);
+ ctx = calloc(1, sizeof *ctx);
if (!ctx)
return NULL;
@@ -539,7 +527,7 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
if (!_mesa_initialize_context(&ctx->Base, &config->modes,
shared ? &shared->Base : NULL,
&functions, (void *) ctx)) {
- _mesa_free(ctx);
+ free(ctx);
return NULL;
}
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h
index 1a5fb31d5..4722007f9 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h
@@ -43,13 +43,13 @@
#define DEBUG_SPAN 0
#if DEBUG_CORE
-#define TRACE _mesa_printf("--> %s\n", __FUNCTION__)
+#define TRACE printf("--> %s\n", __FUNCTION__)
#else
#define TRACE
#endif
#if DEBUG_SPAN
-#define TRACE_SPAN _mesa_printf("--> %s\n", __FUNCTION__)
+#define TRACE_SPAN printf("--> %s\n", __FUNCTION__)
#else
#define TRACE_SPAN
#endif
@@ -116,11 +116,10 @@ swrast_renderbuffer(struct gl_renderbuffer *rb)
/**
* Pixel formats we support
*/
-#define PF_CI8 1 /**< Color Index mode */
-#define PF_A8R8G8B8 2 /**< 32bpp TrueColor: 8-A, 8-R, 8-G, 8-B bits */
-#define PF_R5G6B5 3 /**< 16bpp TrueColor: 5-R, 6-G, 5-B bits */
-#define PF_R3G3B2 4 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */
-#define PF_X8R8G8B8 5 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */
+#define PF_A8R8G8B8 1 /**< 32bpp TrueColor: 8-A, 8-R, 8-G, 8-B bits */
+#define PF_R5G6B5 2 /**< 16bpp TrueColor: 5-R, 6-G, 5-B bits */
+#define PF_R3G3B2 3 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */
+#define PF_X8R8G8B8 4 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */
/**
* Renderbuffer pitch alignment (in bits).
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
index f8e503463..d896e154f 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
@@ -193,23 +193,6 @@ static const GLubyte kernel[16] = {
#include "swrast/s_spantemp.h"
-/* 8-bit color index */
-#define NAME(FUNC) FUNC##_CI8
-#define CI_MODE
-#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);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- *DST = VALUE[0]
-#define FETCH_PIXEL(DST, SRC) \
- DST = SRC[0]
-
-#include "swrast/s_spantemp.h"
-
-
/*
* Generate code for front-buffer span functions.
*/
@@ -257,7 +240,7 @@ static const GLubyte kernel[16] = {
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
#define INIT_PIXEL_PTR(P, X, Y) \
GLushort *P = (GLushort *)row;
-#define INC_PIXEL_PTR(P) P += 2
+#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) \
@@ -282,23 +265,6 @@ static const GLubyte kernel[16] = {
#include "swrast_spantemp.h"
-/* 8-bit color index */
-#define NAME(FUNC) FUNC##_CI8_front
-#define CI_MODE
-#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) \
- *DST = VALUE[0]
-#define FETCH_PIXEL(DST, SRC) \
- DST = SRC[0]
-
-#include "swrast_spantemp.h"
-
-
/*
* Back-buffers are malloced memory and always private.
*
@@ -346,14 +312,6 @@ swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb,
xrb->Base.PutValues = put_values_R3G3B2;
xrb->Base.PutMonoValues = put_mono_values_R3G3B2;
break;
- case PF_CI8:
- xrb->Base.GetRow = get_row_CI8;
- xrb->Base.GetValues = get_values_CI8;
- xrb->Base.PutRow = put_row_CI8;
- xrb->Base.PutMonoRow = put_mono_row_CI8;
- xrb->Base.PutValues = put_values_CI8;
- xrb->Base.PutMonoValues = put_mono_values_CI8;
- break;
default:
assert(0);
return;
@@ -410,14 +368,6 @@ swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb,
xrb->Base.PutValues = put_values_R3G3B2_front;
xrb->Base.PutMonoValues = put_mono_values_R3G3B2_front;
break;
- case PF_CI8:
- xrb->Base.GetRow = get_row_CI8_front;
- xrb->Base.GetValues = get_values_CI8_front;
- xrb->Base.PutRow = put_row_CI8_front;
- xrb->Base.PutMonoRow = put_mono_row_CI8_front;
- xrb->Base.PutValues = put_values_CI8_front;
- xrb->Base.PutMonoValues = put_mono_values_CI8_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
index e0cb24142..848736171 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h
@@ -37,7 +37,7 @@
#define _SWRAST_SPANTEMP_ONCE
static INLINE void
-PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p )
+PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p )
{
__DRIcontext *ctx = swrast_context(glCtx);
__DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer);
@@ -98,7 +98,6 @@ GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
* 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
- * CI_MODE if set, color index mode, else RGBA
* 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
@@ -113,9 +112,7 @@ GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
#include "main/macros.h"
-#ifdef CI_MODE
-#define RB_COMPONENTS 1
-#elif !defined(RB_COMPONENTS)
+#if !defined(RB_COMPONENTS)
#define RB_COMPONENTS 4
#endif
@@ -127,11 +124,7 @@ NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
#ifdef SPAN_VARS
SPAN_VARS
#endif
-#ifdef CI_MODE
- RB_TYPE *dest = (RB_TYPE *) values;
-#else
RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
-#endif
GLuint i;
char *row = swrast_drawable(ctx->ReadBuffer)->row;
INIT_PIXEL_PTR(pixel, x, y);
@@ -151,11 +144,7 @@ NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
#ifdef SPAN_VARS
SPAN_VARS
#endif
-#ifdef CI_MODE
- RB_TYPE *dest = (RB_TYPE *) values;
-#else
RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
-#endif
GLuint i;
for (i = 0; i < count; i++) {
RB_TYPE pixel[4];
@@ -179,7 +168,8 @@ NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
if (mask) {
for (i = 0; i < count; i++) {
if (mask[i]) {
- RB_TYPE pixel[4];
+ 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);
}
@@ -198,7 +188,6 @@ NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
}
-#if !defined(CI_MODE)
static void
NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
@@ -212,7 +201,8 @@ NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
if (mask) {
for (i = 0; i < count; i++) {
if (mask[i]) {
- RB_TYPE pixel[4];
+ RB_TYPE row[4];
+ INIT_PIXEL_PTR(pixel, x, y);
#ifdef STORE_PIXEL_RGB
STORE_PIXEL_RGB(pixel, x + i, y, src[i]);
#else
@@ -237,7 +227,6 @@ NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
}
(void) rb;
}
-#endif
static void
@@ -253,7 +242,8 @@ NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
if (mask) {
for (i = 0; i < count; i++) {
if (mask[i]) {
- RB_TYPE pixel[4];
+ RB_TYPE row[4];
+ INIT_PIXEL_PTR(pixel, x, y);
STORE_PIXEL(pixel, x + i, y, src);
PUT_PIXEL(ctx, x + i, YFLIP(xrb, y), pixel);
}
@@ -285,7 +275,8 @@ NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
ASSERT(mask);
for (i = 0; i < count; i++) {
if (mask[i]) {
- RB_TYPE pixel[4];
+ 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);
}
@@ -307,7 +298,8 @@ NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
ASSERT(mask);
for (i = 0; i < count; i++) {
if (mask[i]) {
- RB_TYPE pixel[4];
+ RB_TYPE row[4];
+ INIT_PIXEL_PTR(pixel, x, y);
STORE_PIXEL(pixel, x[i], y[i], src);
PUT_PIXEL(ctx, x[i], YFLIP(xrb, y[i]), pixel);
}
@@ -319,7 +311,6 @@ NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
#undef NAME
#undef RB_TYPE
#undef RB_COMPONENTS
-#undef CI_MODE
#undef SPAN_VARS
#undef INIT_PIXEL_PTR
#undef INC_PIXEL_PTR