summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/common
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-05-04 20:11:35 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-05-04 20:11:35 +0000
commite4b2356c07d31fbeeabb13b2fb47db703b473080 (patch)
treed8b7f1c7c9e7c84d84349485f942dd205dd4c16d /src/mesa/drivers/dri/common
parentebef61f5c0950572f9c6a81b08f447957461675c (diff)
Major check-in of changes for GL_EXT_framebuffer_object extension.
Main driver impacts: - new code for creating the Mesa GLframebuffer - new span/pixel read/write code Some drivers not yet updated/tested.
Diffstat (limited to 'src/mesa/drivers/dri/common')
-rw-r--r--src/mesa/drivers/dri/common/depthtmp.h55
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.c96
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.h39
-rw-r--r--src/mesa/drivers/dri/common/spantmp.h54
-rw-r--r--src/mesa/drivers/dri/common/spantmp2.h105
-rw-r--r--src/mesa/drivers/dri/common/stenciltmp.h69
6 files changed, 329 insertions, 89 deletions
diff --git a/src/mesa/drivers/dri/common/depthtmp.h b/src/mesa/drivers/dri/common/depthtmp.h
index ad26e6b891..74273165e4 100644
--- a/src/mesa/drivers/dri/common/depthtmp.h
+++ b/src/mesa/drivers/dri/common/depthtmp.h
@@ -1,5 +1,13 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/common/depthtmp.h,v 1.5 2001/03/21 16:14:20 dawes Exp $ */
+/*
+ * Notes:
+ * 1. These functions plug into the gl_renderbuffer structure.
+ * 2. The 'values' parameter always points to GLuint values, regardless of
+ * the actual Z buffer depth.
+ */
+
+
#ifndef DBG
#define DBG 0
#endif
@@ -20,12 +28,14 @@
#endif
static void TAG(WriteDepthSpan)( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLdepth *depth,
+ struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
+ const void *values,
const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLuint *depth = (const GLuint *) values;
GLint x1;
GLint n1;
LOCAL_DEPTH_VARS;
@@ -64,14 +74,31 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx,
HW_WRITE_UNLOCK();
}
-#if !HAVE_HW_DEPTH_SPANS
+
+#if HAVE_HW_DEPTH_SPANS
+/* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */
+static void
+TAG(WriteMonoDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
+ const void *value, const GLubyte mask[] )
+{
+ const GLuint depthVal = *((GLuint *) value);
+ GLuint depths[MAX_WIDTH];
+ GLuint i;
+ for (i = 0; i < n; i++)
+ depths[i] = depthVal;
+ TAG(WriteDepthSpan)(ctx, rb, n, x, y, depths, mask);
+}
+#else
static void TAG(WriteMonoDepthSpan)( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLdepth depth,
- const GLubyte mask[] )
+ struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
+ const void *value,
+ const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLuint depth = *((GLuint *) value);
GLint x1;
GLint n1;
LOCAL_DEPTH_VARS;
@@ -102,15 +129,18 @@ static void TAG(WriteMonoDepthSpan)( GLcontext *ctx,
}
#endif
+
static void TAG(WriteDepthPixels)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n,
const GLint x[],
const GLint y[],
- const GLdepth depth[],
+ const void *values,
const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLuint *depth = (const GLuint *) values;
GLuint i;
LOCAL_DEPTH_VARS;
@@ -141,11 +171,13 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx,
/* Read depth spans and pixels
*/
static void TAG(ReadDepthSpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- GLdepth depth[] )
+ void *values )
{
HW_READ_LOCK()
{
+ GLuint *depth = (GLuint *) values;
GLint x1, n1;
LOCAL_DEPTH_VARS;
@@ -172,12 +204,15 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx,
HW_READ_UNLOCK();
}
-static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n,
+static void TAG(ReadDepthPixels)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n,
const GLint x[], const GLint y[],
- GLdepth depth[] )
+ void *values )
{
HW_READ_LOCK()
{
+ GLuint *depth = (GLuint *) values;
GLuint i;
LOCAL_DEPTH_VARS;
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c
new file mode 100644
index 0000000000..3d9574f0cf
--- /dev/null
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -0,0 +1,96 @@
+
+#include "mtypes.h"
+#include "drirenderbuffer.h"
+#include "renderbuffer.h"
+#include "imports.h"
+
+
+/**
+ * This will get called when a window is resized.
+ * Just update width, height and internal format fields for now.
+ */
+static GLboolean
+driRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb,
+ GLenum internalFormat, GLuint width, GLuint height)
+{
+ rb->Width = width;
+ rb->Height = height;
+ rb->InternalFormat = internalFormat;
+ return GL_TRUE;
+}
+
+
+/**
+ * Allocate a new driRenderbuffer object.
+ * Individual drivers are free to implement different versions of
+ * this function.
+ * \param format Either GL_RGBA, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24,
+ * GL_DEPTH_COMPONENT32, or GL_STENCIL_INDEX8_EXT (for now).
+ * \param cpp chars or bytes per pixel
+ * \param offset start of buffer with respect to framebuffer address
+ * \param pitch pixels per row
+ */
+driRenderbuffer *
+driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch)
+{
+ driRenderbuffer *drb;
+
+ assert(format == GL_RGBA ||
+ format == GL_DEPTH_COMPONENT16 ||
+ format == GL_DEPTH_COMPONENT24 ||
+ format == GL_DEPTH_COMPONENT32 ||
+ format == GL_STENCIL_INDEX8_EXT);
+
+ assert(cpp > 0);
+ assert(pitch > 0);
+
+ drb = _mesa_calloc(sizeof(driRenderbuffer));
+ if (drb) {
+ const GLuint name = 0;
+
+ _mesa_init_renderbuffer(&drb->Base, name);
+
+ /* Make sure we're using a null-valued GetPointer routine */
+ assert(drb->Base.GetPointer(NULL, &drb->Base, 0, 0) == NULL);
+
+ drb->Base.InternalFormat = format;
+
+ if (format == GL_RGBA) {
+ /* Color */
+ drb->Base._BaseFormat = GL_RGBA;
+ drb->Base.DataType = GL_UNSIGNED_BYTE;
+ }
+ else if (format == GL_DEPTH_COMPONENT16) {
+ /* Depth */
+ drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
+ /* we always Get/Put 32-bit Z values */
+ drb->Base.DataType = GL_UNSIGNED_INT;
+ }
+ else if (format == GL_DEPTH_COMPONENT24) {
+ /* Depth */
+ drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
+ /* we always Get/Put 32-bit Z values */
+ drb->Base.DataType = GL_UNSIGNED_INT;
+ }
+ else {
+ /* Stencil */
+ ASSERT(format == GL_STENCIL_INDEX8);
+ drb->Base._BaseFormat = GL_STENCIL_INDEX;
+ drb->Base.DataType = GL_UNSIGNED_BYTE;
+ }
+
+ /* XXX if we were allocating a user-created renderbuffer, we'd have
+ * to fill in the ComponentSizes[] array too.
+ */
+
+ drb->Base.AllocStorage = driRenderbufferStorage;
+ /* using default Delete function */
+
+
+ /* DRI renderbuffer-specific fields: */
+ drb->offset = offset;
+ drb->pitch = pitch;
+ drb->cpp = cpp;
+ }
+ return drb;
+}
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h
new file mode 100644
index 0000000000..627f1d41d9
--- /dev/null
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.h
@@ -0,0 +1,39 @@
+
+/**
+ * A driRenderbuffer is dervied from gl_renderbuffer.
+ * It describes a color buffer (front or back), a depth buffer, or stencil
+ * buffer etc.
+ * Specific to DRI drivers are the offset and pitch fields.
+ */
+
+
+#ifndef DRIRENDERBUFFER_H
+#define DRIRENDERBUFFER_H
+
+#include "mtypes.h"
+
+typedef struct {
+ struct gl_renderbuffer Base;
+
+ /* Chars or bytes per pixel. If Z and Stencil are stored together this
+ * will typically be 32 whether this a depth or stencil renderbuffer.
+ */
+ GLint cpp;
+
+ /* Buffer position and pitch (row stride). Recall that for today's DRI
+ * drivers, we have statically allocated color/depth/stencil buffers.
+ * So this information describes the whole screen, not just a window.
+ * To address pixels in a window, we need to know the window's position
+ * and size with respect to the screen.
+ */
+ GLint offset; /* in bytes */
+ GLint pitch; /* in pixels */
+
+} driRenderbuffer;
+
+
+driRenderbuffer *
+driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch);
+
+
+#endif /* DRIRENDERBUFFER_H */
diff --git a/src/mesa/drivers/dri/common/spantmp.h b/src/mesa/drivers/dri/common/spantmp.h
index 96f26333fc..b15bbb2577 100644
--- a/src/mesa/drivers/dri/common/spantmp.h
+++ b/src/mesa/drivers/dri/common/spantmp.h
@@ -56,13 +56,14 @@
#endif
-static void TAG(WriteRGBASpan)( const GLcontext *ctx,
+static void TAG(WriteRGBASpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[] )
+ const void *values, const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
GLint x1;
GLint n1;
LOCAL_VARS;
@@ -98,13 +99,14 @@ static void TAG(WriteRGBASpan)( const GLcontext *ctx,
HW_WRITE_UNLOCK();
}
-static void TAG(WriteRGBSpan)( const GLcontext *ctx,
+static void TAG(WriteRGBSpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3],
- const GLubyte mask[] )
+ const void *values, const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;
GLint x1;
GLint n1;
LOCAL_VARS;
@@ -136,15 +138,14 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx,
HW_WRITE_UNLOCK();
}
-static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[] )
+static void TAG(WriteRGBAPixels)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, const GLint x[], const GLint y[],
+ const void *values, const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
GLuint i;
LOCAL_VARS;
@@ -183,13 +184,15 @@ static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
}
-static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx,
+static void TAG(WriteMonoRGBASpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLchan color[4],
+ const void *value,
const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte *color = (const GLubyte *) value;
GLint x1;
GLint n1;
LOCAL_VARS;
@@ -221,14 +224,16 @@ static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx,
}
-static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
+static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n,
- const GLint x[], const GLint y[],
- const GLchan color[],
- const GLubyte mask[] )
+ const GLint x[], const GLint y[],
+ const void *value,
+ const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte *color = (const GLubyte *) value;
GLuint i;
LOCAL_VARS;
INIT_MONO_PIXEL(p, color);
@@ -261,12 +266,14 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
}
-static void TAG(ReadRGBASpan)( const GLcontext *ctx,
+static void TAG(ReadRGBASpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
+ void *values)
{
HW_READ_LOCK()
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
GLint x1,n1;
LOCAL_VARS;
@@ -287,12 +294,15 @@ static void TAG(ReadRGBASpan)( const GLcontext *ctx,
}
-static void TAG(ReadRGBAPixels)( const GLcontext *ctx,
+static void TAG(ReadRGBAPixels)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
+ void *values )
{
HW_READ_LOCK()
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
+ const GLubyte *mask = NULL; /* remove someday */
GLuint i;
LOCAL_VARS;
diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h
index fa737a9623..e15491d1ad 100644
--- a/src/mesa/drivers/dri/common/spantmp2.h
+++ b/src/mesa/drivers/dri/common/spantmp2.h
@@ -145,13 +145,14 @@
#include "x86/common_x86_asm.h"
#endif
-static void TAG(WriteRGBASpan)( const GLcontext *ctx,
+static void TAG(WriteRGBASpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[] )
+ const void *values, const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
GLint x1;
GLint n1;
LOCAL_VARS;
@@ -187,13 +188,14 @@ static void TAG(WriteRGBASpan)( const GLcontext *ctx,
HW_WRITE_UNLOCK();
}
-static void TAG(WriteRGBSpan)( const GLcontext *ctx,
+static void TAG(WriteRGBSpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3],
- const GLubyte mask[] )
+ const void *values, const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;
GLint x1;
GLint n1;
LOCAL_VARS;
@@ -225,15 +227,14 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx,
HW_WRITE_UNLOCK();
}
-static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[] )
+static void TAG(WriteRGBAPixels)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, const GLint x[], const GLint y[],
+ const void *values, const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
GLint i;
LOCAL_VARS;
@@ -272,13 +273,14 @@ static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
}
-static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx,
+static void TAG(WriteMonoRGBASpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLchan color[4],
- const GLubyte mask[] )
+ const void *value, const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte *color = (const GLubyte *) value;
GLint x1;
GLint n1;
LOCAL_VARS;
@@ -310,14 +312,16 @@ static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx,
}
-static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
+static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
- const GLchan color[],
+ const void *value,
const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte *color = (const GLubyte *) value;
GLint i;
LOCAL_VARS;
INIT_MONO_PIXEL(p, color);
@@ -350,12 +354,13 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
}
-static void TAG(ReadRGBASpan)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
+static void TAG(ReadRGBASpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y, void *values)
{
HW_READ_LOCK()
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
GLint x1,n1;
LOCAL_VARS;
@@ -381,9 +386,9 @@ static void TAG(ReadRGBASpan)( const GLcontext *ctx,
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
((SPANTMP_PIXEL_FMT == GL_RGB) && \
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
-static void TAG2(ReadRGBASpan,_MMX)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
+static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx,
+ GLuint n, GLint x, GLint y,
+ GLubyte rgba[][4])
{
#ifndef USE_INNER_EMMS
/* The EMMS instruction is directly in-lined here because using GCC's
@@ -394,6 +399,7 @@ static void TAG2(ReadRGBASpan,_MMX)( const GLcontext *ctx,
HW_READ_LOCK()
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
GLint x1,n1;
LOCAL_VARS;
@@ -429,12 +435,14 @@ static void TAG2(ReadRGBASpan,_MMX)( const GLcontext *ctx,
#if defined(USE_SSE_ASM) && \
(SPANTMP_PIXEL_FMT == GL_BGRA) && \
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-static void TAG2(ReadRGBASpan,_SSE2)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
+static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
+ void *values)
{
HW_READ_LOCK()
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
GLint x1,n1;
LOCAL_VARS;
@@ -461,9 +469,10 @@ static void TAG2(ReadRGBASpan,_SSE2)( const GLcontext *ctx,
#if defined(USE_SSE_ASM) && \
(SPANTMP_PIXEL_FMT == GL_BGRA) && \
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-static void TAG2(ReadRGBASpan,_SSE)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
+static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
+ void *values)
{
#ifndef USE_INNER_EMMS
/* The EMMS instruction is directly in-lined here because using GCC's
@@ -474,6 +483,7 @@ static void TAG2(ReadRGBASpan,_SSE)( const GLcontext *ctx,
HW_READ_LOCK()
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
GLint x1,n1;
LOCAL_VARS;
@@ -501,12 +511,15 @@ static void TAG2(ReadRGBASpan,_SSE)( const GLcontext *ctx,
#endif
-static void TAG(ReadRGBAPixels)( const GLcontext *ctx,
+static void TAG(ReadRGBAPixels)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
+ void *values )
{
HW_READ_LOCK()
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
+ GLubyte *mask = NULL; /* remove someday */
GLint i;
LOCAL_VARS;
@@ -537,21 +550,21 @@ static void TAG(ReadRGBAPixels)( const GLcontext *ctx,
HW_READ_UNLOCK();
}
-static void TAG(InitPointers)(struct swrast_device_driver *swdd)
+static void TAG(InitPointers)(struct gl_renderbuffer *rb)
{
- swdd->WriteRGBASpan = TAG(WriteRGBASpan);
- swdd->WriteRGBSpan = TAG(WriteRGBSpan);
- swdd->WriteMonoRGBASpan = TAG(WriteMonoRGBASpan);
- swdd->WriteRGBAPixels = TAG(WriteRGBAPixels);
- swdd->WriteMonoRGBAPixels = TAG(WriteMonoRGBAPixels);
- swdd->ReadRGBAPixels = TAG(ReadRGBAPixels);
+ rb->PutRow = TAG(WriteRGBASpan);
+ rb->PutRowRGB = TAG(WriteRGBSpan);
+ rb->PutMonoRow = TAG(WriteMonoRGBASpan);
+ rb->PutValues = TAG(WriteRGBAPixels);
+ rb->PutMonoValues = TAG(WriteMonoRGBAPixels);
+ rb->GetValues = TAG(ReadRGBAPixels);
#if defined(USE_SSE_ASM) && \
(SPANTMP_PIXEL_FMT == GL_BGRA) && \
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
if ( cpu_has_xmm2 ) {
- if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "SSE2" );
- swdd->ReadRGBASpan = TAG2(ReadRGBASpan, _SSE2);
+ if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE2" );
+ rb->GetRow = TAG2(ReadRGBASpan, _SSE2);
}
else
#endif
@@ -559,8 +572,8 @@ static void TAG(InitPointers)(struct swrast_device_driver *swdd)
(SPANTMP_PIXEL_FMT == GL_BGRA) && \
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
if ( cpu_has_xmm ) {
- if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "SSE" );
- swdd->ReadRGBASpan = TAG2(ReadRGBASpan, _SSE);
+ if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE" );
+ rb->GetRow = TAG2(ReadRGBASpan, _SSE);
}
else
#endif
@@ -570,14 +583,14 @@ static void TAG(InitPointers)(struct swrast_device_driver *swdd)
((SPANTMP_PIXEL_FMT == GL_RGB) && \
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
if ( cpu_has_mmx ) {
- if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "MMX" );
- swdd->ReadRGBASpan = TAG2(ReadRGBASpan, _MMX);
+ if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "MMX" );
+ rb->GetRow = TAG2(ReadRGBASpan, _MMX);
}
else
#endif
{
- if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "C" );
- swdd->ReadRGBASpan = TAG(ReadRGBASpan);
+ if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "C" );
+ rb->GetRow = TAG(ReadRGBASpan);
}
}
diff --git a/src/mesa/drivers/dri/common/stenciltmp.h b/src/mesa/drivers/dri/common/stenciltmp.h
index dfbe665407..ffcb1a4c1e 100644
--- a/src/mesa/drivers/dri/common/stenciltmp.h
+++ b/src/mesa/drivers/dri/common/stenciltmp.h
@@ -19,12 +19,13 @@
#endif
static void TAG(WriteStencilSpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLstencil *stencil,
- const GLubyte mask[] )
+ const void *values, const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte *stencil = (const GLubyte *) values;
GLint x1;
GLint n1;
LOCAL_STENCIL_VARS;
@@ -57,15 +58,57 @@ static void TAG(WriteStencilSpan)( GLcontext *ctx,
}
+static void TAG(WriteMonoStencilSpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
+ const void *value,
+ const GLubyte mask[] )
+{
+ HW_WRITE_LOCK()
+ {
+ const GLubyte stencil = *((const GLubyte *) value);
+ GLint x1;
+ GLint n1;
+ LOCAL_STENCIL_VARS;
+
+ y = Y_FLIP(y);
+
+ HW_CLIPLOOP()
+ {
+ GLint i = 0;
+ CLIPSPAN(x,y,n,x1,n1,i);
+
+ if (DBG) fprintf(stderr, "WriteStencilSpan %d..%d (x1 %d)\n",
+ (int)i, (int)n1, (int)x1);
+
+ if (mask)
+ {
+ for (;n1>0;i++,x1++,n1--)
+ if (mask[i])
+ WRITE_STENCIL( x1, y, stencil );
+ }
+ else
+ {
+ for (;n1>0;i++,x1++,n1--)
+ WRITE_STENCIL( x1, y, stencil );
+ }
+ }
+ HW_ENDCLIPLOOP();
+ }
+ HW_WRITE_UNLOCK();
+}
+
+
+
static void TAG(WriteStencilPixels)( GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLstencil stencil[],
- const GLubyte mask[] )
+ struct gl_renderbuffer *rb,
+ GLuint n,
+ const GLint x[], const GLint y[],
+ const void *values, const GLubyte mask[] )
{
HW_WRITE_LOCK()
{
+ const GLubyte *stencil = (const GLubyte *) values;
GLuint i;
LOCAL_STENCIL_VARS;
@@ -91,11 +134,13 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx,
/* Read stencil spans and pixels
*/
static void TAG(ReadStencilSpan)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- GLstencil stencil[])
+ void *values)
{
HW_READ_LOCK()
{
+ GLubyte *stencil = (GLubyte *) values;
GLint x1,n1;
LOCAL_STENCIL_VARS;
@@ -115,12 +160,14 @@ static void TAG(ReadStencilSpan)( GLcontext *ctx,
HW_READ_UNLOCK();
}
-static void TAG(ReadStencilPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- GLstencil stencil[] )
+static void TAG(ReadStencilPixels)( GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, const GLint x[], const GLint y[],
+ void *values )
{
HW_READ_LOCK()
{
+ GLubyte *stencil = (GLubyte *) values;
GLuint i;
LOCAL_STENCIL_VARS;