More SciTech SNAP specific changes to glheader.h. Also modified the macros

in swrast/s_spantemp.h to allow dithering to be used in the SNAP drivers.
This commit is contained in:
Kendall Bennett 2003-10-08 01:53:30 +00:00
parent 4e5b58f483
commit 2cdd699a77
5 changed files with 52 additions and 40 deletions

View file

@ -1,4 +1,4 @@
/* $Id: fb_dri.c,v 1.1 2003/08/06 18:11:57 keithw Exp $ */
/* $Id: fb_dri.c,v 1.2 2003/10/08 01:53:30 kendallb Exp $ */
/*
* Mesa 3-D graphics library
@ -212,9 +212,9 @@ init_core_functions( GLcontext *ctx )
#define INIT_PIXEL_PTR(P, X, Y) \
GLubyte *P = (char *)dPriv->currentBuffer + (Y) * dPriv->currentPitch + (X) * 3
#define INC_PIXEL_PTR(P) P += 3
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
P[0] = B; P[1] = G; P[2] = R
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
P[0] = B; P[1] = G; P[2] = R
#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
R = P[2]; G = P[1]; B = P[0]; A = CHAN_MAX
@ -230,9 +230,9 @@ init_core_functions( GLcontext *ctx )
#define INIT_PIXEL_PTR(P, X, Y) \
GLubyte *P = (char *)dPriv->currentBuffer + (Y) * dPriv->currentPitch + (X) * 4;
#define INC_PIXEL_PTR(P) P += 4
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
P[0] = B; P[1] = G; P[2] = R; P[3] = 255
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
P[0] = B; P[1] = G; P[2] = R; P[3] = A
#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
R = P[2]; G = P[1]; B = P[0]; A = P[3]
@ -248,9 +248,9 @@ init_core_functions( GLcontext *ctx )
#define INIT_PIXEL_PTR(P, X, Y) \
GLushort *P = (GLushort *) ((char *)dPriv->currentBuffer + (Y) * dPriv->currentPitch + (X) * 2)
#define INC_PIXEL_PTR(P) P += 1
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
*P = ( (((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | ((B) >> 3) )
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
*P = ( (((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | ((B) >> 3) )
#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
R = ( (((*P) >> 8) & 0xf8) | (((*P) >> 11) & 0x7) ); \
@ -269,9 +269,9 @@ init_core_functions( GLcontext *ctx )
#define INIT_PIXEL_PTR(P, X, Y) \
GLushort *P = (GLushort *) ((char *)dPriv->currentBuffer + (Y) * dPriv->currentPitch + (X) * 2)
#define INC_PIXEL_PTR(P) P += 1
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
*P = ( (((R) & 0xf8) << 7) | (((G) & 0xf8) << 2) | ((B) >> 3) )
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
*P = ( (((R) & 0xf8) << 7) | (((G) & 0xf8) << 2) | ((B) >> 3) )
#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
R = ( (((*P) >> 7) & 0xf8) | (((*P) >> 10) & 0x7) ); \

View file

@ -226,20 +226,20 @@ clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
#define INC_PIXEL_PTR(P) P += 4
#if CHAN_TYPE == GL_FLOAT
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
P[0] = MAX2((R), 0.0F); \
P[1] = MAX2((G), 0.0F); \
P[2] = MAX2((B), 0.0F); \
P[3] = CHAN_MAXF
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
P[0] = MAX2((R), 0.0F); \
P[1] = MAX2((G), 0.0F); \
P[2] = MAX2((B), 0.0F); \
P[3] = CLAMP((A), 0.0F, CHAN_MAXF)
#else
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
P[0] = R; P[1] = G; P[2] = B; P[3] = CHAN_MAX
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
P[0] = R; P[1] = G; P[2] = B; P[3] = A
#endif
#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
@ -253,9 +253,9 @@ clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
#define INIT_PIXEL_PTR(P, X, Y) \
GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
#define INC_PIXEL_PTR(P) P += 4
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
P[2] = R; P[1] = G; P[0] = B; P[3] = CHAN_MAX
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
P[2] = R; P[1] = G; P[0] = B; P[3] = A
#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
R = P[2]; G = P[1]; B = P[0]; A = P[3]
@ -268,9 +268,9 @@ clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
#define INIT_PIXEL_PTR(P, X, Y) \
GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
#define INC_PIXEL_PTR(P) P += 4
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
P[1] = R; P[2] = G; P[3] = B; P[0] = CHAN_MAX
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
P[1] = R; P[2] = G; P[3] = B; P[0] = A
#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
R = P[1]; G = P[2]; B = P[3]; A = P[0]
@ -283,9 +283,9 @@ clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
#define INIT_PIXEL_PTR(P, X, Y) \
GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
#define INC_PIXEL_PTR(P) P += 4
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
P[0] = R; P[1] = G; P[2] = B
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
P[0] = R; P[1] = G; P[2] = B
#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
R = P[0]; G = P[1]; B = P[2]; A = CHAN_MAX
@ -298,9 +298,9 @@ clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
#define INIT_PIXEL_PTR(P, X, Y) \
GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
#define INC_PIXEL_PTR(P) P += 4
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
P[0] = B; P[1] = G; P[2] = R
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
P[0] = B; P[1] = G; P[2] = R
#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
B = P[0]; G = P[1]; R = P[2]; A = CHAN_MAX
@ -314,9 +314,9 @@ clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
#define INIT_PIXEL_PTR(P, X, Y) \
GLushort *P = (GLushort *) osmesa->rowaddr[Y] + (X)
#define INC_PIXEL_PTR(P) P += 1
#define STORE_RGB_PIXEL(P, R, G, B) \
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
*P = ( (((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | ((B) >> 3) )
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
*P = ( (((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | ((B) >> 3) )
#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
R = ( (((*P) >> 8) & 0xf8) | (((*P) >> 11) & 0x7) ); \

View file

@ -75,12 +75,16 @@
#endif
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
# define __WIN32__
# define finite _finite
#endif
#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__))
#if defined(__WATCOMC__)
# define finite _finite
#endif
#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
# pragma warning( disable : 4068 ) /* unknown pragma */
# pragma warning( disable : 4710 ) /* function 'foo' not inlined */
# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
@ -113,7 +117,7 @@
# endif
# define GLWINAPI __stdcall
# define GLWINAPIV __cdecl
#elif !defined(__SCITECH_SNAP__)
#elif !defined(BUILD_FOR_SNAP)
/* non-Windows compilation */
# define GLAPI extern
# define GLAPIENTRY
@ -127,7 +131,7 @@
/* compatibility guard so we don't need to change client code */
#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__)
#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
#if 0
# define CALLBACK GLCALLBACK
typedef void *HGLRC;
@ -142,7 +146,7 @@ typedef unsigned long COLORREF;
#define GL_GLEXT_PROTOTYPES
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP)
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP)
# define WGL_FONT_LINES 0
# define WGL_FONT_POLYGONS 1
#ifndef _GNU_H_WINDOWS32_FUNCTIONS
@ -196,7 +200,7 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
#ifndef CAPI
#ifdef WIN32
#if defined(WIN32) && !defined(BUILD_FOR_SNAP)
#define CAPI _cdecl
#else
#define CAPI
@ -278,7 +282,7 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
#endif
#if defined(__SCITECH_SNAP__) && defined(CHECKED)
#if defined(BUILD_FOR_SNAP) && defined(CHECKED)
# define ASSERT(X) _CHECK(X)
#elif defined(DEBUG)
# define ASSERT(X) assert(X)

