You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
5.2 KiB
163 lines
5.2 KiB
//----------------------------------------------------------------------------
|
|
//
|
|
// primfns.cpp
|
|
//
|
|
// Primitive functions for RAMP/RGB/REF.
|
|
//
|
|
// Copyright (C) Microsoft Corporation, 1998.
|
|
//
|
|
// 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
|
|
|
|
void
|
|
RGBRAMP_StoreLastPixelState(LPVOID pCtx, BOOL bStore)
|
|
{
|
|
((D3DContext *)pCtx)->StoreLastPixelState(bStore);
|
|
}
|
|
dnl
|
|
|
|
HRESULT
|
|
RGBRAMP_Dp2SetViewport(LPVOID pCtx, LPD3DHAL_DP2COMMAND pCmd)
|
|
{
|
|
LPD3DHAL_DP2VIEWPORTINFO pVpt;
|
|
|
|
// Keep only the last viewport notification
|
|
pVpt = (D3DHAL_DP2VIEWPORTINFO *)(pCmd + 1) + (pCmd->wStateCount - 1);
|
|
|
|
return ((D3DContext *)pCtx)->SetViewport(pVpt);
|
|
// return D3D_OK;
|
|
}
|
|
|
|
HRESULT
|
|
RGBRAMP_Dp2SetWRange(LPVOID pCtx, LPD3DHAL_DP2COMMAND pCmd)
|
|
{
|
|
return D3D_OK;
|
|
}
|
|
|
|
HRESULT
|
|
RGBRAMP_Dp2SetRenderStates(LPVOID pCtx, DWORD dwFvf, LPD3DHAL_DP2COMMAND pCmd, LPDWORD lpdwRuntimeRStates)
|
|
{
|
|
return ((D3DContext *)pCtx)->Dp2SetRenderStates(pCmd, lpdwRuntimeRStates);
|
|
}
|
|
|
|
HRESULT
|
|
RGBRAMP_Dp2TextureStageState(LPVOID pCtx, DWORD dwFvf, LPD3DHAL_DP2COMMAND pCmd)
|
|
{
|
|
return ((D3DContext *)pCtx)->Dp2TextureStageState(pCmd, dwFvf);
|
|
}
|
|
|
|
dnl Call RampCheckTexMap if necessary
|
|
dnl $1 - RAMP or RGB
|
|
dnl $2 - pCtx
|
|
dnl $3 - pVtx0
|
|
define(`d_CheckRamp',`dnl
|
|
ifelse(`$1', `RAMP',`
|
|
HRESULT hr;
|
|
// Chekc if Rampmap has changed
|
|
HR_RET(((D3DContext *)$2)->RampCheckTexMap((LPD3DTLVERTEX)$3));')')dnl
|
|
dnl
|
|
define(`d_PointFunc',`
|
|
HRESULT
|
|
$1_Point$2(LPVOID pCtx, PUINT8 pVtx)
|
|
{
|
|
d_CheckRamp($1, pCtx, pVtx)dnl
|
|
ifelse(`$2',`Pack',`dnl
|
|
RAST_GENERIC_VERTEX genVtx;
|
|
((D3DContext *)pCtx)->PackGenVertex(pVtx, &genVtx);
|
|
return ((D3DContext *)pCtx)->m_PrimProc.Point((LPD3DTLVERTEX)&genVtx, (LPD3DTLVERTEX)&genVtx);', `
|
|
return ((D3DContext *)pCtx)->m_PrimProc.Point((LPD3DTLVERTEX)pVtx, (LPD3DTLVERTEX)pVtx);')
|
|
}')dnl
|
|
dnl
|
|
define(`d_LineFunc',`
|
|
HRESULT
|
|
$1_Line$2(LPVOID pCtx, PUINT8 pVtx0, PUINT8 pVtx1)
|
|
{
|
|
d_CheckRamp($1, pCtx, pVtx0)dnl
|
|
ifelse(`$2',`Pack',`dnl
|
|
RAST_GENERIC_VERTEX genVtx0, genVtx1;
|
|
((D3DContext *)pCtx)->PackGenVertex(pVtx0, &genVtx0);
|
|
((D3DContext *)pCtx)->PackGenVertex(pVtx1, &genVtx1);
|
|
return ((D3DContext *)pCtx)->m_PrimProc.Line((LPD3DTLVERTEX)&genVtx0,
|
|
(LPD3DTLVERTEX)&genVtx1,
|
|
(LPD3DTLVERTEX)&genVtx0);', `
|
|
return ((D3DContext *)pCtx)->m_PrimProc.Line((LPD3DTLVERTEX)pVtx0,
|
|
(LPD3DTLVERTEX)pVtx1,
|
|
(LPD3DTLVERTEX)pVtx0);')
|
|
}')dnl
|
|
dnl
|
|
dnl Call different functions for different fill mode
|
|
dnl $1 - Point, Wireframe or Solid
|
|
dnl $2 - pCtx
|
|
dnl $3 - pVtx0
|
|
dnl $4 - pVtx1
|
|
dnl $5 - pVtx2
|
|
dnl $6 - wFlags
|
|
dnl $7 - RAMP or RGB
|
|
define(`d_CheckFillMode',`
|
|
ifelse(`$1', `Solid',`
|
|
return ((D3DContext *)$2)->m_PrimProc.Tri($3, $4, $5);',`dnl
|
|
ifelse(`$1', `Point',`
|
|
ifelse(`$7', `RGB',`HRESULT hr;')
|
|
HR_RET(((D3DContext *)$2)->m_PrimProc.Point($3, $3));
|
|
HR_RET(((D3DContext *)$2)->m_PrimProc.Point($4, $3));
|
|
HR_RET(((D3DContext *)$2)->m_PrimProc.Point($5, $3));
|
|
return D3D_OK;', `
|
|
if (((D3DContext *)$2)->NotCulled($3, $4, $5))
|
|
{
|
|
ifelse(`$7', `RGB',`HRESULT hr;')
|
|
if ($6 & D3DTRIFLAG_EDGEENABLE1)
|
|
{
|
|
HR_RET(((D3DContext *)$2)->m_PrimProc.Line($3, $4, $3));
|
|
}
|
|
if ($6 & D3DTRIFLAG_EDGEENABLE2)
|
|
{
|
|
HR_RET(((D3DContext *)$2)->m_PrimProc.Line($4, $5, $3));
|
|
}
|
|
if ($6 & D3DTRIFLAG_EDGEENABLE3)
|
|
{
|
|
HR_RET(((D3DContext *)$2)->m_PrimProc.Line($5, $3, $3));
|
|
}
|
|
}
|
|
return D3D_OK;')')')dnl
|
|
dnl
|
|
define(`d_TriFunc',`
|
|
HRESULT
|
|
$1_Tri$2$3(LPVOID pCtx, PUINT8 pVtx0, PUINT8 pVtx1, PUINT8 pVtx2, WORD wFlags)
|
|
{dnl
|
|
d_CheckRamp($1, pCtx, pVtx0)dnl
|
|
ifelse(`$2',`Pack',`
|
|
RAST_GENERIC_VERTEX genVtx0, genVtx1, genVtx2;
|
|
((D3DContext *)pCtx)->PackGenVertex(pVtx0, &genVtx0);
|
|
((D3DContext *)pCtx)->PackGenVertex(pVtx1, &genVtx1);
|
|
((D3DContext *)pCtx)->PackGenVertex(pVtx2, &genVtx2);
|
|
d_CheckFillMode($3, pCtx, (LPD3DTLVERTEX)&genVtx0,
|
|
(LPD3DTLVERTEX)&genVtx1,
|
|
(LPD3DTLVERTEX)&genVtx2, wFlags, $1);', `dnl
|
|
d_CheckFillMode($3, pCtx, (LPD3DTLVERTEX)pVtx0,
|
|
(LPD3DTLVERTEX)pVtx1,
|
|
(LPD3DTLVERTEX)pVtx2, wFlags, $1)')
|
|
}')dnl
|
|
d_PointFunc(`RAMP', `')
|
|
d_RepStr(`d_RepStr(`d_PointFunc(AA, BB)',
|
|
`AA', `RGB')',
|
|
`BB', `Pack', `NoPack')
|
|
d_LineFunc(`RAMP', `')
|
|
d_RepStr(`d_RepStr(`d_LineFunc(AA, BB)',
|
|
`AA', `RGB')',
|
|
`BB', `Pack', `NoPack')
|
|
d_RepStr(`d_RepStr(`d_RepStr(`d_TriFunc(AA, BB, CC)',
|
|
`AA', `RAMP')',
|
|
`BB', `')',
|
|
`CC', `Point', `Wireframe', `Solid')
|
|
d_RepStr(`d_RepStr(`d_RepStr(`d_TriFunc(AA, BB, CC)',
|
|
`AA', `RGB')',
|
|
`BB', `Pack', `NoPack')',
|
|
`CC', `Point', `Wireframe', `Solid')
|