⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hwstate.h

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************
<module>
* Name         : HWState.h
* Title        : PVR 3D hardware state info
* 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  : Definition of PVR 3D hardware structures and related info 
*
* Platform     : Windows CE
*
</module>
********************************************************************************/
#if !defined(_HWSTATE_H_)
#define _HWSTATE_H_

#define MBX1_MAX_TARGET_BUFFERS					2

/*
	HW TSP Layer state data
*/
typedef struct _MBX1_TSPLAYER_STATE_
{
	DWORD	dwLCtl1;
	DWORD	dwLCtl2;
	DWORD	dwLCtl3;
} MBX1_TSPLAYER_STATE, *PMBX1_TSPLAYER_STATE;

/*
 * Viewport transform
 */
typedef struct _PVR_VP_TRANSFORM_
{
	NTV_TYPE	XOffset;
	NTV_TYPE	XScale;

	NTV_TYPE	YOffset;
	NTV_TYPE	YScale;

	NTV_TYPE	ZOffset;
	NTV_TYPE	ZScale;
} PVR_VP_TRANSFORM;

/*
	HW TA-control/3D-state data
*/
typedef struct _HWTACTL3DSTATE_
{
	/*
		ISP/TSP control word (see MBX1_ISPTSPCTL_xxx)
	*/
	DWORD				dwISPTSPCtl;

	/*
		Per-object TSP control word (see MBX1_TSPOBJ_xxx)
	*/
	DWORD				dwTSPObjCtl;

	/*
		TSP layer-state (see MBX1_TSPPLn_xxx)
	*/
	MBX1_TSPLAYER_STATE	sTSPLState[MBX1_MAXTEXTURE_LAYERS];

	/*
		TA region-clip control word (see MBX1_TASTATERGNCLIP_xxx)
	*/
	DWORD				dwRegionClip;

#if defined (SUPPORT_VGP) || defined (SUPPORT_VGP_LITE)
	/*
		VGP input format definition	(see MBX1_VGPIFDEF_xxx)
	*/
	DWORD				dwVGPIFDef;

#else

	/*
		We need this or State ctrl won't work
	*/
	DWORD				dwDummy;

#endif

	/*
		Fixed-point input format control word
	*/
	DWORD				dwFPFormat;

	/*
		viewport transform
	*/
	PVR_VP_TRANSFORM	sVPTrans;

#if defined (SUPPORT_VGP) || defined (SUPPORT_VGP_LITE)
	/*
		VGP W-clamp value
	*/
	DWORD				dwVGPWClamp;
#endif
} HWTACTL3DSTATE, *PHWTACTL3DSTATE;

/******************************************************************************
* VGP Specific HWState
*******************************************************************************/

#if defined (SUPPORT_VGP) || defined (SUPPORT_VGP_LITE)
/*
	HW VGP-control state
*/							
typedef struct _HWVGPCONTROL_
{
	/*
		Code-section definitions (see MBX1_VGPSECTDEF_xxx)
	*/
	DWORD	pdwSectionDef[MBX1_VGPCODE_SECTION_COUNT];
} HWVGPCONTROL, *PHWVGPCONTROL;

/*
	HW VGP-constant data
*/
typedef struct _HWVGPCONST_
{
	union _HWVGPCONST_ELEMENT_
	{
		float	fVal;
		DWORD	dwVal;
	} e[4];
} HWVGPCONST, *PHWVGPCONST;

typedef struct _HWVGPCONSTANTS_
{
	HWVGPCONST	psConsts[MBX1_VGPCONSTANTS_CONST_COUNT];
} HWVGPCONSTANTS, *PHWVGPCONSTANTS;

/*
	VGP instructions (see MBX1_VGPINSTLO_xxx and MBX1_VGPINSTHI_xxx)
*/
#pragma warning (disable:4214)	/* Disable 'non-standard bitfield types' warning */

typedef union _HWVGPINST_
{
	struct
	{
		unsigned char	opcode		: 5;
		unsigned char	sign1		: 1;
		unsigned char	sign2		: 1;
		unsigned char	sign3		: 1;
		unsigned char	swiz1;
		unsigned char	swiz2;
		unsigned char	swiz3;
		unsigned char	sadd1		: 4;
		unsigned char	sadd2		: 4;
		unsigned char	sadd3		: 4;
		unsigned char	cext		: 3;
		unsigned char	caddrel		: 1;
		unsigned short	ssel1		: 2;
		unsigned short	ssel2		: 2;
		unsigned short	ssel3		: 2;
		unsigned short	dmask		: 4;
		unsigned short	daddr		: 5;
		unsigned short	reserved	: 1;
	} field;

	struct
	{
		DWORD	dwLo;
		DWORD	dwHi;
	} word;
} HWVGPINST, *PHWVGPINST;

