X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fsis%2Fsis_state.c;h=98e8d02fabe7d80f9e060cea66ea104f6c12ef68;hb=f094b86bb5ab93aedc03df5cf5bdf51ab9d37045;hp=b269d694b0f4ae43f726e4e53dc0dbd66e76ccea;hpb=65a66f5bc37383c00423c21baf8ba9d6771e0259;p=mesa.git diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c index b269d694b0f..98e8d02fabe 100644 --- a/src/mesa/drivers/dri/sis/sis_state.c +++ b/src/mesa/drivers/dri/sis/sis_state.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_ctx.c,v 1.3 2000/09/26 15:56:48 tsi Exp $ */ /* * Authors: @@ -38,12 +37,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_lock.h" #include "sis_tex.h" -#include "context.h" -#include "buffers.h" -#include "enums.h" -#include "colormac.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/colormac.h" #include "swrast/swrast.h" -#include "array_cache/acache.h" +#include "vbo/vbo.h" #include "tnl/tnl.h" #include "swrast_setup/swrast_setup.h" @@ -252,7 +250,7 @@ sisDDDepthMask( GLcontext * ctx, GLboolean flag ) if (ctx->Visual.stencilBits) { if (flag || (ctx->Stencil.WriteMask[0] != 0)) { current->hwCapEnable |= MASK_ZWriteEnable; - if (flag && (ctx->Stencil.WriteMask[0] == 0xff)) { + if (flag && ((ctx->Stencil.WriteMask[0] & 0xff) == 0xff)) { current->hwCapEnable2 &= ~MASK_ZMaskWriteEnable; } else { current->hwCapEnable2 |= MASK_ZMaskWriteEnable; @@ -291,6 +289,12 @@ sisUpdateClipping( GLcontext *ctx ) GLint x1, y1, x2, y2; + if (smesa->is6326) { + /* XXX: 6326 has its own clipping for now. Should be fixed */ + sis6326UpdateClipping(ctx); + return; + } + x1 = 0; y1 = 0; x2 = smesa->width - 1; @@ -401,6 +405,25 @@ static void sisDDColorMask( GLcontext *ctx, * Rendering attributes */ +static void sisUpdateSpecular(GLcontext *ctx) +{ + sisContextPtr smesa = SIS_CONTEXT(ctx); + __GLSiSHardware *current = &smesa->current; + + if (NEED_SECONDARY_COLOR(ctx)) + current->hwCapEnable |= MASK_SpecularEnable; + else + current->hwCapEnable &= ~MASK_SpecularEnable; +} + +static void sisDDLightModelfv(GLcontext *ctx, GLenum pname, + const GLfloat *param) +{ + if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) { + sisUpdateSpecular(ctx); + } +} + static void sisDDShadeModel( GLcontext *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -437,8 +460,6 @@ static void sisDDViewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { - /* update size of Mesa/software ancillary buffers */ - _mesa_ResizeBuffersMESA(); sisCalcViewport( ctx ); } @@ -522,33 +543,31 @@ sisDDLogicOpCode( GLcontext *ctx, GLenum opcode ) void sisDDDrawBuffer( GLcontext *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; - /* - * _DrawDestMask is easier to cope with than . - */ - switch ( ctx->Color._DrawDestMask[0] ) { - case DD_FRONT_LEFT_BIT: - case DD_BACK_LEFT_BIT: + if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) { + FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_TRUE ); + return; + } + + current->hwDstSet &= ~MASK_DstBufferPitch; + switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0] ) { + case BUFFER_FRONT_LEFT: + FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE ); + current->hwOffsetDest = smesa->front.offset >> 1; + current->hwDstSet |= smesa->front.pitch >> 2; + break; + case BUFFER_BACK_LEFT: FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE ); + current->hwOffsetDest = smesa->back.offset >> 1; + current->hwDstSet |= smesa->back.pitch >> 2; break; default: - /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */ FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_TRUE ); 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; - if (current->hwDstSet != prev->hwDstSet) { prev->hwDstSet = current->hwDstSet; smesa->GlobalFlag |= GFLAG_DESTSETTING; @@ -602,7 +621,7 @@ sisDDEnable( GLcontext * ctx, GLenum cap, GLboolean state ) current->hwCapEnable &= ~MASK_CullEnable; break; case GL_DEPTH_TEST: - if (state && smesa->depthbuffer) + if (state && smesa->depth.offset != 0) current->hwCapEnable |= MASK_ZTestEnable; else current->hwCapEnable &= ~MASK_ZTestEnable; @@ -642,7 +661,11 @@ sisDDEnable( GLcontext * ctx, GLenum cap, GLboolean state ) MASK_StencilWriteEnable); } break; - } + case GL_LIGHTING: + case GL_COLOR_SUM_EXT: + sisUpdateSpecular(ctx); + break; + } } @@ -684,7 +707,7 @@ sisDDInvalidateState( GLcontext *ctx, GLuint new_state ) _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); - _ac_InvalidateState( ctx, new_state ); + _vbo_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state ); smesa->NewGLState |= new_state; } @@ -700,7 +723,6 @@ void sisDDInitState( sisContextPtr smesa ) /* add Texture Perspective Enable */ prev->hwCapEnable = MASK_FogPerspectiveEnable | MASK_TextureCacheEnable | MASK_TexturePerspectiveEnable | MASK_DitherEnable; - /*| MASK_SpecularEnable*/ /* prev->hwCapEnable2 = 0x00aa0080; @@ -801,6 +823,7 @@ void sisDDInitState( sisContextPtr smesa ) /* Set initial fog settings. Start and end are the same case. */ sisDDFogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density ); sisDDFogfv( ctx, GL_FOG_END, &ctx->Fog.End ); + sisDDFogfv( ctx, GL_FOG_COORDINATE_SOURCE_EXT, NULL ); sisDDFogfv( ctx, GL_FOG_MODE, NULL ); } @@ -808,7 +831,7 @@ void sisDDInitState( sisContextPtr smesa ) */ void sisDDInitStateFuncs( GLcontext *ctx ) { - ctx->Driver.UpdateState = sisDDInvalidateState; + ctx->Driver.UpdateState = sisDDInvalidateState; ctx->Driver.Clear = sisDDClear; ctx->Driver.ClearColor = sisDDClearColor; @@ -835,19 +858,9 @@ void sisDDInitStateFuncs( GLcontext *ctx ) ctx->Driver.RenderMode = NULL; ctx->Driver.Scissor = sisDDScissor; ctx->Driver.ShadeModel = sisDDShadeModel; + ctx->Driver.LightModelfv = sisDDLightModelfv; ctx->Driver.Viewport = sisDDViewport; - /* Pixel path fallbacks. */ - ctx->Driver.Accum = _swrast_Accum; - ctx->Driver.Bitmap = _swrast_Bitmap; - ctx->Driver.CopyPixels = _swrast_CopyPixels; - ctx->Driver.DrawPixels = _swrast_DrawPixels; - ctx->Driver.ReadPixels = _swrast_ReadPixels; - - /* Swrast hooks for imaging extensions: - */ - ctx->Driver.CopyColorTable = _swrast_CopyColorTable; - ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; - ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; - ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; + /* XXX this should go away */ + ctx->Driver.ResizeBuffers = sisReAllocateBuffers; }