📄 context.h
字号:
/**************************************************************************
* Name : context.h
* Author : BCB
* Created : 01/05/2003
*
* Copyright : 2003 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.
*
* Platform : ANSI
*
* $Date: 2004/10/20 16:36:54 $ $Revision: 1.39.1.14 $
* $Log: context.h $
**************************************************************************/
#ifndef _CONTEXT_
#define _CONTEXT_
#include "drvgl.h"
#include "ogles_types.h"
#include "mbx13ddef.h"
#include "servicesglue.h"
#include "modid.h"
#include "constants.h"
#include "debug.h"
#include "metrics.h"
#include "profile.h"
#include "texture.h"
#include "vgp.h"
#include "vprogram.h"
#include "tnlstate.h"
#include "state.h"
#include "lighting.h"
#include "memmgr.h"
#include "osglue.h"
#include "wsglue.h"
#include "eglglue.h"
#include "sysinfo.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#if defined(OLDPDUMP)
#include "pdump.h"
#endif
/* Macros used to set the SW TA and 3D registers */
#define GLES_SET_TAREG(TARegs, Reg, Val) \
TARegs[GLES_SWTAREG_##Reg].ui32RegAddr = MBX1_TAGLOBREG_##Reg; \
TARegs[GLES_SWTAREG_##Reg].ui32RegVal = Val;
#define GLES_SET_3DREG(SW3DRegs, Reg, Val) \
SW3DRegs[GLES_SW3DREG_##Reg].ui32RegAddr = MBX1_GLOBREG_##Reg; \
SW3DRegs[GLES_SW3DREG_##Reg].ui32RegVal = Val;
/* SW TA registers */
#define GLES_TAREG 0x80000000
#define GLES_TAREG_MASK 0x7FFFFFFF
#define GLES_SWTAREG_TAILPTRBASE 0
#define GLES_SWTAREG_REGION_BASE 1
#define GLES_SWTAREG_GLOBAL_LIST_CTRL 2
#define GLES_SWTAREG_XCLIP 3
#define GLES_SWTAREG_YCLIP 4
#define GLES_SWTAREG_RHWCLAMP 5
#define GLES_SWTAREG_RHWCOMP 6
#define GLES_SWTAREG_CONFIG 7
#define GLES_SWTAREG_START 8
#define GLES_COUNT_SWTAREG (GLES_SWTAREG_START + 1)
/* SW 3D registers */
#define GLES_3DREG 0x40000000
#define GLES_3DREG_MASK 0xBFFFFFFF
#define GLES_SW3DREG_RGNBASE 0
#define GLES_SW3DREG_ZLOADSTORE 1
#define GLES_SW3DREG_FPUPERPVAL 2
#define GLES_SW3DREG_FPUCULLVAL 3
#define GLES_SW3DREG_3DPIXSAMP 4
#define GLES_SW3DREG_FOGCOLVERT 5
#define GLES_SW3DREG_SCALERCTL 6
#define GLES_SW3DREG_BLENDCTL 7
#define GLES_SW3DREG_ARGBSUM 8
#define GLES_SW3DREG_FBCTL 9
#define GLES_SW3DREG_FBXCLIP 10
#define GLES_SW3DREG_FBYCLIP 11
#define GLES_SW3DREG_FBSTART 12
#define GLES_SW3DREG_FBLINESTRIDE 13
#define GLES_SW3DREG_ZBASEADDR 14
#define GLES_SW3DREG_3DFLATSHADEDCS 15
#define GLES_SW3DREG_3D_ZL_BACKGROUND_DEPTH 16
#define GLES_SW3DREG_3DSCREENSIZE 17
#define GLES_SW3DREG_OBJBASE 18
#define GLES_SW3DREG_STARTRENDER 19
#define GLES_COUNT_SW3DREG (GLES_SW3DREG_STARTRENDER + 1)
typedef struct GLES_SWREGS_TAG{
PVRSRV_HWREG psTARegs[GLES_COUNT_SWTAREG];
PVRSRV_HWREG ps3DRegs[GLES_COUNT_SW3DREG];
} GLES_SWREGS;
/*
* State that affects rasterisation,
* can be handled by HW
* and can be properly controlled per-object
*/
#define GLES_RS_ALPHABLEND_ENABLE 0x00000001
#define GLES_RS_ALPHATEST_ENABLE 0x00000002
#define GLES_RS_LOGICOP_ENABLE 0x00000004
#define GLES_RS_TEXTURE0_ENABLE 0x00000008
#define GLES_RS_TEXTURE1_ENABLE 0x00000010
#define GLES_RS_DEPTHTEST_ENABLE 0x00000020
#define GLES_RS_POLYOFFSET_ENABLE 0x00000040
#define GLES_RS_FOG_ENABLE 0x00000080
#define GLES_RS_LINESMOOTH_ENABLE 0x00000100
#define GLES_RS_POINTSMOOTH_ENABLE 0x00000200
/*
* State that affects rasterisation,
* can be handled by HW
* but cannot be properly controlled per-object ...
* ... so is handled per frame or with special objects
*/
#define GLES_FS_DITHER_ENABLE 0x00000001
#define GLES_FS_MULTISAMPLE_ENABLE 0x00000002
#define GLES_FS_SCISSOR_ENABLE 0x00000004
/*
* State that affects transform and lighting
*/
#define GLES_TL_LIGHT0_ENABLE 0x00000001
#define GLES_TL_LIGHT1_ENABLE 0x00000002
#define GLES_TL_LIGHT2_ENABLE 0x00000004
#define GLES_TL_LIGHT3_ENABLE 0x00000008
#define GLES_TL_LIGHT4_ENABLE 0x00000010
#define GLES_TL_LIGHT5_ENABLE 0x00000020
#define GLES_TL_LIGHT6_ENABLE 0x00000040
#define GLES_TL_LIGHT7_ENABLE 0x00000080
#define GLES_TL_LIGHTING_ENABLE 0x00000100
#define GLES_TL_RESCALE_ENABLE 0x00000200
#define GLES_TL_COLORMAT_ENABLE 0x00000400
#define GLES_TL_NORMALIZE_ENABLE 0x00000800
#define GLES_TL_CULLFACE_ENABLE 0x00001000
#define GLES_TL_LIGHTS_ENABLE ( GLES_TL_LIGHT0_ENABLE | GLES_TL_LIGHT1_ENABLE | \
GLES_TL_LIGHT2_ENABLE | GLES_TL_LIGHT3_ENABLE | \
GLES_TL_LIGHT4_ENABLE | GLES_TL_LIGHT5_ENABLE | \
GLES_TL_LIGHT6_ENABLE | GLES_TL_LIGHT7_ENABLE)
#define GLES_TL_CLIP_PLANE0_ENABLE 0x00002000
#define GLES_TL_CLIP_PLANE1_ENABLE 0x00004000
#define GLES_TL_CLIP_PLANE2_ENABLE 0x00008000
#define GLES_TL_CLIP_PLANE3_ENABLE 0x00010000
#define GLES_TL_CLIP_PLANE4_ENABLE 0x00020000
#define GLES_TL_CLIP_PLANE5_ENABLE 0x00040000
#define GLES_TL_CLIP_PLANE0_SHIFT 13
#define GLES_TL_CLIP_PLANES_ENABLE (GLES_TL_CLIP_PLANE0_ENABLE | GLES_TL_CLIP_PLANE1_ENABLE | \
GLES_TL_CLIP_PLANE2_ENABLE | GLES_TL_CLIP_PLANE3_ENABLE | \
GLES_TL_CLIP_PLANE4_ENABLE | GLES_TL_CLIP_PLANE5_ENABLE)
#if defined(SUPPORT_VGP) || defined(SUPPORT_VGP_LITE)
#define GLES_TL_VERTEX_PROGRAM_ENABLE 0x00080000
#endif
/*
* State that can't be handled in hardware, but
* will be tracked atleast
*/
#define GLES_IG_MSALPHACOV_ENABLE 0x00000001
#define GLES_IG_MSSAMPALPHA_ENABLE 0x00000002
#define GLES_IG_MSSAMPCOV_ENABLE 0x00000004
#define GLES_IG_STENCILTEST_ENABLE 0x00000008
#define GLES_DIRTY_HW_ISPTSP 0x00000001
#define GLES_DIRTY_HW_TSPOBJECT 0x00000002
#define GLES_DIRTY_SW_TEXTURE_UNIT 0x00000004
#define GLES_DIRTY_SW_LIGHTING 0x00000008
#define GLES_DIRTY_SW_LIGHT 0x00000010
#define GLES_DIRTY_SW_FOG 0x00000020
#define GLES_DIRTY_SW_VARRAY 0x00000040
#define GLES_DIRTY_SW_VARRAY_DATA 0x00000080
#define GLES_DIRTY_SW_CULL 0x00000100
#define GLES_DIRTY_SW_POLYOFFSET 0x00000200
#define GLES_DIRTY_SW_LINEPOINTSIZE 0x00000400
#define GLES_DIRTY_SW_TEXTURE_STATE 0x00000800
#define GLES_DIRTY_SW_VERTEXFORMAT 0x00001000
#define GLES_DIRTY_SW_VGPLIGHTS 0x00002000
#define GLES_DIRTY_SW_VGPSECTION 0x00004000
#define GLES_DIRTY_SW_CLIP_PLANE 0x00008000
#define GLES_DIRTY_SW_VGPPROGRAM 0x00010000
#if defined(SUPPORT_VGP) || defined(SUPPORT_VGP_LITE)
#define GLES_DIRTY_VGP_SECTIONS(gc) (gc)->ui32DirtyMask |= GLES_DIRTY_SW_VGPSECTION
#define GLES_DIRTY_VGP_CONSTANT(gc, constant) (gc)->ui32DirtyConstantMask |= (constant)
#else
#define GLES_DIRTY_VGP_SECTIONS(gc)
#define GLES_DIRTY_VGP_CONSTANT(gc, constant)
#endif
#define GLES_DIRTY_CONSTANT_MODELVIEW 0x00000001
#define GLES_DIRTY_CONSTANT_MVP 0x00000002
#define GLES_DIRTY_CONSTANT_TEXMATRIX0 0x00000004
#define GLES_DIRTY_CONSTANT_TEXMATRIX1 0x00000008
#define GLES_DIRTY_CONSTANT_COLORMATERIAL 0x00000010
#define GLES_DIRTY_CONSTANT_SCENEAMBIENT 0x00000020
#define GLES_DIRTY_CONSTANT_MATERIAL 0x00000040
#define GLES_DIRTY_CONSTANT_FOGPARAMS 0x00000080
#define GLES_DIRTY_CONSTANT_LIGHT0 0x00000100
#define GLES_DIRTY_CONSTANT_LIGHT1 0x00000200
#define GLES_DIRTY_CONSTANT_LIGHT2 0x00000400
#define GLES_DIRTY_CONSTANT_LIGHT3 0x00000800
#define GLES_DIRTY_CONSTANT_LIGHT4 0x00001000
#define GLES_DIRTY_CONSTANT_LIGHT5 0x00002000
#define GLES_DIRTY_CONSTANT_LIGHT6 0x00004000
#define GLES_DIRTY_CONSTANT_LIGHT7 0x00008000
#define GLES_DIRTY_CONSTANT_LIGHTS (GLES_DIRTY_CONSTANT_LIGHT0 | GLES_DIRTY_CONSTANT_LIGHT1 | \
GLES_DIRTY_CONSTANT_LIGHT2 | GLES_DIRTY_CONSTANT_LIGHT3 | \
GLES_DIRTY_CONSTANT_LIGHT4 | GLES_DIRTY_CONSTANT_LIGHT5 | \
GLES_DIRTY_CONSTANT_LIGHT6 | GLES_DIRTY_CONSTANT_LIGHT7)
#define GLES_DIRTY_CONSTANT_CLIPPLANE0 0x00010000
#define GLES_DIRTY_CONSTANT_CLIPPLANE1 0x00020000
#define GLES_DIRTY_CONSTANT_CLIPPLANE2 0x00040000
#define GLES_DIRTY_CONSTANT_CLIPPLANE3 0x00080000
#define GLES_DIRTY_CONSTANT_CLIPPLANE4 0x00100000
#define GLES_DIRTY_CONSTANT_CLIPPLANE5 0x00200000
#define GLES_DIRTY_CONSTANT_CLIPPLANES (GLES_DIRTY_CONSTANT_CLIPPLANE0 |GLES_DIRTY_CONSTANT_CLIPPLANE1 |\
GLES_DIRTY_CONSTANT_CLIPPLANE2 | GLES_DIRTY_CONSTANT_CLIPPLANE3 |\
GLES_DIRTY_CONSTANT_CLIPPLANE4 | GLES_DIRTY_CONSTANT_CLIPPLANE5)
#define GLES_DIRTY_CONSTANT_PROGRAMMATRIX 0x00400000
#define GLES_DIRTY_CONSTANT_LIGHTMODEL 0x00800000
#define GLES_DIRTY_CONSTANT_CONSTANTS 0x01000000
#define GLES_DIRTY_CONSTANT_VIEWPORT 0x02000000
#define GLES_DIRTY_CONSTANT_ALL 0xFFFFFFFF
/* Pre-computed constants for TnL */
#define GLES_INV_LN_TWO 1.4426950409f /* 1/ln(2) */
#define GLES_INV_SQRT_LN_TWO 1.2011224088f /* 1/sqrt(ln(2)) */
typedef struct GLESLayerState_TAG {
IMG_UINT32 aui32LayerWord[3];
} GLESLayerState;
typedef struct GLESHWContext_TAG {
GLES_SWREGS sRegisters;
IMG_UINT32 ui32TAControland3DState;
IMG_UINT32 ui32FPControlWord;
IMG_UINT32 ui32ISPTSPWord;
IMG_UINT32 ui32TSPObjectWord;
GLESLayerState asLayerState[GLES_MAX_TEXTURE_UNITS];
IMG_UINT32 ui32PassCount;
IMG_UINT32 ui32NumTextureLayers;
IMG_UINT32 ui32PrimitiveHeader;
#if defined(SUPPORT_VGP) || defined (SUPPORT_VGP_LITE)
IMG_UINT32 ui32VGPClipControlWord;
IMG_UINT32 ui32StreamFormat;
#endif
IMG_UINT32 ui32FifoSpace;
PVRSRV_DEV_DATA *ps3DDevData;
PVRSRV_HW_INFO *psHWInfo;
PVRSRV_BGOBJ_INFO sBGObjInfo;
PVRSRV_BGOBJ_INFO sLastFrameBGObjInfo;
GLESSysContext *psSysContext;
PVRSRV_SYNC_INFO *psPrevSync;
} GLESHWContext;
typedef struct GLESclientPixelStateRec {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -