depth_buffer_factor = 4;
back_buffer_factor = 2;
- if (pixel_bits == 16) {
+ if (pixel_bits == 8) {
+ fb_format = GL_RGB;
+ fb_type = GL_UNSIGNED_BYTE_2_3_3_REV;
+ }
+ else if (pixel_bits == 16) {
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
}
{
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
+ __DRIconfig **configs8, **configs16, **configs32;
(void) data;
psp->num = scrn;
psp->extensions = emptyExtensionList;
- *driver_configs = driConcatConfigs(swrastFillInModes(psp, 16, 16, 0, 1),
- swrastFillInModes(psp, 32, 24, 8, 1));
+ configs8 = swrastFillInModes(psp, 8, 8, 0, 1);
+ configs16 = swrastFillInModes(psp, 16, 16, 0, 1);
+ configs32 = swrastFillInModes(psp, 32, 24, 8, 1);
+
+ configs16 = (__DRIconfig **)driConcatConfigs(configs8, configs16);
+
+ *driver_configs = driConcatConfigs(configs16, configs32);
driInitExtensions( NULL, card_extensions, GL_FALSE );
&& v->greenMask == 0x07e0
&& v->blueMask == 0x001f)
return PF_R5G6B5;
+ else if (bpp == 8
+ && v->redMask == 0x07
+ && v->greenMask == 0x38
+ && v->blueMask == 0xc0)
+ return PF_R3G3B2;
}
else {
if (v->indexBits == 8)
xrb->Base.BlueBits = 5 * sizeof(GLubyte);
xrb->Base.AlphaBits = 0;
break;
+ case PF_R3G3B2:
+ xrb->Base.InternalFormat = GL_RGB;
+ xrb->Base._BaseFormat = GL_RGB;
+ xrb->Base.DataType = GL_UNSIGNED_BYTE;
+ xrb->Base.RedBits = 3 * sizeof(GLubyte);
+ xrb->Base.GreenBits = 3 * sizeof(GLubyte);
+ xrb->Base.BlueBits = 2 * sizeof(GLubyte);
+ xrb->Base.AlphaBits = 0;
+ break;
case PF_CI8:
xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT;
xrb->Base._BaseFormat = GL_COLOR_INDEX;
} while(0)
+/* 8-bit BGR */
+#define STORE_PIXEL_R3G3B2(DST, X, Y, VALUE) \
+ do { \
+ GLubyte *p = (GLubyte *)DST; \
+ *p = ( (((VALUE[RCOMP]) & 0xe0) >> 5) | \
+ (((VALUE[GCOMP]) & 0xe0) >> 2) | \
+ (((VALUE[BCOMP]) & 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 image span functions.
*/
#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"
+
+
/* 8-bit color index */
#define NAME(FUNC) FUNC##_CI8
#define CI_MODE
#include "swrast_spantemp.h"
+/* 8-bit BGR */
+#define NAME(FUNC) FUNC##_R3G3B2_pixmap
+#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"
+
+
/* 8-bit color index */
#define NAME(FUNC) FUNC##_CI8_pixmap
#define CI_MODE
xrb->Base.PutValues = put_values_R5G6B5;
xrb->Base.PutMonoValues = put_mono_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.PutRowRGB = put_row_rgb_R3G3B2;
+ xrb->Base.PutMonoRow = put_mono_row_R3G3B2;
+ 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.PutValues = put_values_R5G6B5_pixmap;
xrb->Base.PutMonoValues = put_mono_values_R5G6B5_pixmap;
break;
+ case PF_R3G3B2:
+ xrb->Base.GetRow = get_row_R3G3B2_pixmap;
+ xrb->Base.GetValues = get_values_R3G3B2_pixmap;
+ xrb->Base.PutRow = put_row_R3G3B2_pixmap;
+ xrb->Base.PutRowRGB = put_row_rgb_R3G3B2_pixmap;
+ xrb->Base.PutMonoRow = put_mono_row_R3G3B2_pixmap;
+ xrb->Base.PutValues = put_values_R3G3B2_pixmap;
+ xrb->Base.PutMonoValues = put_mono_values_R3G3B2_pixmap;
+ break;
case PF_CI8:
xrb->Base.GetRow = get_row_CI8_pixmap;
xrb->Base.GetValues = get_values_CI8_pixmap;