* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c,v 1.7 2002/10/30 12:52:00 alanh Exp $ */
/*
* New fixes:
*
*/
-#include "mtypes.h"
-#include "buffers.h"
-#include "colormac.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "teximage.h"
+#include "main/mtypes.h"
+#include "main/colormac.h"
+#include "main/texformat.h"
+#include "main/texstore.h"
+#include "main/teximage.h"
#include "swrast/swrast.h"
-#include "array_cache/acache.h"
+#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
break;
case GL_DST_COLOR:
if (isNapalm) {
- srcRGB = GR_BLEND_SAME_COLOR_EXT;
+ dstRGB = GR_BLEND_SAME_COLOR_EXT;
break;
}
case GL_ONE_MINUS_DST_COLOR:
if (isNapalm) {
- srcRGB = GR_BLEND_ONE_MINUS_SAME_COLOR_EXT;
+ dstRGB = GR_BLEND_ONE_MINUS_SAME_COLOR_EXT;
break;
}
default:
mask = FXFALSE; /* zbuffer is not touched */
}
- fxMesa->Depth.Clear = (FxU32) (ctx->DepthMaxF * ctx->Depth.Clear);
+ fxMesa->Depth.Clear = (FxU32) (ctx->DrawBuffer->_DepthMaxF * ctx->Depth.Clear);
if ( fxMesa->Depth.Bias != bias ) {
fxMesa->Depth.Bias = bias;
if (fxMesa->haveHwStencil) {
if (ctx->Stencil.Enabled) {
fxMesa->Stencil.Function = ctx->Stencil.Function[0] - GL_NEVER + GR_CMP_NEVER;
- fxMesa->Stencil.RefValue = ctx->Stencil.Ref[0];
- fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask[0];
- fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask[0];
+ fxMesa->Stencil.RefValue = ctx->Stencil.Ref[0] & 0xff;
+ fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask[0] & 0xff;
+ fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask[0] & 0xff;
fxMesa->Stencil.FailFunc = convertGLStencilOp(ctx->Stencil.FailFunc[0]);
fxMesa->Stencil.ZFailFunc = convertGLStencilOp(ctx->Stencil.ZFailFunc[0]);
fxMesa->Stencil.ZPassFunc = convertGLStencilOp(ctx->Stencil.ZPassFunc[0]);
}
-static void tdfxDDStencilFunc( GLcontext *ctx, GLenum func,
- GLint ref, GLuint mask )
+static void
+tdfxDDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func,
+ GLint ref, GLuint mask )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
fxMesa->new_state |= TDFX_NEW_STENCIL;
}
-static void tdfxDDStencilMask( GLcontext *ctx, GLuint mask )
+static void
+tdfxDDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
fxMesa->new_state |= TDFX_NEW_STENCIL;
}
-static void tdfxDDStencilOp( GLcontext *ctx, GLenum sfail,
- GLenum zfail, GLenum zpass )
+static void
+tdfxDDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum sfail,
+ GLenum zfail, GLenum zpass )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
GLsizei w, GLsizei h )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
FLUSH_BATCH( fxMesa );
fxMesa->new_state |= TDFX_NEW_VIEWPORT;
}
FLUSH_BATCH( fxMesa );
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->Color._DrawDestMask[0] ) {
- case DD_FRONT_LEFT_BIT:
+ if (ctx->DrawBuffer->_NumColorDrawBuffers > 1) {
+ FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_TRUE );
+ return;
+ }
+
+ switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0] ) {
+ case BUFFER_FRONT_LEFT:
fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
fxMesa->new_state |= TDFX_NEW_RENDER;
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
- case DD_BACK_LEFT_BIT:
+ case BUFFER_BACK_LEFT:
fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
fxMesa->new_state |= TDFX_NEW_RENDER;
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
- case 0:
+ case -1:
FX_grColorMaskv( ctx, false4 );
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_TRUE );
break;
}
-
- /* We want to update the s/w rast state too so that tdfxDDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
}
{
_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 );
TDFX_CONTEXT(ctx)->new_gl_state |= new_state;
}
ctx->Driver.UpdateState = tdfxDDInvalidateState;
-
- /* State notification callbacks:
- */
ctx->Driver.ClearColor = tdfxDDClearColor;
ctx->Driver.DrawBuffer = tdfxDDDrawBuffer;
ctx->Driver.ReadBuffer = tdfxDDReadBuffer;
- ctx->Driver.ColorMask = tdfxDDColorMask;
-
ctx->Driver.AlphaFunc = tdfxDDAlphaFunc;
ctx->Driver.BlendEquationSeparate = tdfxDDBlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = tdfxDDBlendFuncSeparate;
ctx->Driver.ClearDepth = tdfxDDClearDepth;
+ ctx->Driver.ColorMask = tdfxDDColorMask;
ctx->Driver.CullFace = tdfxDDCullFace;
ctx->Driver.FrontFace = tdfxDDFrontFace;
ctx->Driver.DepthFunc = tdfxDDDepthFunc;
ctx->Driver.ShadeModel = tdfxDDShadeModel;
if ( fxMesa->haveHwStencil ) {
- ctx->Driver.StencilFunc = tdfxDDStencilFunc;
- ctx->Driver.StencilMask = tdfxDDStencilMask;
- ctx->Driver.StencilOp = tdfxDDStencilOp;
+ ctx->Driver.StencilFuncSeparate = tdfxDDStencilFuncSeparate;
+ ctx->Driver.StencilMaskSeparate = tdfxDDStencilMaskSeparate;
+ ctx->Driver.StencilOpSeparate = tdfxDDStencilOpSeparate;
}
ctx->Driver.Viewport = tdfxDDViewport;
-
- /* 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;
}