📄 tautils.h
字号:
/******************************************************************************
<module>
* Name : tautils.h
* Title : TA utilitites
* Author(s) : Imagination Technologies
* Created : 2 March 2004
*
* Copyright : 2004 by Imagination Technologies Limited.
* All rights reserved. No part of this software, either
* material or conceptual may be copied or distributed,
* transmitted, transcribed, stored in a retrieval system
* or translated into any human or computer language in any
* form by any means, electronic, mechanical, manual or
* other-wise, or disclosed to third parties without the
* express written permission of Imagination Technologies
* Limited, Unit 8, HomePark Industrial Estate,
* King's Langley, Hertfordshire, WD4 8LZ, U.K.
*
* Description : Ta utilities and declarations
* Platform : Windows CE
*
</module>
$Log: tautils.h $
*********************************************************************************/
#if !defined(_TAUTILS_H_)
#define _TAUTILS_H_
/*********************************************************************************
Function Prototypes.
*********************************************************************************/
/*
Forms an appropriate TA region-clip control word to clip-to a given pixel-area
*/
DWORD CalcTARegionClip(LPD3DM_CONTEXT psContext, LPD3DMRECT psRect);
/*
Updates the HW TA-control and 3D-state from the context HW-state
*/
void UpdateTACtlAnd3DState(LPD3DM_CONTEXT psContext);
/*********************************************************************************
VGP Specific
*********************************************************************************/
#if defined (SUPPORT_VGP) || defined (SUPPORT_VGP_LITE)
/*
Updates the HW VGP-control state from the context HW-state
*/
void UpdateVGPControlState(LPD3DM_CONTEXT psContext);
/*
Updates the HW VGP-constants from the context HW-state
*/
void UpdateVGPConstants(LPD3DM_CONTEXT psContext);
/*
Updates the HW VGP-instructions from the context HW-state
*/
void UpdateVGPInstructions(LPD3DM_CONTEXT psContext);
/*
Writes a VGP-control block to the TA control stream, updating the
context current HW-state and state-control data accordingly
*/
void TACSWriteVGPControlState(LPD3DM_CONTEXT psContext,
DWORD dwStateChanged,
PHWVGPCONTROL psNewVGPControl,
BOOL bForceWrite);
/*
Writes a VGP-constant block to the TA control stream, updating the context
current HW-state and state-control data accordingly
*/
void TACSWriteVGPConstants(LPD3DM_CONTEXT psContext,
PVGPCONSTFLAGS pdwConstsChanged,
PHWVGPCONSTANTS psNewConsts,
BOOL bForceWrite);
/*
Writes a VGP-code block to the TA control stream, updating the context
current HW-state and state-control data accordingly
*/
void TACSWriteVGPInstructions(LPD3DM_CONTEXT psContext,
PVGPINSTFLAGS psInstsChanged,
PHWVGPCODE psNewInsts,
BOOL bForceWrite);
#endif /* SUPPORT_VGP */
/*********************************************************************************
End of VGP Specific
*********************************************************************************/
/*
Writes a TA-control and 3D-state block to the TA control stream, updating
the context current HW-state and state-control data accordingly.
*/
void TACSWriteTACtlAnd3DState(LPD3DM_CONTEXT psContext,
DWORD dwStateChanged,
PHWTACTL3DSTATE psNewTACtl3DState,
BOOL bForceWrite);
/*
Low-level routine to output a given block of data to the TA control-stream
slave port
*/
void TACSWriteData(LPD3DM_CONTEXT psContext, PVOID pvData, DWORD dwDataSize);
/*
Low-level routine to write a DWORD to the slave-port terminate address
*/
void TACSWriteTermDWORD(LPD3DM_CONTEXT psContext, DWORD dwValue);
/*********************************************************************************
Inline functions
*********************************************************************************/
/*********************************************************************************
Function : TACSWriteDWORD
Description : Write a single DWORD to the TA control-stream
Parameters : psContext - Current 3D rendering context
dwValue - The value to write
Return : void
*********************************************************************************/
void __inline TACSWriteDWORD(LPD3DM_CONTEXT psContext, DWORD dwValue)
{
D3DM_DPF((DPF_TA, "TACSWriteDWORD: Writing 0x%8.8lX)", dwValue));
TACSWriteData(psContext, &dwValue, sizeof(DWORD));
}
/*********************************************************************************
Function : TACSWritePrimHdr
Description : Writes a primitive block-header word to the TA control-stream.
NB: Should be called to begin a new primitive block, before any
vertex-data is sent.
Parameters : psContext - Current 3D rendering context
dwPrimHeader - The primtiive-header word to write
dwPrimType - The required primitive-type (put into the header)
(one of MBX1_TAOBJTYPE_VERTEXFACESTRIP,
MBX1_TAOBJTYPE_VERTEXFACEFAN,
MBX1_TAOBJTYPE_VERTEXLINESTRIP,
MBX1_TAOBJTYPE_VERTEXFACELIST,
MBX1_TAOBJTYPE_POINTS)
Return : void
*********************************************************************************/
__inline void TACSWritePrimHdr(LPD3DM_CONTEXT psContext,
DWORD dwPrimHeader,
DWORD dwPrimType)
{
/* Insert the block-type in to the header word */
dwPrimHeader &= MBX1_TAOBJTYPE_TYPECLRMASK;
dwPrimHeader |= dwPrimType;
/* Write the header word to the control stream */
D3DM_DPF((DPF_TA, "TACSWritePrimHdr: Starting %hs primitive block (0x%8.0lX)", DBG_DECODEBLOCKTYPE(psContext, dwPrimType), dwPrimHeader));
DBG_DECODEPRIMBLOCKHDR(psContext, dwPrimHeader);
TACSWriteDWORD(psContext, dwPrimHeader);
}
#if defined (SUPPORT_VGP) || defined (SUPPORT_VGP_LITE)
/*********************************************************************************
Function : TACSWriteVGPClipWord
Description : Writes a VGP-clip control-word to the TA control-stream.
NB: Should be called to output a VGP-clip word after a primitive-
block header (or line-width/point-size word in the case of
line-strip, point-lists primitives), but before any vertex-data
Parameters : psContext - Current 3D rendering context
dwVGPClipCtl - The primtiive-header word to write
Return : void
*********************************************************************************/
__inline void TACSWriteVGPClipWord(LPD3DM_CONTEXT psContext, DWORD dwVGPClipCtl)
{
/*
Write the VGP clip control word
*/
DBG_DECODEVGPCLIPWORD(psContext, dwVGPClipCtl);
TACSWriteDWORD(psContext, dwVGPClipCtl);
}
#endif /* #if !defined(SUPPORT_VGP) */
/*********************************************************************************
Function : TACSWriteLinePointSize
Description : Writes a line-width/point-size specifier into the TA control stream
NB: Should be called to output the required line-width or point-
size after the primitive-block header for line-strip or point-
list primitives, but before the VGP-clip control word (if
required) or vertex-data.
Parameters : psContext - Current 3D rendering context
dwSize - HALF the required line-width/point-size in pixels
(a float-value stored in a DWORD)
Return : void
*********************************************************************************/
__inline void TACSWriteLinePointSize(LPD3DM_CONTEXT psContext, DWORD dwSize)
{
/* Write the given line-width/point-size value */
DBG_DECODEPF(psContext, "---- Line-width/point-size %d", dwSize);
TACSWriteDWORD(psContext, dwSize);
}
/*********************************************************************************
Function : TACSWriteEndPrim
Description : Indicate the end of a primitive within a primitive-block in the
TA control-stream
NB: Should be used after the last vertex has been sent for each
primitive (except the last) in a primitive block.
Parameters : psContext - Current 3D rendering context
Return : void
*********************************************************************************/
void __inline TACSWriteEndPrim(LPD3DM_CONTEXT psContext)
{
D3DM_DPF((DPF_TA, "TACSWriteEndPrim: Marking end of primitive"));
DBG_PDUMPDECODEPF(psContext, "---- End of primitive");
/* Write an end of a primitive marker to the slave-port terminate address */
TACSWriteTermDWORD(psContext, MBX1_TA_SP_TERM_PRIM);
#if defined (FIX_HW_PRN_725_MBXLITE)
psContext->dwNumVerticesSent = 0;
psContext->dwHWPRN725Flags &= ~HW_PRN_725_FLAGS_RESEND_LAST_TWO;
#endif
}
/*********************************************************************************
Function : TACSWriteLastPrim
Description : Indicate the end of a primitive-block within a the TA control-
stream
NB: Should be used after the last vertex for the last primitive
in a primitive block has been sent, instead of an 'end-
primitive' merker.
Parameters : psContext - Current 3D rendering context
Return : void
*********************************************************************************/
void __inline TACSWriteLastPrim(LPD3DM_CONTEXT psContext)
{
D3DM_DPF((DPF_TA, "TACSWriteLastPrim: Marking end of primitive-block"));
DBG_PDUMPDECODEPF(psContext, "---- End of primitive-block");
/*
Write an end of a primitive-block marker to the slave-port terminate
address
*/
TACSWriteTermDWORD(psContext, MBX1_TA_SP_TERM_BLOCK);
#if defined (FIX_HW_PRN_725_MBXLITE)
psContext->dwNumVerticesSent = 0;
psContext->dwHWPRN725Flags &= ~HW_PRN_725_FLAGS_RESEND_LAST_TWO;
#endif
}
/*********************************************************************************
Function : TACSWriteEndStream
Description : Indicate the end of the TA control-stream
NB: Should be used prior to starting a render to tell the TA to
finish-up
Parameters : psContext - Current 3D rendering context
Return : void
*********************************************************************************/
void __inline TACSWriteEndStream(LPD3DM_CONTEXT psContext)
{
D3DM_DPF((DPF_TA, "TACSWriteEndStream: Marking end of stream"));
PDUMPSTRING(psContext->psPDContext, "---- Terminating TA control-stream");
PDUMPSTRING(psContext->psPDContext, "");
/*
Write an end of a stream marker to the control-stream
*/
TACSWriteDWORD(psContext, MBX1_TAOBJTYPE_STREAMEND);
}
#endif /* #if !defined(_TAUTILS_H_) */
/*****************************************************************************
End of file (tautils.h)
*****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -