aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-09-04 15:01:33 +0000
committerBrian Paul <[email protected]>2005-09-04 15:01:33 +0000
commiteae73dbd916d3109224fdb938120acd1abb6b646 (patch)
tree2b51387a279767473003ae991188fe0319e5f281 /src/mesa/drivers/dri
parent90cfbd3dd5f30d73a4ed7f96cc740f11c7fb0af9 (diff)
Use InitPointers helper
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_span.c10
-rw-r--r--src/mesa/drivers/dri/i810/i810span.c13
-rw-r--r--src/mesa/drivers/dri/i830/i830_span.c24
-rw-r--r--src/mesa/drivers/dri/i915/intel_span.c36
-rw-r--r--src/mesa/drivers/dri/r300/radeon_span.c23
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_span.c23
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_span.c24
7 files changed, 29 insertions, 124 deletions
diff --git a/src/mesa/drivers/dri/ffb/ffb_span.c b/src/mesa/drivers/dri/ffb/ffb_span.c
index a23f4c66f0a..fff7fa1d3f7 100644
--- a/src/mesa/drivers/dri/ffb/ffb_span.c
+++ b/src/mesa/drivers/dri/ffb/ffb_span.c
@@ -93,7 +93,7 @@ do { unsigned int fbc, ppc, cmp; \
fmesa->ffbScreen->rp_active = 1; \
} while(0)
-#define Y_FLIP(__y) (height - __y)
+#define Y_FLIP(__y) (height - __y - 1)
#define READ_RGBA(rgba,__x,__y) \
do { GLuint p = *(GLuint *)(buf + ((__x)<<2) + ((__y)<<13)); \
@@ -125,11 +125,5 @@ ffbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
assert(vis->redBits == 8);
assert(vis->greenBits == 8);
assert(vis->blueBits == 8);
- drb->Base.GetRow = ffbReadRGBASpan_888;
- drb->Base.GetValues = ffbReadRGBAPixels_888;
- drb->Base.PutRow = ffbWriteRGBASpan_888;
- drb->Base.PutRowRGB = ffbWriteRGBSpan_888;
- drb->Base.PutMonoRow = ffbWriteMonoRGBASpan_888;
- drb->Base.PutValues = ffbWriteRGBAPixels_888;
- drb->Base.PutMonoValues = ffbWriteMonoRGBAPixels_888;
+ ffbInitPointers_888(&drb->Base);
}
diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c
index ac901066648..2112800eebc 100644
--- a/src/mesa/drivers/dri/i810/i810span.c
+++ b/src/mesa/drivers/dri/i810/i810span.c
@@ -23,8 +23,7 @@
char *buf = (char *)(drb->flippedData + \
dPriv->x * 2 + \
dPriv->y * pitch); \
- char *read_buf = buf; \
- (void) read_buf; (void) buf; (void) p
+ (void) buf; (void) p
#define LOCAL_DEPTH_VARS \
i810ContextPtr imesa = I810_CONTEXT(ctx); \
@@ -56,7 +55,7 @@
#define READ_RGBA( rgba, _x, _y ) \
do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
+ GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
@@ -112,13 +111,7 @@ i810SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
if (drb->Base.InternalFormat == GL_RGBA) {
/* always 565 RGB */
- drb->Base.GetRow = i810ReadRGBASpan_565;
- drb->Base.GetValues = i810ReadRGBAPixels_565;
- drb->Base.PutRow = i810WriteRGBASpan_565;
- drb->Base.PutRowRGB = i810WriteRGBSpan_565;
- drb->Base.PutMonoRow = i810WriteMonoRGBASpan_565;
- drb->Base.PutValues = i810WriteRGBAPixels_565;
- drb->Base.PutMonoValues = i810WriteMonoRGBAPixels_565;
+ i810InitPointers_565(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
i810InitDepthPointers_z16(&drb->Base);
diff --git a/src/mesa/drivers/dri/i830/i830_span.c b/src/mesa/drivers/dri/i830/i830_span.c
index 8e9fe38b541..ad34cc8f2da 100644
--- a/src/mesa/drivers/dri/i830/i830_span.c
+++ b/src/mesa/drivers/dri/i830/i830_span.c
@@ -290,34 +290,16 @@ i830SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
if (drb->Base.InternalFormat == GL_RGBA) {
if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) {
- drb->Base.GetRow = i830ReadRGBASpan_555;
- drb->Base.GetValues = i830ReadRGBAPixels_555;
- drb->Base.PutRow = i830WriteRGBASpan_555;
- drb->Base.PutRowRGB = i830WriteRGBSpan_555;
- drb->Base.PutMonoRow = i830WriteMonoRGBASpan_555;
- drb->Base.PutValues = i830WriteRGBAPixels_555;
- drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_555;
+ i830InitPointers_555(&drb->Base);
}
else if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = i830ReadRGBASpan_565;
- drb->Base.GetValues = i830ReadRGBAPixels_565;
- drb->Base.PutRow = i830WriteRGBASpan_565;
- drb->Base.PutRowRGB = i830WriteRGBSpan_565;
- drb->Base.PutMonoRow = i830WriteMonoRGBASpan_565;
- drb->Base.PutValues = i830WriteRGBAPixels_565;
- drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_565;
+ i830InitPointers_565(&drb->Base);
}
else {
assert(vis->redBits == 8);
assert(vis->greenBits == 8);
assert(vis->blueBits == 8);
- drb->Base.GetRow = i830ReadRGBASpan_8888;
- drb->Base.GetValues = i830ReadRGBAPixels_8888;
- drb->Base.PutRow = i830WriteRGBASpan_8888;
- drb->Base.PutRowRGB = i830WriteRGBSpan_8888;
- drb->Base.PutMonoRow = i830WriteMonoRGBASpan_8888;
- drb->Base.PutValues = i830WriteRGBAPixels_8888;
- drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_8888;
+ i830InitPointers_8888(&drb->Base);
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
diff --git a/src/mesa/drivers/dri/i915/intel_span.c b/src/mesa/drivers/dri/i915/intel_span.c
index 9a9decff014..a0f848f7b0e 100644
--- a/src/mesa/drivers/dri/i915/intel_span.c
+++ b/src/mesa/drivers/dri/i915/intel_span.c
@@ -48,9 +48,8 @@
char *buf = (char *) drb->Base.Data + \
dPriv->x * drb->cpp + \
dPriv->y * pitch; \
- char *read_buf = buf; \
GLushort p; \
- (void) read_buf; (void) buf; (void) p
+ (void) buf; (void) p
#define LOCAL_DEPTH_VARS \
intelContextPtr intel = INTEL_CONTEXT(ctx); \
@@ -84,7 +83,7 @@
#define READ_RGBA( rgba, _x, _y ) \
do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
+ GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \
rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \
rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \
@@ -106,7 +105,7 @@ do { \
#define READ_RGBA( rgba, _x, _y ) \
do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
+ GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
rgba[0] = (p >> 7) & 0xf8; \
rgba[1] = (p >> 3) & 0xf8; \
rgba[2] = (p << 3) & 0xf8; \
@@ -139,9 +138,8 @@ do { \
char *buf = (char *)drb->Base.Data + \
dPriv->x * drb->cpp + \
dPriv->y * pitch; \
- char *read_buf = buf; \
GLuint p; \
- (void) read_buf; (void) buf; (void) p
+ (void) buf; (void) p
#undef INIT_MONO_PIXEL
#define INIT_MONO_PIXEL(p,color)\
@@ -161,7 +159,7 @@ do { \
#define READ_RGBA(rgba, _x, _y) \
do { \
- GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \
+ GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \
rgba[0] = (p >> 16) & 0xff; \
rgba[1] = (p >> 8) & 0xff; \
rgba[2] = (p >> 0) & 0xff; \
@@ -236,34 +234,16 @@ intelSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
if (drb->Base.InternalFormat == GL_RGBA) {
if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) {
- drb->Base.GetRow = intelReadRGBASpan_555;
- drb->Base.GetValues = intelReadRGBAPixels_555;
- drb->Base.PutRow = intelWriteRGBASpan_555;
- drb->Base.PutRowRGB = intelWriteRGBSpan_555;
- drb->Base.PutMonoRow = intelWriteMonoRGBASpan_555;
- drb->Base.PutValues = intelWriteRGBAPixels_555;
- drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_555;
+ intelInitPointers_555(&drb->Base);
}
else if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = intelReadRGBASpan_565;
- drb->Base.GetValues = intelReadRGBAPixels_565;
- drb->Base.PutRow = intelWriteRGBASpan_565;
- drb->Base.PutRowRGB = intelWriteRGBSpan_565;
- drb->Base.PutMonoRow = intelWriteMonoRGBASpan_565;
- drb->Base.PutValues = intelWriteRGBAPixels_565;
- drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_565;
+ intelInitPointers_565(&drb->Base);
}
else {
assert(vis->redBits == 8);
assert(vis->greenBits == 8);
assert(vis->blueBits == 8);
- drb->Base.GetRow = intelReadRGBASpan_8888;
- drb->Base.GetValues = intelReadRGBAPixels_8888;
- drb->Base.PutRow = intelWriteRGBASpan_8888;
- drb->Base.PutRowRGB = intelWriteRGBSpan_8888;
- drb->Base.PutMonoRow = intelWriteMonoRGBASpan_8888;
- drb->Base.PutValues = intelWriteRGBAPixels_8888;
- drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_8888;
+ intelInitPointers_8888(&drb->Base);
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
diff --git a/src/mesa/drivers/dri/r300/radeon_span.c b/src/mesa/drivers/dri/r300/radeon_span.c
index 7703e4ac325..547ac3daaf9 100644
--- a/src/mesa/drivers/dri/r300/radeon_span.c
+++ b/src/mesa/drivers/dri/r300/radeon_span.c
@@ -259,17 +259,16 @@ static void radeonSpanRenderStart(GLcontext * ctx)
int p;
driRenderbuffer *drb =
(driRenderbuffer *) ctx->WinSysDrawBuffer->_ColorDrawBuffers[0][0];
- volatile int *read_buf =
+ volatile int *buf =
(volatile int *)(radeon->dri.screen->pFB + drb->offset);
- p = *read_buf;
- *read_buf = p;
+ p = *buf;
+ *buf = p;
}
}
static void radeonSpanRenderFinish(GLcontext * ctx)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
_swrast_flush(ctx);
UNLOCK_HARDWARE(radeon);
}
@@ -289,22 +288,10 @@ void radeonSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
if (drb->Base.InternalFormat == GL_RGBA) {
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = radeonReadRGBASpan_RGB565;
- drb->Base.GetValues = radeonReadRGBAPixels_RGB565;
- drb->Base.PutRow = radeonWriteRGBASpan_RGB565;
- drb->Base.PutRowRGB = radeonWriteRGBSpan_RGB565;
- drb->Base.PutMonoRow = radeonWriteMonoRGBASpan_RGB565;
- drb->Base.PutValues = radeonWriteRGBAPixels_RGB565;
- drb->Base.PutMonoValues = radeonWriteMonoRGBAPixels_RGB565;
+ radeonInitPointers_RGB565(&drb->Base);
}
else {
- drb->Base.GetRow = radeonReadRGBASpan_ARGB8888;
- drb->Base.GetValues = radeonReadRGBAPixels_ARGB8888;
- drb->Base.PutRow = radeonWriteRGBASpan_ARGB8888;
- drb->Base.PutRowRGB = radeonWriteRGBSpan_ARGB8888;
- drb->Base.PutMonoRow = radeonWriteMonoRGBASpan_ARGB8888;
- drb->Base.PutValues = radeonWriteRGBAPixels_ARGB8888;
- drb->Base.PutMonoValues = radeonWriteMonoRGBAPixels_ARGB8888;
+ radeonInitPointers_ARGB8888(&drb->Base);
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
diff --git a/src/mesa/drivers/dri/s3v/s3v_span.c b/src/mesa/drivers/dri/s3v/s3v_span.c
index b8ebd5f30ec..de78f9f6b1b 100644
--- a/src/mesa/drivers/dri/s3v/s3v_span.c
+++ b/src/mesa/drivers/dri/s3v/s3v_span.c
@@ -22,9 +22,8 @@
GLuint height = dPriv->h; \
char *buf = (char *)(sPriv->pFB + drb->offset \
+ (drb->backBuffer ? 0 : dPriv->x * cpp + dPriv->y * pitch));\
- char *read_buf = buf; \
GLuint p; \
- (void) read_buf; (void) buf; (void) p; (void) pitch
+ (void) p
/* FIXME! Depth/Stencil read/writes don't work ! */
#define LOCAL_DEPTH_VARS \
@@ -84,7 +83,7 @@ do { \
#define READ_RGBA( rgba, _x, _y ) \
do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
+ GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
rgba[0] = (p >> 7) & 0xf8; \
rgba[1] = (p >> 2) & 0xf8; \
rgba[2] = (p << 3) & 0xf8; \
@@ -116,7 +115,7 @@ do { \
#define READ_RGBA( rgba, _x, _y ) \
do { \
- GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \
+ GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \
rgba[0] = (p >> 16) & 0xff; \
rgba[1] = (p >> 8) & 0xff; \
rgba[2] = (p >> 0) & 0xff; \
@@ -196,22 +195,10 @@ s3vSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
if (drb->Base.InternalFormat == GL_RGBA) {
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = s3vReadRGBASpan_RGB555;
- drb->Base.GetValues = s3vReadRGBAPixels_RGB555;
- drb->Base.PutRow = s3vWriteRGBASpan_RGB555;
- drb->Base.PutRowRGB = s3vWriteRGBSpan_RGB555;
- drb->Base.PutMonoRow = s3vWriteMonoRGBASpan_RGB555;
- drb->Base.PutValues = s3vWriteRGBAPixels_RGB555;
- drb->Base.PutMonoValues = s3vWriteMonoRGBAPixels_RGB555;
+ s3vInitPointers_RGB555(&drb->Base);
}
else {
- drb->Base.GetRow = s3vReadRGBASpan_ARGB8888;
- drb->Base.GetValues = s3vReadRGBAPixels_ARGB8888;
- drb->Base.PutRow = s3vWriteRGBASpan_ARGB8888;
- drb->Base.PutRowRGB = s3vWriteRGBSpan_ARGB8888;
- drb->Base.PutMonoRow = s3vWriteMonoRGBASpan_ARGB8888;
- drb->Base.PutValues = s3vWriteRGBAPixels_ARGB8888;
- drb->Base.PutMonoValues = s3vWriteMonoRGBAPixels_ARGB8888;
+ s3vInitPointers_ARGB8888(&drb->Base);
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.c b/src/mesa/drivers/dri/tdfx/tdfx_span.c
index 142beb404fc..ce895f82542 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_span.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_span.c
@@ -1356,33 +1356,15 @@ tdfxSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
if (drb->Base.InternalFormat == GL_RGBA) {
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = tdfxReadRGBASpan_RGB565;
- drb->Base.GetValues = tdfxReadRGBAPixels_RGB565;
- drb->Base.PutRow = tdfxWriteRGBASpan_RGB565;
- drb->Base.PutRowRGB = tdfxWriteRGBSpan_RGB565;
- drb->Base.PutMonoRow = tdfxWriteMonoRGBASpan_RGB565;
- drb->Base.PutValues = tdfxWriteRGBAPixels_RGB565;
- drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_RGB565;
+ tdfxInitPointers_RGB565(&drb->Base);
}
else if (vis->redBits == 8 && vis->greenBits == 8
&& vis->blueBits == 8 && vis->alphaBits == 0) {
- drb->Base.GetRow = tdfxReadRGBASpan_RGB888;
- drb->Base.GetValues = tdfxReadRGBAPixels_RGB888;
- drb->Base.PutRow = tdfxWriteRGBASpan_RGB888;
- drb->Base.PutRowRGB = tdfxWriteRGBSpan_RGB888;
- drb->Base.PutMonoRow = tdfxWriteMonoRGBASpan_RGB888;
- drb->Base.PutValues = tdfxWriteRGBAPixels_RGB888;
- drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_RGB888;
+ tdfxInitPointers_RGB888(&drb->Base);
}
else if (vis->redBits == 8 && vis->greenBits == 8
&& vis->blueBits == 8 && vis->alphaBits == 8) {
- drb->Base.GetRow = tdfxReadRGBASpan_ARGB8888;
- drb->Base.GetValues = tdfxReadRGBAPixels_ARGB8888;
- drb->Base.PutRow = tdfxWriteRGBASpan_ARGB8888;
- drb->Base.PutRowRGB = tdfxWriteRGBSpan_ARGB8888;
- drb->Base.PutMonoRow = tdfxWriteMonoRGBASpan_ARGB8888;
- drb->Base.PutValues = tdfxWriteRGBAPixels_ARGB8888;
- drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_ARGB8888;
+ tdfxInitPointers_ARGB8888(&drb->Base);
}
else {
_mesa_problem(NULL, "problem in tdfxSetSpanFunctions");