View file

@ -268,6 +268,8 @@ enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 };
# define ALIGN16 __attribute__ ((aligned (16)))
#elif defined(__MSC__)
# define ALIGN16 __declspec(align(16)) /* GH: Does this work? */
#elif defined(__WATCOMC__)
# define ALIGN16 /* Watcom does not support this */
#else
# warning "ALIGN16 will not 16-byte align!\n"
# define ALIGN16

View file

@ -33,9 +33,15 @@
* 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_RGB_PIXEL(P, R, G, B) to store RGB values in pixel P
* STORE_RGBA_PIXEL(P, R, G, B, A) to store RGBA values in pixel P
* STORE_RGB_PIXEL(P, X, Y, R, G, B) to store RGB values in pixel P
* STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) to store RGBA values in pixel P
* FETCH_RGBA_PIXEL(R, G, B, A, P) to fetch RGBA values from pixel P
*
* Note that in the above STORE_RGBx_PIXEL macros, we also pass in the (X,Y)
* coordinates for the pixels to be stored, which enables dithering in 8-bit
* and 15/16-bit display modes. Most undithered modes or 24/32-bit display
* modes will simply ignore the passed in (X,Y) values.
*
* For color index mode:
* STORE_CI_PIXEL(P, CI) to store a color index in pixel P
* FETCH_CI_PIXEL(CI, P) to fetch a pixel index from pixel P
@ -56,7 +62,7 @@ NAME(write_rgba_span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
if (mask) {
for (i = 0; i < n; i++) {
if (mask[i]) {
STORE_RGBA_PIXEL(pixel, rgba[i][RCOMP], rgba[i][GCOMP],
STORE_RGBA_PIXEL(pixel, x+i, y, rgba[i][RCOMP], rgba[i][GCOMP],
rgba[i][BCOMP], rgba[i][ACOMP]);
}
INC_PIXEL_PTR(pixel);
@ -64,7 +70,7 @@ NAME(write_rgba_span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
}
else {
for (i = 0; i < n; i++) {
STORE_RGBA_PIXEL(pixel, rgba[i][RCOMP], rgba[i][GCOMP],
STORE_RGBA_PIXEL(pixel, x+i, y, rgba[i][RCOMP], rgba[i][GCOMP],
rgba[i][BCOMP], rgba[i][ACOMP]);
INC_PIXEL_PTR(pixel);
}
@ -83,7 +89,7 @@ NAME(write_rgb_span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
if (mask) {
for (i = 0; i < n; i++) {
if (mask[i]) {
STORE_RGB_PIXEL(pixel, rgb[i][RCOMP], rgb[i][GCOMP],
STORE_RGB_PIXEL(pixel, x+i, y, rgb[i][RCOMP], rgb[i][GCOMP],
rgb[i][BCOMP]);
}
INC_PIXEL_PTR(pixel);
@ -91,7 +97,7 @@ NAME(write_rgb_span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
}
else {
for (i = 0; i < n; i++) {
STORE_RGB_PIXEL(pixel, rgb[i][RCOMP], rgb[i][GCOMP],
STORE_RGB_PIXEL(pixel, x+i, y, rgb[i][RCOMP], rgb[i][GCOMP],
rgb[i][BCOMP]);
INC_PIXEL_PTR(pixel);
}
@ -110,7 +116,7 @@ NAME(write_monorgba_span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
if (mask) {
for (i = 0; i < n; i++) {
if (mask[i]) {
STORE_RGBA_PIXEL(pixel, color[RCOMP], color[GCOMP],
STORE_RGBA_PIXEL(pixel, x+i, y, color[RCOMP], color[GCOMP],
color[BCOMP], color[ACOMP]);
}
INC_PIXEL_PTR(pixel);
@ -118,7 +124,7 @@ NAME(write_monorgba_span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
}
else {
for (i = 0; i < n; i++) {
STORE_RGBA_PIXEL(pixel, color[RCOMP], color[GCOMP],
STORE_RGBA_PIXEL(pixel, x+i, y, color[RCOMP], color[GCOMP],
color[BCOMP], color[ACOMP]);
INC_PIXEL_PTR(pixel);
}
@ -138,7 +144,7 @@ NAME(write_rgba_pixels)( const GLcontext *ctx, GLuint n,
for (i = 0; i < n; i++) {
if (mask[i]) {
INIT_PIXEL_PTR(pixel, x[i], y[i]);
STORE_RGBA_PIXEL(pixel, rgba[i][RCOMP], rgba[i][GCOMP],
STORE_RGBA_PIXEL(pixel, x[i], y[i], rgba[i][RCOMP], rgba[i][GCOMP],
rgba[i][BCOMP], rgba[i][ACOMP]);
}
}
@ -157,7 +163,7 @@ NAME(write_monorgba_pixels)( const GLcontext *ctx,
for (i = 0; i < n; i++) {
if (mask[i]) {
INIT_PIXEL_PTR(pixel, x[i], y[i]);
STORE_RGBA_PIXEL(pixel, color[RCOMP], color[GCOMP],
STORE_RGBA_PIXEL(pixel, x[i], y[i], color[RCOMP], color[GCOMP],
color[BCOMP], color[ACOMP]);
}
}