diff options
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/swrast/swrast.c | 57 | ||||
-rw-r--r-- | src/mesa/drivers/dri/swrast/swrast_priv.h | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/swrast/swrast_span.c | 50 | ||||
-rw-r--r-- | src/mesa/drivers/dri/swrast/swrast_spantemp.h | 16 |
4 files changed, 27 insertions, 105 deletions
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index b2e7df34e82..03c672ecf1b 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -203,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; @@ -335,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; } diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h index 59b4a6d2282..4722007f958 100644 --- a/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -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/src/mesa/drivers/dri/swrast/swrast_span.c b/src/mesa/drivers/dri/swrast/swrast_span.c index f8e503463fa..5290dc82b91 100644 --- a/src/mesa/drivers/dri/swrast/swrast_span.c +++ b/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. */ @@ -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/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/src/mesa/drivers/dri/swrast/swrast_spantemp.h index e0cb2414294..879a0c12e76 100644 --- a/src/mesa/drivers/dri/swrast/swrast_spantemp.h +++ b/src/mesa/drivers/dri/swrast/swrast_spantemp.h @@ -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]; @@ -198,7 +187,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, @@ -237,7 +225,6 @@ NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, } (void) rb; } -#endif static void @@ -319,7 +306,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 |