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

📄 vgpcopy.h

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
				case TRIFANLINE:			/* Uses line strips */
				case INDEXEDTRIFANLINE:		/* Uses line strips */
				case TRILISTLINE:			/* Uses line strips */
				case INDEXEDTRILISTLINE:	/* Uses line strips */
				case TRISTRIPLINE:			/* Uses line strips */
				case INDEXEDTRISTRIPLINE:	/* Uses line strips */
				case LINELIST:				/* Uses line strips */
				case INDEXEDLINELIST:		/* Uses line strips */
				case LINESTRIP:
				case INDEXEDLINESTRIP:
				{
					if(psContext->dwNumVerticesSent == 5)
					{
						/* End Strip */
						TACSWriteEndPrim(psContext);

						/* re-write last vertex */
						CopyVertexComponents(psContext, psContext->pbyVertices[1], 1, psVSIFDef);
					}
					break;
				}
				case TRIANGLESTRIP:
				case INDEXEDTRIANGLESTRIP:
				{
					if(psContext->dwHWPRN725Flags & HW_PRN_725_FLAGS_RESEND_LAST_TWO)
					{
						/* Terminate the last triangle before continuing */
						TACSWriteEndPrim(psContext);

						
						psContext->dwHWPRN725Flags		&= ~HW_PRN_725_FLAGS_RESEND_LAST_TWO;
						psContext->dwHWPRN725Flags		&= ~HW_PRN_725_FLAGS_STOREVERTS;
						CopyVertexComponents(psContext, psContext->pbyVertices[0], 1, psVSIFDef);
						CopyVertexComponents(psContext, psContext->pbyVertices[1], 1, psVSIFDef);
						psContext->dwHWPRN725Flags		|= HW_PRN_725_FLAGS_STOREVERTS;
					}

					if(psContext->dwNumVerticesSent == 5)
					{
						/* End the strip */
						TACSWriteEndPrim(psContext);

						if((psContext->dwTAPrimCtl & MBX1_TAPRIM_CULLMODEMASK) != MBX1_TAPRIM_CULLMODENONE)
						{
							/* 
								The next triangle is going to have incorrect cull sense so we need
								to do a bit of jiggery pokery and swap the last two vertices before
								resending, then send the next, then  flag that we need to send the last 
								two verts if we have no more vertices to send with this call, or just end
								the strip then resend the last two vertices if we are continuing
								the strip in this call. 
							*/

							/* Output the re-jigged vertices */
							psContext->dwHWPRN725Flags		&= ~HW_PRN_725_FLAGS_STOREVERTS;
							CopyVertexComponents(psContext, psContext->pbyVertices[1], 1, psVSIFDef);
							CopyVertexComponents(psContext, psContext->pbyVertices[0], 1, psVSIFDef);
							psContext->dwHWPRN725Flags		|= HW_PRN_725_FLAGS_STOREVERTS;
							CopyVertexComponents(psContext, pbyData, 1, psVSIFDef);

							if(i++ >= ui32Vertices)
							{
								/* That was the last for this call, so return */
								psContext->dwHWPRN725Flags	|= HW_PRN_725_FLAGS_RESEND_LAST_TWO;
								return;
							}
							else
							{
								/* Terminate the last triangle and restart the strip */
								TACSWriteEndPrim(psContext);
								psContext->dwHWPRN725Flags		&= ~HW_PRN_725_FLAGS_STOREVERTS;
								CopyVertexComponents(psContext, psContext->pbyVertices[0], 1, psVSIFDef);
								CopyVertexComponents(psContext, psContext->pbyVertices[1], 1, psVSIFDef);
								psContext->dwHWPRN725Flags		|= HW_PRN_725_FLAGS_STOREVERTS;
								pbyData							+= ui32Stride;
							}
						}
						else
						{
							/* We're currently not culling, so just continue */
							psContext->dwHWPRN725Flags		&= ~HW_PRN_725_FLAGS_STOREVERTS;
							CopyVertexComponents(psContext, psContext->pbyVertices[0], 1, psVSIFDef);
							CopyVertexComponents(psContext, psContext->pbyVertices[1], 1, psVSIFDef);
							psContext->dwHWPRN725Flags		|= HW_PRN_725_FLAGS_STOREVERTS;
						}
					}
					break;
				}
				case TRIANGLEFAN:
				case INDEXEDTRIANGLEFAN:
				{
					/* HW will break fans into strips of MAX 5 vertices so Ignore this case */
					break;
				}
				case POINTLIST:
				case INDEXEDPOINTLIST:
				{
					if(psContext->dwNumVerticesSent == 5)
					{
						TACSWriteEndPrim(psContext);
					}
					break;
				}
			}
		}
		else
		{
			/* We're not using the Fix so don't store vertices */
			psContext->dwHWPRN725Flags	&= ~HW_PRN_725_FLAGS_STOREVERTS;
		}
#endif

		j = 0;

		/* up to 7 components */
		switch(ui32NumComponents)
		{
			case 7:
			{
				if(psVSIFDef->eDataFormat == FFVTX_DATA_FMT_MIXED && psComponents[j].bFixedPoint)
				{
					CopyConvertData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#if defined (FIX_HW_PRN_721)
				else if((psVSIFDef->eDataFormat == FFVTX_DATA_FMT_FIXED) && (psComponents[j].bColour != IMG_TRUE))
				{
					CopyClampData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#endif
				else
				{
					CopyData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
				j++;
			}
			case 6:
			{
				if(psVSIFDef->eDataFormat == FFVTX_DATA_FMT_MIXED && psComponents[j].bFixedPoint)
				{
					CopyConvertData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#if defined (FIX_HW_PRN_721)
				else if((psVSIFDef->eDataFormat == FFVTX_DATA_FMT_FIXED) && (psComponents[j].bColour != IMG_TRUE))
				{
					CopyClampData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#endif
				else
				{
					CopyData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
				j++;
			}
			case 5:
			{
				if(psVSIFDef->eDataFormat == FFVTX_DATA_FMT_MIXED && psComponents[j].bFixedPoint)
				{
					CopyConvertData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#if defined (FIX_HW_PRN_721)
				else if((psVSIFDef->eDataFormat == FFVTX_DATA_FMT_FIXED) && (psComponents[j].bColour != IMG_TRUE))
				{
					CopyClampData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#endif
				else
				{
					CopyData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
				j++;
			}
			case 4:
			{
				if(psVSIFDef->eDataFormat == FFVTX_DATA_FMT_MIXED && psComponents[j].bFixedPoint)
				{
					CopyConvertData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#if defined (FIX_HW_PRN_721)
				else if((psVSIFDef->eDataFormat == FFVTX_DATA_FMT_FIXED) && (psComponents[j].bColour != IMG_TRUE))
				{
					CopyClampData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#endif
				else
				{
					CopyData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
				j++;
			}
			case 3:
			{
				if(psVSIFDef->eDataFormat == FFVTX_DATA_FMT_MIXED && psComponents[j].bFixedPoint)
				{
					CopyConvertData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#if defined (FIX_HW_PRN_721)
				else if((psVSIFDef->eDataFormat == FFVTX_DATA_FMT_FIXED) && (psComponents[j].bColour != IMG_TRUE))
				{
					CopyClampData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#endif
				else
				{
					CopyData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
				j++;
			}
			case 2:
			{
				if(psVSIFDef->eDataFormat == FFVTX_DATA_FMT_MIXED && psComponents[j].bFixedPoint)
				{
					CopyConvertData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#if defined (FIX_HW_PRN_721)
				else if((psVSIFDef->eDataFormat == FFVTX_DATA_FMT_FIXED) && (psComponents[j].bColour != IMG_TRUE))
				{
					CopyClampData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#endif
				else
				{
					CopyData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
				j++;
			}
			case 1:
			{
				if(psVSIFDef->eDataFormat == FFVTX_DATA_FMT_MIXED && psComponents[j].bFixedPoint)
				{
					CopyConvertData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#if defined (FIX_HW_PRN_721)
				else if((psVSIFDef->eDataFormat == FFVTX_DATA_FMT_FIXED) && (psComponents[j].bColour != IMG_TRUE))
				{
					CopyClampData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
#endif
				else
				{
					CopyData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
				}
				j++;

			}
		}

#if defined (FIX_HW_PRN_725_MBXLITE)
		psContext->dwNumVerticesSent++;
		if(psContext->dwHWPRN725Flags & HW_PRN_725_FLAGS_STOREVERTS)
		{
			psContext->pbyVertices[0] = psContext->pbyVertices[1];
			psContext->pbyVertices[1] = pbyData;
		}
#endif
		pbyData += ui32Stride;
	}
}
/*----------------------------------------------------------------------------
<function>
	FUNCTION:   CopySelect

	PURPOSE:    inline vertex data copy function selection.
				Forms inline data copy code block.

	PARAMETERS:	In: psContext	 - Current context
				In: pbyData		 - vertex data pointer
				In: ui32Vertices - vertex count
				In: psVSIFDef    - Input Format definition 
</function>
------------------------------------------------------------------------------*/
__forceinline IMG_VOID CopySelect(LPD3DM_CONTEXT psContext,
								  IMG_UINT8		*pbyData,
								  IMG_UINT32	ui32Vertices,
								  PVSIFDEF		psVSIFDef)
{
	switch(psContext->eCopyFn)
	{
		case COPY_FUNC_BLOCK_COPY:
		{
#if defined (FIX_HW_PRN_721)
			if(psVSIFDef->eDataFormat == FFVTX_DATA_FMT_FIXED)
			{
				CopyClampData(psContext, ((IMG_UINT8*) pbyData + psComponents[j].dwOffset), psComponents[j].dwSize);
			}
			else
#endif
			{
				CopyData(psContext, pbyData, ui32Vertices * psVSIFDef->psComponents[0].dwSize);
			}
			break;
		}
		case COPY_FUNC_COPY_VERTICES:
		{
			CopyVertices(psContext, pbyData, ui32Vertices, psVSIFDef);
			break;
		}
		case COPY_FUNC_COPY_COMPONENTS:
		{
			CopyVertexComponents(psContext, pbyData, ui32Vertices, psVSIFDef);
			break;
		}
	}
}

#endif /* #ifdef SUPPORT_VGP */
#endif /* #if !defined(_VGPCOPY_H__) */
/*****************************************************************************
 End of file (vgpcopy.h)
*****************************************************************************/

⌨️ 快捷键说明

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