//----------------------------------------------------------------------------- // // This file contains color blend functions. // // Copyright (C) Microsoft Corporation, 1997. // // WARNING WARNING WARNING // This cpp file generated from mcp file. // EDIT THE MCP FILE. // I warned you. // WARNING WARNING WARNING // //----------------------------------------------------------------------------- include(`m4hdr.mh')dnl #include "pch.cpp" #pragma hdrstop #include "catest_mh.h" extern UINT16 g_uDitherTable[16]; dnl dnl d_DoZWrite dnl dnl Inserts conditional Z Defered write code dnl $1 the function type, $2 is the format of the Z buffer. dnl define(`d_DoZWrite', `ifelse(`$1', `NoZWrite', `', `*((UINT$2*)pS->pZ) = (UINT$2)pCtx->SI.uZDeferred;')')dnl dnl dnl d_DoEnd dnl dnl $1 is NoStencil or Stencil dnl define(`d_DoEnd', `ifelse($1, `NoStencil', `pCtx->pfnAlphaTestPassEnd(pCtx, pP, pS);', `if (pCtx->SI.bStencilPass) { pCtx->pfnAlphaTestPassEnd(pCtx, pP, pS); } else { // in the C code this does a return, since this is the // last bead before write // pCtx->pfnAlphaTestFailEnd(pCtx, pP, pS); }')')dnl dnl dnl dnl d_DoAlphaDitherTest dnl dnl Inserts conditional AlphaDither Test code dnl $1 the function type dnl $2 is the ZWrite type dnl $3 is the format of the Z buffer dnl $4 is whether this function do a conditional return based on stencil dnl define(`d_DoAlphaDitherTest', `ifelse(`$1', `NoAlphaDither', `', ` INT32 Alpha; UINT16 uDither = g_uDitherTable[pCtx->SI.uDitherOffset]; if (pCtx->cActTex != 0) { Alpha = RGBA_GETALPHA(pCtx->SI.TexCol[0]); } else { Alpha = pS->uA >> COLOR_SHIFT; } if ((Alpha & 0xff) > uDither) { d_DoZWrite($2, $3) d_DoEnd($4) }')')dnl define(`d_AlphaHdr', ` void C_AlphaTest_$1_$2_$3_$4_$5(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP, PD3DI_RASTSPAN pS) { ifelse(`$1', `NoAlpha', `d_DoAlphaDitherTest(`$2', `$3', `$4', `$5')', ` if (ACMP(pCtx, pCtx->SI.uBA, pCtx->iARef)) { ifelse($2, `NoAlphaDither', ` d_DoZWrite(`$3', `$4') d_DoEnd($5)', `d_DoAlphaDitherTest(`$2', `$3', `$4', `$5')') } else { // in the C code this does a return, since this is the // last bead before write // pCtx->pfnAlphaTestFailEnd(pCtx, pP, pS); }') dnl }') dnl d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`d_AlphaHdr(AA, BB, CC, DD, EE)', `AA', `NoAlpha', `Alpha')', `BB', `NoAlphaDither', `AlphaDither')', `CC', `NoZWrite', `ZWrite')', `DD', `16', `32')', `EE', `NoStencil', `Stencil')