📄 debug.h
字号:
/******************************************************************************
<module>
* Name : debug.h
* Title : PVR debug definitions and prototypes
* 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 : debug declarations
*
* Platform : Windows CE
*
</module>
********************************************************************************/
#if !defined(_DEBUG_H_)
#define _DEBUG_H_
/*******************************************************************************
Selectable debug output
********************************************************************************/
#ifdef DEBUG
/*******************************************************************************
Debug Mode
********************************************************************************/
#define DBGLPSTR LPSTR
#define DBGSETSTR(x,y) x = y
// Debug zone helper macros.
#define DPF_ERROR DEBUGZONE(0),__FILE__, __LINE__
#define DPF_WARN DEBUGZONE(1),__FILE__, __LINE__
#define DPF_MESSAGE DEBUGZONE(2),__FILE__, __LINE__
#define DPF_ENTRY DEBUGZONE(3),__FILE__, __LINE__
#define DPF_EXIT DEBUGZONE(4),__FILE__, __LINE__
#define DPF_CLEAR DEBUGZONE(5),__FILE__, __LINE__
#define DPF_TA DEBUGZONE(6),__FILE__, __LINE__
#define DPF_LIGHT DEBUGZONE(7),__FILE__, __LINE__
#define DPF_REG DEBUGZONE(8),__FILE__, __LINE__
#define DPF_STATE DEBUGZONE(9),__FILE__, __LINE__
#define DPF_VGP DEBUGZONE(10),__FILE__, __LINE__
#define DPF_BLIT DEBUGZONE(11),__FILE__, __LINE__
/*#define PVR_ZONE_CURSOR DEBUGZONE(12)
#define PVR_ZONE_ESCAPE DEBUGZONE(13)
#define PVR_ZONE_HALINIT DEBUGZONE(14)
#define PVR_ZONE_DRVTRACE DEBUGZONE(15)*/
/* Combined Macros */
#define DPF_BLIT_MESSAGE (DEBUGZONE(11) | DEBUGZONE(2)),__FILE__, __LINE__
#define INSTANTIATE_D3DM_ZONES \
DBGPARAM dpCurSettings = \
{ \
TEXT("PowerVR D3DMobile Driver"), \
{ \
TEXT("Errors"), /* 0 */ \
TEXT("Warnings"), /* 1 */ \
TEXT("Messages"), /* 2 */ \
TEXT("Enter"), /* 3 */ \
TEXT("Exit"), /* 4 */ \
TEXT("Clear"), /* 5 */ \
TEXT("TA"), /* 6 */ \
TEXT("Lights"), /* 7 */ \
TEXT("Registry"), /* 8 */ \
TEXT("State"), /* 9 */ \
TEXT("VGP"), /* 10 */ \
TEXT("Blit"), /* 11 */ \
TEXT("Undefined"), /* 12 */ \
TEXT("Undefined"), /* 13 */ \
TEXT("Undefined"), /* 14 */ \
TEXT("Undefined"), /* 15 */ \
}, \
0x3 /* Warnings and errors by default*/ \
};
extern DBGPARAM dpCurSettings;
IMG_VOID D3DMDebugPrintf(IMG_UINT32 uDebugLevel,
const IMG_CHAR* pszFilepath,
IMG_UINT32 uLine,
const IMG_CHAR* pszFormat,
...);
#define D3DM_DPF(X) D3DMDebugPrintf X
/*******************************************************************************
End Debug
********************************************************************************/
#else
#if defined(D3DM_RETAIL_DBGOUT)
/*******************************************************************************
Release with debug zones
********************************************************************************/
#define DBGLPSTR LPSTR
#define DBGSETSTR(x,y) x = y
// Debug zone helper macros.
#define DPF_ERROR DEBUGZONE(0),__FILE__, __LINE__
#define DPF_WARN DEBUGZONE(1),__FILE__, __LINE__
#define DPF_MESSAGE DEBUGZONE(2),__FILE__, __LINE__
#define DPF_ENTRY DEBUGZONE(3),__FILE__, __LINE__
#define DPF_EXIT DEBUGZONE(4),__FILE__, __LINE__
#define DPF_CLEAR DEBUGZONE(5),__FILE__, __LINE__
#define DPF_TA DEBUGZONE(6),__FILE__, __LINE__
#define DPF_LIGHT DEBUGZONE(7),__FILE__, __LINE__
#define DPF_REG DEBUGZONE(8),__FILE__, __LINE__
#define DPF_STATE DEBUGZONE(9),__FILE__, __LINE__
#define DPF_VGP DEBUGZONE(10),__FILE__, __LINE__
#define DPF_BLIT DEBUGZONE(11),__FILE__, __LINE__
/*#define PVR_ZONE_CURSOR DEBUGZONE(12)
#define PVR_ZONE_ESCAPE DEBUGZONE(13)
#define PVR_ZONE_HALINIT DEBUGZONE(14)
#define PVR_ZONE_DRVTRACE DEBUGZONE(15)*/
/* Combined Macros */
#define DPF_BLIT_MESSAGE (DEBUGZONE(11) | DEBUGZONE(2)),__FILE__, __LINE__
#define INSTANTIATE_D3DM_ZONES \
DBGPARAM dpCurSettings = \
{ \
TEXT("PowerVR D3DMobile Driver"), \
{ \
TEXT("Errors"), /* 0 */ \
TEXT("Warnings"), /* 1 */ \
TEXT("Messages"), /* 2 */ \
TEXT("Enter"), /* 3 */ \
TEXT("Exit"), /* 4 */ \
TEXT("Clear"), /* 5 */ \
TEXT("TA"), /* 6 */ \
TEXT("Lights"), /* 7 */ \
TEXT("Registry"), /* 8 */ \
TEXT("State"), /* 9 */ \
TEXT("VGP"), /* 10 */ \
TEXT("Blit"), /* 11 */ \
TEXT("Undefined"), /* 12 */ \
TEXT("Undefined"), /* 13 */ \
TEXT("Undefined"), /* 14 */ \
TEXT("Undefined"), /* 15 */ \
}, \
0 \
};
extern DBGPARAM dpCurSettings;
IMG_VOID D3DMDebugPrintf(IMG_UINT32 uDebugLevel,
const IMG_CHAR* pszFilepath,
IMG_UINT32 uLine,
const IMG_CHAR* pszFormat,
...);
#define D3DM_DPF(X) D3DMDebugPrintf X
/*******************************************************************************
End Release with debug zones
********************************************************************************/
#else
/*******************************************************************************
Release mode no debug
********************************************************************************/
#define INSTANTIATE_D3DM_ZONES
#define D3DM_DPF /##/
#define DBGLPSTR /##/
#define DBGSETSTR /##/
/*******************************************************************************
End release mode no debug
********************************************************************************/
#endif
#endif
/*******************************************************************************
Debuggging/Stream-decoding text-output routines/control
********************************************************************************/
#if defined(DEBUG)
/* Bitmap dumping function */
BOOL CreateBmp(LPCTSTR pwszFileName,
PVOID pvData,
ULONG ulX,
ULONG ulY,
ULONG ulStride,
ULONG ulBpp,
D3DMFORMAT eDstFmt,
RGBQUAD *prgbqPalette);
/*
Set to non-zero to enable decoding of control-stream data to PDUMP output
*/
#if defined(PDUMP)
#define DBG_TACSDECODE_PDUMPOUTPUT 1
#else
#define DBG_TACSDECODE_PDUMPOUTPUT 0
#endif /* #if defined(PDUMP) */
/*
Set to non-zero to enable decoding of control-stream data to DEBUG output
*/
#define DBG_TACSDECODE_DEBUGOUTPUT 1
PSTR DecodeFFComponents(DWORD dwFFComponents);
void DBGDecodePF(LPD3DM_CONTEXT psContext, PSTR pszFormat, ...);
void DBGDecodePF_PDUMP(LPD3DM_CONTEXT psContext, PSTR pszFormat, ...);
void DBGDecodePF_DEBUG(LPD3DM_CONTEXT psContext, PSTR pszFormat, ...);
PSTR DBGDecodeTACSBlockType(LPD3DM_CONTEXT psContext, DWORD dwHeader);
void DBGDecodePrimBlockHdr(LPD3DM_CONTEXT psContext, DWORD dwPrimHdr);
void DBGDecodeVGPClipWord(LPD3DM_CONTEXT psContext, DWORD dwVGPClip);
void DBGDecodeISPTSPWord(LPD3DM_CONTEXT psContext, DWORD dwISPTSPCtl);
void DBGDecodeTSPObjWord(LPD3DM_CONTEXT psContext, DWORD dwTSPObjCtl);
void DBGDecodeTSPLCtl(LPD3DM_CONTEXT psContext, DWORD dwLayer,
DWORD dwTSPLCtl1,
DWORD dwTSPLCtl2,
DWORD dwTSPLCtl3);
void DBGDecodeTACtl3DStateBlock(LPD3DM_CONTEXT psContext, PDWORD pdwTACtl3DStateBlock);
void DBGDecodeVGPControlBlock(LPD3DM_CONTEXT psContext, PDWORD pdwVGPControlBlock);
void DBGDecodeVGPCodeBlock(LPD3DM_CONTEXT psContext, PDWORD pdwVGPCodeBlock);
void DBGDecodeVGPConstantsBlock(LPD3DM_CONTEXT psContext, PDWORD pdwVGPConstantsBlock);
IMG_VOID DBGOutputVertexData(PVR_NATIVE_VERTEX* psVertex,
IMG_UINT32 ui32VertexCount,
IMG_UINT32 ui32PrimIndex);
#define DBG_OUTPUTVERTEXDATA(psVertex, ui32VertexCount, ui32PrimIndex) DBGOutputVertexData(psVertex, ui32VertexCount, ui32PrimIndex)
#define DBG_DECODETACTL3DSTATEBLOCK(psContext, pdwTACtl3DStateBlock) DBGDecodeTACtl3DStateBlock((psContext), (pdwTACtl3DStateBlock))
#define DBG_DECODEVGPCONTROLBLOCK(psContext, pdwVGPControlBlock) DBGDecodeVGPControlBlock((psContext), (pdwVGPControlBlock))
#define DBG_DECODEVGPCODEBLOCK(psContext, pdwVGPCodeBlock) DBGDecodeVGPCodeBlock((psContext), (pdwVGPCodeBlock))
#define DBG_DECODEVGPCONSTANTSBLOCK(psContext, pdwVGPConstantsBlock) DBGDecodeVGPConstantsBlock((psContext), (pdwVGPConstantsBlock))
#define DBG_DECODEFFCOMPONENTS(psContext, dwFFComponents) (DecodeFFComponents((psContext), (dwFFComponents)))
#define DBG_DECODEPF DBGDecodePF
#define DBG_PDUMPDECODEPF DBGDecodePF_PDUMP
#define DBG_DEBUGDECODEPF DBGDecodePF_DEBUG
#define DBG_DECODEBLOCKTYPE(psContext, dwHeader) DBGDecodeTACSBlockType((psContext), (dwHeader))
#define DBG_DECODEPRIMBLOCKHDR(psContext, dwPrimHdr) DBGDecodePrimBlockHdr((psContext), (dwPrimHdr))
#define DBG_DECODEVGPCLIPWORD(psContext, dwVGPClip) DBGDecodeVGPClipWord((psContext), (dwVGPClip))
#define DBG_DECODEISPTSPWORD(psContext, dwISPTSPCtl) DBGDecodeISPTSPWord((psContext), (dwISPTSPCtl))
#define DBG_DECODETSPOBJWORD(psContext, dwTSPObjCtl) DBGDecodeTSPObjWord((psContext), (dwTSPObjCtl))
#define DBG_DECODETSPLCTL(psContext, dwLayer, dwTSPLCtl1, dwTSPLCtl2, dwTSPLCtl3) \
DBGDecodeTSPLCtl((psContext), (dwLayer), (dwTSPLCtl1), (dwTSPLCtl2), (dwTSPLCtl3));
void DBGDump3DParams(LPD3DM_CONTEXT psContext,
PVRSRV_DEV_INFO *psDevInfo);
void DBGDecode3DParams(LPD3DM_CONTEXT psContext,
PVRSRV_DEV_INFO *psDevInfo);
#else /* #if defined(DEBUG) */
#define DBG_OUTPUTVERTEXDATA / ## /
#define DBG_DECODETACTL3DSTATEBLOCK(psContext, pdwTACtl3DStateBlock) / ## /
#define DBG_DECODEVGPCONTROLBLOCK(psContext, pdwVGPControlBlock) / ## /
#define DBG_DECODEVGPCODEBLOCK(psContext, pdwVGPCodeBlock) / ## /
#define DBG_DECODEVGPCONSTANTSBLOCK(psContext, pdwVGPConstantsBlock) / ## /
#define DBG_TACSDECODE_DEBUGOUTPUT 0
#define DBG_TACSDECODE_PDUMPOUTPUT 0
#pragma warning (disable:4001)
#define DBG_DECODEFFCOMPONENTS(dwFFComponents) ""
#define DBG_DECODEPF / ## /
#define DBG_PDUMPDECODEPF / ## /
#define DBG_DEBUGDECODEPF / ## /
#define DBG_DECODEBLOCKTYPE(psContext, dwHeader) ""
#define DBG_DECODEPRIMBLOCKHDR(psContext, dwPrimHdr) / ## /
#define DBG_DECODEVGPCLIPWORD(psContext, dwVGPClip) / ## /
#define DBG_DECODEISPTSPWORD(psContext, dwISPTSPCtl) / ## /
#define DBG_DECODETSPOBJWORD(psContext, dwTSPObjCtl) / ## /
#define DBG_DECODETSPLCTL(psContext, dwLayer, dwTSPLCtl1, dwTSPLCtl2, dwTSPLCtl3) / ## /
#pragma warning (default:4001)
#endif /* #if defined(DEBUG) */
#if defined(DEBUG)
/*********************************************************************************
Function : DBGDecodePF_PDUMP
Description : Writes out TA-control stream decoding text to the PDUMP stream
if enabled
Parameters : pszFormat - A usual printf style format string
... - printf style arguments
Return : void
*********************************************************************************/
__inline void DBGDecodePF_PDUMP(LPD3DM_CONTEXT psContext, PSTR pszFormat, ...)
{
#if DBG_TACSDECODE_PDUMPOUTPUT
PDumpFormatStringV(psContext->psPDContext, pszFormat, &pszFormat+1);
#endif /* #if DBG_TACSDECODE_PDUMPOUTPUT */
}
/*********************************************************************************
Function : DBGDecodePF_DEBUG
Description : Writes out TA-control stream decoding text to the DEBUG stream
if enabled
Parameters : pszFormat - A usual printf style format string
... - printf style arguments
Return : void
*********************************************************************************/
__inline void DBGDecodePF_DEBUG(LPD3DM_CONTEXT psContext, PSTR pszFormat, ...)
{
#if DBG_TACSDECODE_DEBUGOUTPUT
D3DM_DPF((DPF_TA, pszFormat, &pszFormat+1));
#endif /* #if DBG_TACSDECODE_DEBUGOUTPUT */
}
/*********************************************************************************
Function : DBGDecodePF
Description : Writes out TA-control stream decoding text to the DEBUG and/or
PDUMP streams if enabled
Parameters : pszFormat - A usual printf style format string
... - printf style argument list
Return : void
*********************************************************************************/
__inline void DBGDecodePF(LPD3DM_CONTEXT psContext, PSTR pszFormat, ...)
{
#if DBG_TACSDECODE_DEBUGOUTPUT
D3DM_DPF((DPF_TA, pszFormat, *(&pszFormat+1)));
#endif /* #if DBG_TACSDECODE_DEBUGOUTPUT */
#if DBG_TACSDECODE_PDUMPOUTPUT
PDumpFormatStringV(psContext->psPDContext, pszFormat, &pszFormat+1);
#endif /* #if DBG_TACSDECODE_PDUMPOUTPUT */
}
#endif /* #if defined(DEBUG) */
#endif /* #if !defined(_DEBUG_H_) */
/*****************************************************************************
End of file (Debug.H)
*****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -