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

📄 context.h

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
    IMG_UINT32 ui32PackAlignment;
    IMG_UINT32 ui32UnpackAlignment;
} GLESclientPixelState;


/*
** Polygon machine state.  Contains all the polygon specific state,
** as well as procedure pointers used during rendering operations.
*/
typedef struct GLESpolygonMachineRec {

    /*
    ** Lookup table that returns the face (0=front, 1=back) when indexed
    ** by a flag which is zero for CW and 1 for CCW.  If FrontFace is CW:
    ** 	face[0] = 0
    ** 	face[1] = 1
    ** else
    ** 	face[0] = 1
    ** 	face[1] = 0
    */
    IMG_UINT32 aui32Face[2];

    /*
    ** Culling flag.  0 when culling the front face, 1 when culling the
    ** back face and 2 when not culling.
    */
    IMG_UINT32 ui32CullFlag;
} GLESpolygonMachine;

/* defines for above cullFlag */
#define GLES_CULLFACE_FRONTFACE		0
#define GLES_CULLFACE_BACKFACE		1

#define GLES_CULLFLAG_FRONT			GLES_CULLFACE_FRONTFACE
#define GLES_CULLFLAG_BACK			GLES_CULLFACE_BACKFACE
#define GLES_CULLFLAG_DONT			2
#define GLES_CULLFLAG_BOTH			3

/* Indices for face[] array above */
#define GLES_WINDING_CW				0
#define GLES_WINDING_CCW			1


typedef struct GLESclearMachineRec {

	/* Flags for pending clears */
    IMG_UINT32 ui32ClearFlags;

    /*
    ** Pending clear region
    */
	IMG_INT32 i32ClearX0;
	IMG_INT32 i32ClearY0;
	IMG_INT32 i32ClearX1;
	IMG_INT32 i32ClearY1;
   
	/* 
	 * Pending clear color and depth (not necessarily same as current state) 
	 */
	IMG_UINT32 ui32ClearColor;
	IMG_FLOAT fClearDepth;

} GLESclearMachine;


#define GLES_CLEARFLAG_COLOR		1
#define GLES_CLEARFLAG_DEPTH		2


/************************************************************************/
struct PVRDrawableRec;

struct GLESContext_TAG {
	IMG_HANDLE hServices;
	GLESHWContext sHWContext;
	IMG_UINT32 ui32RasterEnables;
	IMG_UINT32 ui32TnLEnables;
	IMG_UINT32 ui32FrameEnables;
	IMG_UINT32 ui32IgnoredEnables;

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

    /*
    ** All of the current user controllable state is resident here.
    */
    GLESstate sState;

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

    /*
    ** Most recent error code, or GL_NO_ERROR if no error has occurred
    ** since the last glGetError.
    */
    IMG_INT32 i32Error;

    /*
    ** Mode information that describes the kind of buffers and rendering
    ** modes that this context manages.
    */
    GLEScontextMode *psMode;


    /* Client pixel state */
    GLESclientPixelState sClientPixel;

	/* Active texture unit */
    IMG_UINT32 ui32ClientActiveTexture;


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

    /*
    ** Mask word of dirty bits.  Most routines just set the GENERIC bit to 
    ** dirty, others may set more specific bits.  The list of bits is 
    ** listed below.
    */
    IMG_UINT32 ui32DirtyMask;

	/*	Function pointers that are mode dependent */
    GLESprocs sProcs; 

    /* Machine structures defining software rendering "machine" state */
    GLESlightMachine sLight;
	GLESpolygonMachine sPolygon;
    GLEStextureMachine sTexture;
    GLEStransformMachine sTransform;
	GLESclearMachine sClear;
    GLESVertArrayMachine sVertexArray;

#if defined(SUPPORT_VGP) || defined(SUPPORT_VGP_LITE)
	GLESVertexProgramMachine sVertexProgram;
#endif


    IMG_UINT32 ui32CullFace;
    
	/*
    ** Mask word of dirty constant bits.  Used to upload relevant constants to VGP.
    ** listed below.
    */

	IMG_UINT32 ui32DirtyConstantMask;

	/* Booleans for re-dumping of invalid special objects */
	IMG_BOOL bDrawMaskInvalid;
	IMG_BOOL bFogColorInvalid;

	GLESDrawMaskRect sLastDrawMask;
	IMG_BOOL bLastDrawMaskFullScreenEnable;
	IMG_BOOL bFullScreenScissor;
	IMG_BOOL bFullScreenViewport;
	IMG_CHAR *pszExtensions;

#ifdef PDUMP
	PDUMP_CONTEXT	*psPDContext;
#endif

#ifdef OLDPDUMP
	FILE *fpScript;
	FILE *fpTex;
	FILE *fpPrim;
	IMG_UINT32 ui32ScriptPos;
	IMG_UINT32 ui32PdumpStart;
	IMG_UINT32 ui32PdumpStop;
	IMG_UINT32 ui32PdumpSkip;
#endif

	GLESDrawableHandle hWriteDrawable;
	GLESDrawableHandle hReadDrawable;
	GLESRenderSurface *psRenderSurface;
	GLESDrawableParams sDrawableParams;

	GLESAppHints		sAppHints;

	IMG_BOOL	bLastProgramLoadedFF;

#if defined (TIMING) || defined (DEBUG)
	IMG_UINT32 ui32PrevTime;
	Temporal_Data asTimes[GLES_NUM_TIMERS]; 
	DrawCallData sDrawCall[2];
	StateMetricData	*psStateMetricData;
	IMG_UINT32 RedundantStatesRaster[9];
	IMG_UINT32 RedundantStatesTnL[12];
	IMG_UINT32 RedundantStatesFrame[3];
	IMG_UINT32 RedundantStatesIgnore[7];
	IMG_UINT32 *pui32TimerRegister;
	IMG_FLOAT  fCPUSpeed;
	FILE *fProfileOutput;
#endif
};


