X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fsis%2Fsis_clear.c;h=323383da62a9d011c7d15453ba4c15a1173c427c;hb=f094b86bb5ab93aedc03df5cf5bdf51ab9d37045;hp=f24454641de18be0911f3fba4917429ec9466c61;hpb=005070a62a679dfb7a5676f5645458a3183ca434;p=mesa.git diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c index f24454641de..323383da62a 100644 --- a/src/mesa/drivers/dri/sis/sis_clear.c +++ b/src/mesa/drivers/dri/sis/sis_clear.c @@ -24,7 +24,6 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_clear.c,v 1.5 2000/09/26 15:56:48 tsi Exp $ */ /* * Authors: @@ -37,7 +36,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_lock.h" #include "swrast/swrast.h" -#include "macros.h" +#include "main/macros.h" static GLbitfield sis_3D_Clear( GLcontext * ctx, GLbitfield mask, GLint x, GLint y, GLint width, @@ -78,7 +77,7 @@ sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil ) switch (smesa->zFormat) { case SiS_ZFORMAT_Z16: - zPattern = FLOAT_TO_USHORT(z); + CLAMPED_FLOAT_TO_USHORT(zPattern, z); zPattern |= zPattern << 16; break; case SiS_ZFORMAT_S8Z24: @@ -95,27 +94,18 @@ sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil ) } void -sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all, - GLint x, GLint y, GLint width, GLint height ) +sisDDClear( GLcontext * ctx, GLbitfield mask ) { - sisContextPtr smesa = SIS_CONTEXT(ctx); - - GLint x1, y1, width1, height1; + sisContextPtr smesa = SIS_CONTEXT(ctx); - if (all) { - GLframebuffer *buffer = ctx->DrawBuffer; + GLint x1, y1, width1, height1; - x1 = 0; - y1 = 0; - width1 = buffer->Width; - height1 = buffer->Height; - } else { - x1 = x; - y1 = Y_FLIP(y+height-1); - width1 = width; - height1 = height; - } - /* XXX: Scissoring */ + /* get region after locking: */ + x1 = ctx->DrawBuffer->_Xmin; + y1 = ctx->DrawBuffer->_Ymin; + width1 = ctx->DrawBuffer->_Xmax - x1; + height1 = ctx->DrawBuffer->_Ymax - y1; + y1 = Y_FLIP(y1 + height1 - 1); /* Mask out any non-existent buffers */ if (ctx->Visual.depthBits == 0 || !ctx->Depth.Mask) @@ -133,7 +123,8 @@ sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all, if ((smesa->current.hwCapEnable2 & (MASK_AlphaMaskWriteEnable | MASK_ColorMaskWriteEnable) && (mask & (BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT)) != 0) || - (ctx->Stencil.WriteMask[0] < 0xff && (mask & BUFFER_BIT_STENCIL) != 0) ) + ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff && + (mask & BUFFER_BIT_STENCIL) != 0) ) { mask = sis_3D_Clear( ctx, mask, x1, y1, width1, height1 ); } @@ -152,7 +143,7 @@ sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all, UNLOCK_HARDWARE(); if (mask != 0) - _swrast_Clear( ctx, mask, all, x1, y1, width, height ); + _swrast_Clear( ctx, mask); } @@ -213,13 +204,13 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask, if (bClrStencil) { dwSten1 = STENCIL_FORMAT_8 | SiS_STENCIL_ALWAYS | - (ctx->Stencil.Clear << 8) | 0xff; + ((ctx->Stencil.Clear & 0xff) << 8) | 0xff; dwSten2 = SiS_SFAIL_REPLACE | SiS_SPASS_ZFAIL_REPLACE | SiS_SPASS_ZPASS_REPLACE; dwEnable1 = MASK_ZWriteEnable | MASK_StencilWriteEnable | MASK_StencilTestEnable; dwEnable2 |= MASK_ZMaskWriteEnable; - dwDepthMask |= ctx->Stencil.WriteMask[0] << 24; + dwDepthMask |= (ctx->Stencil.WriteMask[0] & 0xff) << 24; } else if (bClrDepth) { dwEnable1 = MASK_ZWriteEnable; dwEnable2 |= MASK_ZMaskWriteEnable; @@ -336,9 +327,7 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height ) { sisContextPtr smesa = SIS_CONTEXT(ctx); - int count; - GLuint depth = smesa->bytesPerPixel; drm_clip_rect_t *pExtents = NULL; GLint xx, yy; GLint x0, y0, width0, height0; @@ -386,8 +375,6 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y, if (width <= 0 || height <= 0) continue; - int cmd; - mWait3DCmdQueue (8); MMIO(REG_SRC_PITCH, (smesa->bytesPerPixel == 4) ? BLIT_DEPTH_32 : BLIT_DEPTH_16);