summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/sis
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-09-03 16:43:02 +0000
committerBrian Paul <[email protected]>2005-09-03 16:43:02 +0000
commit687918b794d12a0ff5d395b8cf87880dbe8012bf (patch)
tree280d1b882dc3bfd0e105d14a1f9d90c7cef935dd /src/mesa/drivers/dri/sis
parente6925b51e1e71dc45079636ce336a09806356999 (diff)
SetBuffer, renderbuffer changes
Diffstat (limited to 'src/mesa/drivers/dri/sis')
-rw-r--r--src/mesa/drivers/dri/sis/sis_context.h1
-rw-r--r--src/mesa/drivers/dri/sis/sis_screen.c11
-rw-r--r--src/mesa/drivers/dri/sis/sis_span.c68
-rw-r--r--src/mesa/drivers/dri/sis/sis_state.c13
4 files changed, 20 insertions, 73 deletions
diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h
index 36754022215..fee8f6ead11 100644
--- a/src/mesa/drivers/dri/sis/sis_context.h
+++ b/src/mesa/drivers/dri/sis/sis_context.h
@@ -345,7 +345,6 @@ struct sis_context
/* Drawable, cliprect and scissor information
*/
GLint drawOffset, drawPitch;
- GLint readOffset, readPitch;
/* Mirrors of some DRI state
*/
diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c
index 8815d0e8326..dcbf62640b8 100644
--- a/src/mesa/drivers/dri/sis/sis_screen.c
+++ b/src/mesa/drivers/dri/sis/sis_screen.c
@@ -209,14 +209,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (isPixmap)
return GL_FALSE; /* not implemented */
-#if 0
- driDrawPriv->driverPrivate = (void *)_mesa_create_framebuffer(
- mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 ); /* XXX */
-#else
+ {
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
/* XXX double-check the Offset/Pitch parameters! */
@@ -275,7 +268,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv,
GL_FALSE, /* alpha */
GL_FALSE /* aux */);
driDrawPriv->driverPrivate = (void *) fb;
-#endif
+ }
return (driDrawPriv->driverPrivate != NULL);
}
diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c
index f0cf771d616..5e3d7b9e4e8 100644
--- a/src/mesa/drivers/dri/sis/sis_span.c
+++ b/src/mesa/drivers/dri/sis/sis_span.c
@@ -44,9 +44,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOCAL_VARS \
sisContextPtr smesa = SIS_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = smesa->driDrawable; \
- GLuint pitch = smesa->drawPitch; \
- char *buf = (char *)(smesa->FbBase + smesa->drawOffset); \
- char *read_buf = (char *)(smesa->FbBase + smesa->readOffset); \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint pitch = drb->pitch; \
+ char *buf = (char *)(smesa->FbBase + drb->offset); \
+ char *read_buf = buf; \
GLuint p; \
(void) read_buf; (void) buf; (void) p
@@ -89,7 +90,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define READ_DEPTH( d, _x, _y ) \
d = *(GLushort *)(buf + (_x)*2 + (_y)*smesa->depthPitch);
-#define TAG(x) sis##x##_16
+#define TAG(x) sis##x##_z16
#include "depthtmp.h"
@@ -101,7 +102,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define READ_DEPTH( d, _x, _y ) \
d = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch);
-#define TAG(x) sis##x##_32
+#define TAG(x) sis##x##_z32
#include "depthtmp.h"
@@ -118,7 +119,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
d = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) & 0x00ffffff; \
}
-#define TAG(x) sis##x##_24_8
+#define TAG(x) sis##x##_z24_s8
#include "depthtmp.h"
#define WRITE_STENCIL( _x, _y, d ) { \
@@ -131,33 +132,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define READ_STENCIL( d, _x, _y ) \
d = (*(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) & 0xff000000) >> 24;
-#define TAG(x) sis##x##_24_8
+#define TAG(x) sis##x##_z24_s8
#include "stenciltmp.h"
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void sisDDSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- smesa->drawOffset = smesa->readOffset = smesa->frontOffset;
- smesa->drawPitch = smesa->readPitch = smesa->frontPitch;
- break;
- case BUFFER_BIT_BACK_LEFT:
- smesa->drawOffset = smesa->readOffset = smesa->backOffset;
- smesa->drawPitch = smesa->readPitch = smesa->backPitch;
- break;
- default:
- break;
- }
-}
void sisSpanRenderStart( GLcontext *ctx )
{
@@ -180,8 +158,6 @@ void
sisDDInitSpanFuncs( GLcontext *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = sisDDSetBuffer;
swdd->SpanRenderStart = sisSpanRenderStart;
swdd->SpanRenderFinish = sisSpanRenderFinish;
}
@@ -203,35 +179,15 @@ sisSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = sisReadDepthSpan_16;
- drb->Base.GetValues = sisReadDepthPixels_16;
- drb->Base.PutRow = sisWriteDepthSpan_16;
- drb->Base.PutMonoRow = sisWriteMonoDepthSpan_16;
- drb->Base.PutValues = sisWriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
+ sisInitDepthPointers_z16(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = sisReadDepthSpan_24_8;
- drb->Base.GetValues = sisReadDepthPixels_24_8;
- drb->Base.PutRow = sisWriteDepthSpan_24_8;
- drb->Base.PutMonoRow = sisWriteMonoDepthSpan_24_8;
- drb->Base.PutValues = sisWriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
+ sisInitDepthPointers_z24_s8(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
- drb->Base.GetRow = sisReadDepthSpan_32;
- drb->Base.GetValues = sisReadDepthPixels_32;
- drb->Base.PutRow = sisWriteDepthSpan_32;
- drb->Base.PutMonoRow = sisWriteMonoDepthSpan_32;
- drb->Base.PutValues = sisWriteDepthPixels_32;
- drb->Base.PutMonoValues = NULL;
+ sisInitDepthPointers_z32(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = sisReadStencilSpan_24_8;
- drb->Base.GetValues = sisReadStencilPixels_24_8;
- drb->Base.PutRow = sisWriteStencilSpan_24_8;
- drb->Base.PutMonoRow = sisWriteMonoStencilSpan_24_8;
- drb->Base.PutValues = sisWriteStencilPixels_24_8;
- drb->Base.PutMonoValues = NULL;
+ sisInitStencilPointers_z24_s8(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c
index db58e9090bc..50c45b63ed5 100644
--- a/src/mesa/drivers/dri/sis/sis_state.c
+++ b/src/mesa/drivers/dri/sis/sis_state.c
@@ -522,17 +522,21 @@ sisDDLogicOpCode( GLcontext *ctx, GLenum opcode )
void sisDDDrawBuffer( GLcontext *ctx, GLenum mode )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
-
__GLSiSHardware *prev = &smesa->prev;
__GLSiSHardware *current = &smesa->current;
+ int pitch;
/*
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
case BUFFER_BIT_FRONT_LEFT:
+ FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE );
+ pitch = smesa->frontPitch;
+ break;
case BUFFER_BIT_BACK_LEFT:
FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE );
+ pitch = smesa->backPitch;
break;
default:
/* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
@@ -540,14 +544,9 @@ void sisDDDrawBuffer( GLcontext *ctx, GLenum mode )
return;
}
- /* We want to update the s/w rast state too so that sisDDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
current->hwOffsetDest = (smesa->drawOffset) >> 1;
current->hwDstSet &= ~MASK_DstBufferPitch;
- current->hwDstSet |= smesa->drawPitch >> 2;
+ current->hwDstSet |= pitch >> 2;
if (current->hwDstSet != prev->hwDstSet) {
prev->hwDstSet = current->hwDstSet;