typedef struct  PVRcontextRec {
    GLESContext				gc;					/* The context used by OpenGL. */
    struct PVRcontextRec	*psPrevContext;		/* Linked list */
    struct PVRcontextRec	*psNextContext;		/* list of cx's per drawable */
    GLEScontextMode			sMode;				/* type of context */
    IMG_BOOL				bHasBeenCurrent;	/* Used for one-off initialisation. */

#if 0
	/* These will probably be necessary for multi-context/multi-threading. Needs more thought */
    IMG_BOOL				bIsInUse;			/* used to exclude other threads. */
    IMG_UINT32				ui32PendingState;	/* context had to be notified */
    IMG_UINT32				ui32Owner;			/* Thread ID of the current owner. */
    
	EGLContext				hGLRC;				/* The HGLRC handle associated with context. */
    EGLSurface				hWnd;				/* The window handle associated with this context. */
    EGLDisplay				hDC;				/* The HDC associated with the context. */
    EGLConfig				pFD;				/* Pixel configuration structure */

    IMG_INT32				i32PixelFormat;		/* Pixel Format Index. */
#endif
} PVRcontext;


/* Fn Prototypes */

/* fb.c */
IMG_GLESERROR FlushHW(GLESContext *gc, GLESRenderSurface *psRenderSurface, IMG_BOOL bWaitForHW);
IMG_BOOL PrepareToDraw(GLESContext *gc);
IMG_VOID WaitForPreviousFrame(GLESContext *gc);

/* maths.c */
IMG_UINT32 FloorLog2(IMG_UINT32 ui32Val);

/* misc.c */
extern IMG_VOID SetError(GLESContext *gc, GLenum eError);
extern IMG_VOID BuildExtensionString(GLESContext *gc);
extern IMG_VOID DestroyExtensionString(GLESContext *gc);
IMG_FLOAT Clampf(IMG_FLOAT fVal, IMG_FLOAT fMin, IMG_FLOAT fMax);
IMG_INT32 Clampi(IMG_INT32 i32Val, IMG_INT32 i32Min, IMG_INT32 i32Max);
IMG_UINT32 ColorConvertToHWFormat(GLEScolor *psColor);
IMG_VOID ColorConvertFromHWFormat(GLEScolor *psColor, IMG_UINT32 ui32Color);
IMG_UINT32 FogConvert(IMG_FLOAT fFogVal);

/* pixelops.c */
IMG_BOOL SetupReadPixelsSpanInfo(GLESContext *gc, GLESpixelSpanInfo *psSpanInfo, IMG_INT32 i32X, IMG_INT32 i32Y, 
								IMG_UINT32 ui32Width, IMG_UINT32 ui32Height, GLenum format, GLenum eType, 
								IMG_BOOL bUsePackAlignment, GLESDrawableParams *psReadParams);

/* specialobject.c */
IMG_VOID SendDrawMaskForPrimitive(GLESContext *gc);
IMG_VOID SendRegionClipControl(GLESContext *gc);
IMG_VOID SendDrawMaskRect(GLESContext *gc, GLESDrawMaskRect *psRect, IMG_BOOL bIsEnable);
IMG_VOID SendSWBackgroundObject(GLESContext *gc);
IMG_VOID SendDrawMaskForClear(GLESContext *gc);
IMG_VOID DrawClearPrims(GLESContext *gc);
IMG_VOID SendFogColorChange(GLESContext *gc);
IMG_VOID SetupHWBGObjWords(GLESContext *gc);

/* tnl */
IMG_VOID Materialfv(GLESContext *gc, GLenum ui32Face, GLenum ePname, const IMG_FLOAT *pfParams);

/* validate.c */
IMG_VOID SetupControlWords(GLESContext *gc);
IMG_VOID ValidateTextureState(GLESContext *gc);
IMG_VOID ValidatePointLineSize(GLESContext *gc);
IMG_VOID GLESEmitState(GLESContext *gc);

/* validatetnl.c */
IMG_VOID ValidatePolygonOffset(GLESContext *gc);

/* vgp.c */
IMG_VOID LoadVGPConstants(GLESContext *gc, IMG_FLOAT *pfConstantData, IMG_UINT32 ui32Size, IMG_UINT32 ui32Start);

/* external provided funtions */
extern const IMG_CHAR *GetExternalExtensionString(IMG_VOID);
extern IMG_VOID (* GetExternalProcAddress (const IMG_CHAR *procname))(IMG_VOID);

#define GLES_ASSERT(n) if(!(n)) DPF((DBG_ERROR,"Assert failed"))

#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))

#define __GL_SET_CONTEXT(gc) \
    ENV_SetTLSValue(TLS_ID_OGL, (IMG_VOID *)(gc));

#define __GL_GET_CONTEXT() \
    GLESContext *gc = (GLESContext *)ENV_GetTLSValue(TLS_ID_OGL); \
	if(!gc) return

#define __GL_GET_CONTEXT_RETURN() \
    GLESContext *gc = (GLESContext *)ENV_GetTLSValue(TLS_ID_OGL); \
	if(!gc) return 0


#define __GC(x) gc->x


#endif /* _CONTEXT_ */

/**************************************************************************
 End of file (context.h)
**************************************************************************/


⌨️ 快捷键说明

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