typedef struct _HWVGPINSTRUCTIONS_
{
	HWVGPINST	psInsts[MBX1_VGPCODE_INST_COUNT];
} HWVGPCODE, *PHWVGPCODE;

/*
	Flags for tracking VGP-constants changed/setup

	NB:	Must be the same as the generic flags-array structure above (but
		with a larger array), so that the generic flag-array handling
		routines can be used (see FLAGARRAY)
*/
typedef struct _VGPCONSTFLAGS_
{
	DWORD	dwSize;
	DWORD	dwUsed;
	DWORD	pdwFlags[MBX1_VGPCONSTANTS_CONST_COUNT/(sizeof(DWORD)*8)];
} VGPCONSTFLAGS, *PVGPCONSTFLAGS;

/*
	Flags for tracking VGP-instructions changed/setup

	NB:	Must be the same as the generic flags-array structure above (but
		with a larger array), so that the generic flag-array handling
		routines can be used (see FLAGARRAY).
*/
typedef struct _VGPINSTFLAGS_
{
	DWORD	dwSize;
	DWORD	dwUsed;
	DWORD	pdwFlags[MBX1_VGPCODE_INST_COUNT/(sizeof(DWORD)*8)];
} VGPINSTFLAGS, *PVGPINSTFLAGS;

#endif /* SUPPORT_VGP */

/******************************************************************************
* End of VGP Specific HWState
*******************************************************************************/

/*
	HW-specific control words and state
		
	NB:	Used to represent the current HW-state, and as repository for new
		state/data that must be set
*/
typedef struct _HWSTATE_
{
	/*
		TA-ctl/3D-state 
	*/
	HWTACTL3DSTATE	sTACtl3DState;

#if defined (SUPPORT_VGP) || defined (SUPPORT_VGP_LITE)

	/*
		VGP-control state
	*/
	HWVGPCONTROL	sVGPControl;
	
	/*
		VGP-constants
	*/
	HWVGPCONSTANTS	sVGPConsts;

	/*
		VGP-code
	*/
	HWVGPCODE		sVGPCode;

#endif /* SUPPORT_VGP */
} HWSTATE, *PHWSTATE;

/*
	Flags-array type (used by generic flag-array handling routines)
*/
typedef struct _FLAGARRAY_
{
	/*
		Size of flag-array (in flags/bits)
	*/
	DWORD	dwSize;

	/*
		Which words have been used at all (i.e. have at-least one flag set)
		1 bit for each word - LSB = word 0.
	*/
	DWORD	dwUsed;

	/*
		Array of flags-words (1 for every 32-flags required)
	*/
	DWORD	pdwFlags[1];
} FLAGARRAY, *PFLAGARRAY;



/*
	HW-state management/change tracking data

	NB:	These are used to track which HW-state has been modified by the
		driver (and thus should be resent to the HW), and also which state
		has previously been sent.

		This data is used in conjuction with the 'new' and 'current' HW-state
		data in the context to keep the state used by the HW up-to-date and
		correct for each primitive.
*/
typedef struct _HWSTATECTL_
{
	/*
		TA-control/3D-state that has been modified (see MBX1_TASTATEPRES_xxx
		flags)
	*/
	DWORD			dwTACtl3DStateChanged;

	/*
		TA-control/3D-state that has been setup already (i.e. submitted to
		the HW) (see MBX1_TASTATEPRES_xxx flags)
	*/
	DWORD			dwTACtl3DStateSetup;

#if defined (SUPPORT_VGP) || defined (SUPPORT_VGP_LITE)
	/*
		VGP-control state (section-definitions) that have been modified
		(see MBX1_VGPCONTROL_SECTIONxDEF_ENABLE flags)
	*/
	DWORD			dwVGPCtlStateChanged;

	/*
		VGP-control state (section-definitions) that have been setup already 
		(i.e. submitted to the HW) (see MBX1_VGPCONTROL_SECTIONxDEF_ENABLE
		flags)
	*/
	DWORD			dwVGPCtlStateSetup;

	/*
		VGP-constants that have been modified
	*/
	VGPCONSTFLAGS	sVGPConstsChanged;

	/*
		VGP-constants that have been setup already (i.e. submitted to the HW)
	*/
	VGPCONSTFLAGS	sVGPConstsSetup;

	/*
		VGP-instructions that have been modified
	*/
	VGPINSTFLAGS	sVGPInstsChanged;

	/*
		VGP-instructions that have been setup already (i.e. submitted to
		the HW)
	*/
	VGPINSTFLAGS	sVGPInstsSetup;

#endif /* SUPPORT_VGP */

} HWSTATECTL, *PHWSTATECTL;

/*****************************************************************************
 Inline routines
*****************************************************************************/

#if 0
/*****************************************************************************
 FUNCTION	: FlagArraySetFlag
    
 PURPOSE	: Set a single flag in a flag-word array

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -