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

📄 context.h

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 H
字号:
/******************************************************************************
<module>
* Name         : Context.h
* Title        : D3DM Context definition
* 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 D3DM Context structure and related structures 
*				 and flags 
*
* Platform     : Windows CE
*
</module>
********************************************************************************/
#if !defined(_CONTEXT_H_)
#define _CONTEXT_H_

#if defined(D3DM_REMOTE_HOOK)
#define PVR_KERNEL
#endif /* D3DM_REMOTE_HOOK */

/*****************************************************************************
 Forward declarations.
*****************************************************************************/
typedef struct _D3DM_CONTEXT_		*LPD3DM_CONTEXT;
typedef struct _D3DM_SURFACE_		*LPD3DM_SURFACE;
typedef struct _D3DM_VBUFFER_		*LPD3DM_VBUFFER;

/*******************************************************************************
	Includes
********************************************************************************/
#include "mbx13ddef.h"
#include "mbx12ddef.h"
#include "mbx1defs.h"
#include "autover.h"
#include "d3dmheaders.h"
#include "services_headers.h"
#include "caps.h"
#include "convert.h"
#include "ntvmath.h"
#include "prim.h"
#include "profile.h"
#include "scene.h"
#include "hwstate.h"
#include "registers.h"
#include "dp_ops.h"
#include "texture.h"
#include "vgp.h"
#include "surface.h"
#include "lights.h"
#include "tnl.h"
#include "tsstate.h"
#include "rstate.h"
#include "utils.h"
#include "srvcalls.h"
#include "registry.h"
#include "blit.h"
#include "twiddle.h"
#include "vertex.h"
#include "drvescape.h"
#include "tstring.h"

/*******************************************************************************
	Defines
********************************************************************************/
#define D3DM_COMMANDQUEUE_SIZE	1024
#define HW_MAX_POINT_SIZE		64.0f
#define MAX_FLIP_SURFACES		4
#define D3DM_DEFAULT_PB_PAGES	512
#define MAX_LIGHTS				8

/*******************************************************************************
	Flags for context...
********************************************************************************/

#define D3DM_CONTEXT_SWFLAGS_LAYER0ENABLED			0x00000001
#define D3DM_CONTEXT_SWFLAGS_LAYER1ENABLED			0x00000002
#define D3DM_CONTEXT_SWFLAGS_ENABLEDMASK			0x00000003

#define D3DM_CONTEXT_SWFLAGS_CKREGISTER1USED		0x00000004
#define D3DM_CONTEXT_SWFLAGS_CKREGISTER2USED		0x00000008
#define D3DM_CONTEXT_SWFLAGS_RENDEREDONLOCK			0x00000010
#define D3DM_CONTEXT_SWFLAGS_ALPHABLENDENABLED		0x00000020
#define D3DM_CONTEXT_SWFLAGS_ALPHATESTENABLED		0x00000040
#define D3DM_CONTEXT_SWFLAGS_SUPERSAMPLEX			0x00000080
#define D3DM_CONTEXT_SWFLAGS_SUPERSAMPLEY			0x00000100
#define	D3DM_CONTEXT_SWFLAGS_USESTEXTUREALPHA		0x00000200
#define D3DM_CONTEXT_SWFLAGS_LOD_BIAS_IN_SCENE		0x00000400
#define D3DM_CONTEXT_SWFLAGS_CONTEXT_LOADED			0x00000800
#define D3DM_CONTEXT_SWFLAGS_ENABLE_FASTAA			0x00001000
#define D3DM_CONTEXT_SWFLAGS_PROCVERT_MODE			0x10000000
#define D3DM_CONTEXT_SWFLAGS_NEW_CONTEXT			0x20000000

#define D3DM_CONTEXT_SWFLAGS_PROCVERT_NO_DIFFUSE_COPY	0x00002000
#define D3DM_CONTEXT_SWFLAGS_PROCVERT_NO_SPECULAR_COPY	0x00004000
#define D3DM_CONTEXT_SWFLAGS_PROCVERT_NO_TEX_COPY_MASK	0x0003C000
#define D3DM_CONTEXT_SWFLAGS_PROCVERT_NO_TEX_COPY_SHIFT	14

/* Data copy function type enumeration */
#if defined (SUPPORT_VGP) || defined (SUPPORT_VGP_LITE)
typedef enum COPY_FUNC_TAG 
{
    COPY_FUNC_BLOCK_COPY			= 0,
    COPY_FUNC_COPY_VERTICES,
    COPY_FUNC_COPY_COMPONENTS,

    COPY_FUNC_FORCE_DWORD     = 0x7fffffff,
} COPY_FUNC;
#endif


/*******************************************************************************
	D3DMobile rendering context
********************************************************************************/
typedef struct _D3DM_CONTEXT_
{
	/**************************************************************
	********************** Function Pointers **********************
	**************************************************************/

	/* Array of Function entry points for DP commands */
	D3DM_DPFUNC			*ppfnsDPOpHandlers;

	/* Array of Function entry points for RS operations */
	D3DM_RSTATE_FUNC	*ppfnsRStateFunctions;

	/* Array of Function entry points for TSS operations */
	D3DM_TSSTATEFUNC	*ppfnsTSStateFunctions;

	/**************************************************************
	************************* State Info **************************
	**************************************************************/

	/* 3D-core hardware register address/value pairs */
	PVRSRV_HWREG		ps3DRegs[D3DM_SW3DREG_COUNT];

	/* TA hardware register address/value pairs */
	PVRSRV_HWREG		psTARegs[D3DM_SWTAREG_COUNT];

	/* HW TA Primitive-block header word control */
	DWORD				dwTAPrimCtl;

	/* Primitive setup-fn fill-mode selector */
	PRIM_FILLMODE		ePrimFillMode;
	
	/* Prim type for current draw prim */
	D3DMPRIMITIVETYPE	eCurrentPrimType;

	/*
		State and control-data used to maintain current state 
		choices and to generate appropriate HW-state
	*/
	TRANSIENT_STATE		sTState;

	/* HW-state maintenance data */
	HWSTATECTL			sHWStateCtl;

	/* Current HW-state that the HW has been setup with	*/
	HWSTATE				sCurrHWState;

	/* HW State/control-data to be sent to the HW for the next primitive */
	HWSTATE				sHWState;

	/* Last renderstate change type */
	D3DMRENDERSTATETYPE	eLastRenderStateChange;

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

	/**************************************************************
	************************* VGP Members *************************
	**************************************************************/

	/* Last FVF Code VGP was set up for */
	DWORD					dwVGPLastFVF;

	/* Native Data format */
	DWORD					dwNativeFPFormat;

	/* HW VGP clip control word	*/
	DWORD					dwVGPClipCtl;

	/* Current Vertex copier */
	COPY_FUNC				eCopyFn;

	/* Array of code section stucture pointers defining Fixed Function VGP TnL code */
	PVSSECTION				*ppsFFTNLSections;

	/* Number of code sections in array */
	DWORD					dwSectionCount;

	/* Enabled sections */
	DWORD					dwFirstSection;


#endif

	/**************************************************************
	************************* Services Info ***********************
	***************************************************************/

	/* Services Handle for locally hooked driver */
	IMG_HANDLE			hServices;

	/* Render target queue structure */
	PVRSRV_QUEUE_INFO	*psContextQueue;

	/* Dev data for the 3D device */
	PVRSRV_DEV_DATA		sDevData;
		
	/* Dev data for the display device */
	PVRSRV_DEV_DATA		sDisplayDevData;

	/* Primary surface data pointer */
	PVRSRV_PRIMARY_SURF	*psPrimSurfData;

	/* Hardware Info */
	PVRSRV_HW_INFO		sHWInfo;

	/* Currently reserved fifo space */
	DWORD				dwAllocatedFifoSpaceDWORDS;

	/**************************************************************
	************** Temporary texture creation pointer *************
	***************************************************************
	*   Used to allow mip maps to be set up correctly in between  *
	*			per mip level calls to CreateSurface			  *
	***************************************************************/

	LPD3DM_SURFACE		psCurrentTexFirstLevel;

	/**************************************************************
	*	Currently selected Vertex and Index buffers
	**************************************************************/

	/* Currently selected Vertex Buffer */
	LPD3DM_VBUFFER		psVertexSource;

	/* Currently selected Index Buffer */
	LPD3DM_IBUFFER		psIndexSource;

	/* Current Mask for de-indexing */
	IMG_UINT32			ui32IndexMask;

	/**************************************************************
	*	Current Surface Chain
	**************************************************************/

	struct
	{
		/* Primary Surface */
		LPD3DM_SURFACE		psPrimary;

		/* Back Buffers */
		LPD3DM_SURFACE		psBackBuffers[MAX_FLIP_SURFACES -1];

		/* Number of Backbuffers */
		DWORD				dwTotalBackBuffers;

		/* Number of Supplied Backbuffers */
		DWORD				dwSuppliedBackBuffers;

		/* link list swap chain */
		LPD3DM_SURFACE		psCurrentBuffer;

	}sChain;

	/**************************************************************
	**************************************************************/

	/* Context flags */
	DWORD				dwFlags;

	/* Registry data */
	PVR_REG_DATA		sRegData;

	/* Currently displayed surface */
	LPD3DM_SURFACE		psCurrentDisplay;

	/* Currently bound render target surface */
	LPD3DM_SURFACE		psCurrentRenderTarget;

	/* Currently bound depth buffer surface */
	LPD3DM_SURFACE		psCurrentDepthBuffer;

	/* Non Chain Render targets */
	LPD3DM_SURFACE		psNonChainRenderTargets;

	/* Render-number */
	DWORD				dwFrame;

	/* Error code for last error that occured */
	HRESULT				hrLastError;

	/* List of currently existing lights */
	PLIGHTDATA			psLightList;

	/* Count of currently existing lights */
	DWORD				dwLightCount;

	/* background object data for context's current render target */
	PVRSRV_BGOBJ_INFO	sBGObjInfo;

	/* windowed */
    BOOL				bWindowed;

    /* Window handle for windowed mode */
    HWND				hWnd;

	/* swap effect for this context */
    D3DMSWAPEFFECT		SwapEffect;
    
    /* Current system rotation angle */
    DWORD				dwRotationAngle;

    /* vsync interval for this context */
    DWORD				nVSyncInterval;

	/* PDUMP Context */
#ifdef PDUMP
	PDUMP_CONTEXT		*psPDContext;
#endif

#if defined (FIX_HW_PRN_725_MBXLITE)

#define HW_PRN_725_FLAGS_INDEXED			0x00000001
#define HW_PRN_725_FLAGS_STOREVERTS			0x00000002
#define HW_PRN_725_FLAGS_RESEND_LAST_TWO	0x00000004
#define HW_PRN_725_FLAGS_FAN_MODE			0x00000008

	/* Number of vertices sent since last End/Last Prim */
	DWORD		dwNumVerticesSent;

	/* Flags to identify current vertex processing status */
	DWORD		dwHWPRN725Flags;

#if defined (SUPPORT_VGP_LITE)

	/* Temp vertex store */
	IMG_UINT8	*pbyVertices[2];

#else

	/* Temp vertex store */
	PVR_NATIVE_VERTEX	sVertices[2];

#endif

#endif

} D3DM_CONTEXT, *LPD3DM_CONTEXT;


/* headers that are dependent on D3DM_CONTEXT definition */
#include "debug.h"
#include "tautils.h"
#include "hook.h"
#include "vgpcopy.h"


#endif /* #if !defined(_CONTEXT_H_) */
/*****************************************************************************
 End of file (_CONTEXT.H_)
*****************************************************************************/

⌨️ 快捷键说明

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