• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!****************************************************************************
2 
3  @file         PVRTPFXParser.h
4  @copyright    Copyright (c) Imagination Technologies Limited.
5  @brief        Declaration of PFX file parser
6 
7 ******************************************************************************/
8 
9 #ifndef _PVRTPFXPARSER_H_
10 #define _PVRTPFXPARSER_H_
11 
12 
13 /*****************************************************************************
14 ** Includes
15 ******************************************************************************/
16 
17 #include "PVRTArray.h"
18 #include "PVRTString.h"
19 #include "PVRTError.h"
20 #include "PVRTTexture.h"
21 #include "PVRTVector.h"
22 #include "PVRTSkipGraph.h"
23 #include "PVRTStringHash.h"
24 
25 /****************************************************************************
26 ** Helper Funcions
27 ****************************************************************************/
28 void PVRTPFXCreateStringCopy(char** ppDst, const char* pSrc);
29 
30 /****************************************************************************
31 ** Enumeration
32 ****************************************************************************/
33 /*!**************************************************************************
34 @enum	ESemanticDefaultDataType
35 @brief  Enum values for the various variable types supported
36 ****************************************************************************/
37 enum ESemanticDefaultDataType
38 {
39 	eDataTypeMat2,
40 	eDataTypeMat3,
41 	eDataTypeMat4,
42 	eDataTypeVec2,
43 	eDataTypeVec3,
44 	eDataTypeVec4,
45 	eDataTypeIvec2,
46 	eDataTypeIvec3,
47 	eDataTypeIvec4,
48 	eDataTypeBvec2,
49 	eDataTypeBvec3,
50 	eDataTypeBvec4,
51 	eDataTypeFloat,
52 	eDataTypeInt,
53 	eDataTypeBool,
54 
55 	eNumDefaultDataTypes,
56 	eDataTypeNone,
57 
58 	// Conceptual data types
59 	eDataTypeRGB,
60 	eDataTypeRGBA
61 };
62 
63 /*!**************************************************************************
64 @enum   EDefaultDataInternalType
65 @brief  Enum values for defining whether a variable is float, interger or bool
66 ****************************************************************************/
67 enum EDefaultDataInternalType
68 {
69 	eFloating,
70 	eInteger,
71 	eBoolean
72 };
73 
74 /*!**************************************************************************
75 @enum	EPVRTPFXPassType
76 @brief  Decribes the type of render required
77 ****************************************************************************/
78 enum EPVRTPFXPassType
79 {
80 	eNULL_PASS,
81 	eCAMERA_PASS,
82 	ePOSTPROCESS_PASS,
83 	eENVMAPCUBE_PASS,
84 	eENVMAPSPH_PASS
85 };
86 
87 /*!**************************************************************************
88 @enum	EPVRTPFXPassType
89 @brief  Decribes the type of render required
90 ****************************************************************************/
91 enum EPVRTPFXPassView
92 {
93 	eVIEW_CURRENT,			// The scene's active camera is used
94 	eVIEW_POD_CAMERA,		// The specified camera is used
95 	eVIEW_NONE				// No specified view
96 };
97 
98 /****************************************************************************
99 ** Structures
100 ****************************************************************************/
101 /*!**************************************************************************
102 @struct SPVRTPFXParserHeader
103 @brief  Struct for storing PFX file header data
104 ****************************************************************************/
105 struct SPVRTPFXParserHeader
106 {
107 	CPVRTString			Version;
108 	CPVRTString			Description;
109 	CPVRTString			Copyright;
110 };
111 
112 /*!**************************************************************************
113 @struct SPVRTPFXParserTexture
114 @brief  Struct for storing PFX data from the texture block
115 ****************************************************************************/
116 struct SPVRTPFXParserTexture
117 {
118 	CPVRTStringHash		Name;
119 	CPVRTStringHash		FileName;
120 	bool				bRenderToTexture;
121 	unsigned int		nMin, nMag, nMIP;
122 	unsigned int		nWrapS, nWrapT, nWrapR;	// either GL_CLAMP or GL_REPEAT
123 	unsigned int		uiWidth, uiHeight;
124 	unsigned int		uiFlags;
125 };
126 
127 /*!**************************************************************************
128 @struct SPVRTPFXParserEffectTexture
129 @brief  Stores effect texture information
130 ****************************************************************************/
131 struct SPVRTPFXParserEffectTexture
132 {
133 	CPVRTStringHash				Name;				// Name of texture.
134 	unsigned int				nNumber;			// Texture number to set
135 };
136 
137 /*!**************************************************************************
138 @struct SPVRTPFXParserShader
139 @brief  Struct for storing PFX data from the shader block
140 ****************************************************************************/
141 struct SPVRTPFXParserShader
142 {
143 	CPVRTStringHash			Name;
144 	bool					bUseFileName;
145 	char*					pszGLSLfile;
146 	char*					pszGLSLBinaryFile;
147 	char*					pszGLSLcode;
148 	char*					pbGLSLBinary;
149 	unsigned int			nGLSLBinarySize;
150 	unsigned int			nFirstLineNumber;	// Line number in the text file where this code began; use to correct line-numbers in compiler errors
151 	unsigned int			nLastLineNumber;	// The final line number of the GLSL block.
152 
153 	SPVRTPFXParserShader();
154 	~SPVRTPFXParserShader();
155 	SPVRTPFXParserShader(const SPVRTPFXParserShader& rhs);
156 	SPVRTPFXParserShader& operator=(const SPVRTPFXParserShader& rhs);
157 
158 	void Copy(const SPVRTPFXParserShader& rhs);
159 };
160 
161 /*!**************************************************************************
162 @struct SPVRTSemanticDefaultDataTypeInfo
163 @brief  Struct for storing default data types
164 ****************************************************************************/
165 struct SPVRTSemanticDefaultDataTypeInfo
166 {
167 	ESemanticDefaultDataType	eType;
168 	const char					*pszName;
169 	unsigned int				nNumberDataItems;
170 	EDefaultDataInternalType	eInternalType;
171 };
172 
173 /*!**************************************************************************
174 @struct SPVRTSemanticDefaultData
175 @brief  Stores a default value
176 ****************************************************************************/
177 struct SPVRTSemanticDefaultData
178 {
179 	float						pfData[16];
180 	int							pnData[4];
181 	bool						pbData[4];
182 	ESemanticDefaultDataType	eType;
183 
184 	SPVRTSemanticDefaultData();
185 	SPVRTSemanticDefaultData(const SPVRTSemanticDefaultData& rhs);
186 	SPVRTSemanticDefaultData& operator=(const SPVRTSemanticDefaultData& rhs);
187 
188 	void Copy(const SPVRTSemanticDefaultData& rhs);
189 };
190 
191 /*!**************************************************************************
192 @struct SPVRTPFXParserSemantic
193 @brief  Stores semantic information
194 ****************************************************************************/
195 struct SPVRTPFXParserSemantic
196 {
197 	char						*pszName;				/*!< The variable name as used in the shader-language code */
198 	char						*pszValue;				/*!< For example: LIGHTPOSITION */
199 	unsigned int				nIdx;					/*!< Index; for example two semantics might be LIGHTPOSITION0 and LIGHTPOSITION1 */
200 	SPVRTSemanticDefaultData	sDefaultValue;			/*!< Default value */
201 
202 	SPVRTPFXParserSemantic();
203 	~SPVRTPFXParserSemantic();
204 	SPVRTPFXParserSemantic(const SPVRTPFXParserSemantic& rhs);
205 	SPVRTPFXParserSemantic& operator=(const SPVRTPFXParserSemantic& rhs);
206 
207 	void Copy(const SPVRTPFXParserSemantic& rhs);
208 };
209 
210 
211 struct SPVRTPFXParserEffect;	// Forward declaration
212 /*!**************************************************************************
213 @struct SPVRTPFXRenderPass
214 @brief  Stores render pass information
215 ****************************************************************************/
216 struct SPVRTPFXRenderPass
217 {
218 	EPVRTPFXPassType		eRenderPassType;			// Type of pass.
219 	EPVRTPFXPassView		eViewType;					// View type.
220 	PVRTuint32				uiFormatFlags;				// Surface Type.
221 	SPVRTPFXParserEffect*	pEffect;					// Matched pass. Needed but determined from effect block.
222 	SPVRTPFXParserTexture*	pTexture;					// The RTT target for this pass.
223 	CPVRTString				NodeName;					// POD Camera name.
224 	CPVRTString				SemanticName;				// Name of this pass.
225 
226 	SPVRTPFXRenderPass();
227 };
228 
229 /*!**************************************************************************
230 @struct SPVRTTargetPair
231 @brief  Stores a buffer type and name for a render target.
232 ****************************************************************************/
233 struct SPVRTTargetPair
234 {
235 	CPVRTString				BufferType;
236 	CPVRTString				TargetName;
237 };
238 
239 /*!**************************************************************************
240 @struct SPVRTPFXParserEffect
241 @brief  Stores effect information
242 ****************************************************************************/
243 struct SPVRTPFXParserEffect
244 {
245 	CPVRTStringHash							Name;
246 	CPVRTString								Annotation;
247 
248 	CPVRTStringHash							VertexShaderName;
249 	CPVRTStringHash							FragmentShaderName;
250 
251 	CPVRTArray<SPVRTPFXParserSemantic>		Uniforms;
252 	CPVRTArray<SPVRTPFXParserSemantic>		Attributes;
253 	CPVRTArray<SPVRTPFXParserEffectTexture>	Textures;
254 	CPVRTArray<SPVRTTargetPair>				Targets;
255 
256 	SPVRTPFXParserEffect();
257 };
258 
259 /****************************************************************************
260 ** Constants
261 ****************************************************************************/
262 const PVRTuint32 PVRPFXTEX_COLOUR = PVRTuint32(1<<30);
263 const PVRTuint32 PVRPFXTEX_DEPTH  = PVRTuint32(1<<31);
264 
265 const static SPVRTSemanticDefaultDataTypeInfo c_psSemanticDefaultDataTypeInfo[] =
266 {
267 	{ eDataTypeMat2,		"mat2",			4,		eFloating },
268 	{ eDataTypeMat3,		"mat3",			9,		eFloating },
269 	{ eDataTypeMat4,		"mat4",			16,		eFloating },
270 	{ eDataTypeVec2,		"vec2",			2,		eFloating },
271 	{ eDataTypeVec3,		"vec3",			3,		eFloating },
272 	{ eDataTypeVec4,		"vec4",			4,		eFloating },
273 	{ eDataTypeIvec2,		"ivec2",		2,		eInteger },
274 	{ eDataTypeIvec3,		"ivec3",		3,		eInteger },
275 	{ eDataTypeIvec4,		"ivec4",		4,		eInteger },
276 	{ eDataTypeBvec2,		"bvec2",		2,		eBoolean },
277 	{ eDataTypeBvec3,		"bvec3",		3,		eBoolean },
278 	{ eDataTypeBvec4,		"bvec4",		4,		eBoolean },
279 	{ eDataTypeFloat,		"float",		1,		eFloating },
280 	{ eDataTypeInt,			"int",			1,		eInteger },
281 	{ eDataTypeBool,		"bool",			1,		eBoolean },
282 };
283 
284 
285 class CPVRTPFXParserReadContext;
286 
287 /*!**************************************************************************
288 @class CPVRTPFXParser
289 @brief PFX parser
290 ****************************************************************************/
291 class CPVRTPFXParser
292 {
293 public:
294 	/*!***************************************************************************
295 	@fn      			CPVRTPFXParser
296 	@brief     		Sets initial values.
297 	*****************************************************************************/
298 	CPVRTPFXParser();
299 
300 	/*!***************************************************************************
301 	@fn      			~CPVRTPFXParser
302 	@brief     		Frees memory used.
303 	*****************************************************************************/
304 	~CPVRTPFXParser();
305 
306 	/*!***************************************************************************
307 	@fn      			ParseFromMemory
308 	@param[in]				pszScript		PFX script
309 	@param[out]				pReturnError	error string
310 	@return				PVR_SUCCESS for success parsing file
311 						PVR_FAIL if file doesn't exist or is invalid
312 	@brief     		Parses a PFX script from memory.
313 	*****************************************************************************/
314 	EPVRTError ParseFromMemory(const char * const pszScript, CPVRTString * const pReturnError);
315 
316 	/*!***************************************************************************
317 	@fn      			ParseFromFile
318 	@param[in]				pszFileName		PFX file name
319 	@param[out]				pReturnError	error string
320 	@return				PVR_SUCCESS for success parsing file
321 						PVR_FAIL if file doesn't exist or is invalid
322 	@brief     		Reads the PFX file and calls the parser.
323 	*****************************************************************************/
324 	EPVRTError ParseFromFile(const char * const pszFileName, CPVRTString * const pReturnError);
325 
326 	/*!***************************************************************************
327 	 @fn      			SetViewportSize
328 	 @param[in]				uiWidth				New viewport width
329 	 @param[in]				uiHeight			New viewport height
330 	 @return			bool				True on success
331 	 @brief     		Allows the current viewport size to be set. This value
332 						is used for calculating relative texture resolutions
333 	*****************************************************************************/
334 	bool SetViewportSize(unsigned int uiWidth, unsigned int uiHeight);
335 
336 	/*!***************************************************************************
337 	@fn      		FindTextureIndex
338 	@param[in]			TextureName		The name of the texture to find
339 	@param[in]			uiEffect		The effect block to look for the texture in
340 	@return			Index in to the effect.Texture array.
341 	@brief     	Returns the index in to the texture array within the effect
342 					block where the given texture resides.
343 	*****************************************************************************/
344 	unsigned int FindTextureIndex(const CPVRTStringHash& TextureName, unsigned int uiEffect) const;
345 
346 	/*!***************************************************************************
347 	@fn      			RetrieveRenderPassDependencies
348 	@param[out]			aRequiredRenderPasses	Dynamic array of required render passes
349 	@param[in]			aszActiveEffectStrings	Dynamic array containing names of active
350 												effects in the application
351 	@return				success of failure
352 	@brief     		    Takes an array of strings containing the names of active
353 						effects for this PFX in a given application and then outputs
354 						an array of the render passes the application needs to perform that is sorted
355 						into the order they need to be executed (where [0] is the first to be executed,
356 						and [n] is the last).
357 						In addition to determining the order of dependent passes
358 						(such as POSTPROCESS render passes), this function should check if
359 						CAMERA passes are referenced by active EFFECT blocks and use this information
360 						to strip redundant passes.
361 	*****************************************************************************/
362 	bool RetrieveRenderPassDependencies(CPVRTArray<SPVRTPFXRenderPass*> &aRequiredRenderPasses,
363 										CPVRTArray<CPVRTStringHash> &aszActiveEffectStrings);
364 
365 	/*!***************************************************************************
366 	@brief     	    Returns the number of render passes within this PFX.
367 	@return			The number of render passes required
368 	*****************************************************************************/
369 	unsigned int GetNumberRenderPasses() const;
370 
371 	/*!***************************************************************************
372 	@brief     	    Returns the given render pass.
373 	@param[in]		uiIndex				The render pass index.
374 	@return			A given render pass.
375 	*****************************************************************************/
376 	const SPVRTPFXRenderPass& GetRenderPass(unsigned int uiIndex) const;
377 
378 	/*!***************************************************************************
379 	@fn      		GetNumberFragmentShaders
380 	@return			Number of fragment shaders.
381 	@brief     	    Returns the number of fragment shaders referenced in the PFX.
382 	*****************************************************************************/
383 	unsigned int GetNumberFragmentShaders() const;
384 
385 	/*!***************************************************************************
386 	@fn      		GetFragmentShader
387 	@param[in]		uiIndex		The index of this shader.
388 	@return			The PFX fragment shader.
389 	@brief     	    Returns a given fragment shader.
390 	*****************************************************************************/
391 	SPVRTPFXParserShader& GetFragmentShader(unsigned int uiIndex);
392 
393 	/*!***************************************************************************
394 	@fn      		GetNumberVertexShaders
395 	@return			Number of vertex shaders.
396 	@brief     	    Returns the number of vertex shaders referenced in the PFX.
397 	*****************************************************************************/
398 	unsigned int GetNumberVertexShaders() const;
399 
400 	/*!***************************************************************************
401 	@fn      		GetVertexShader
402 	@param[in]		uiIndex		The index of this shader.
403 	@return			The PFX vertex shader.
404 	@brief     	    Returns a given vertex shader.
405 	*****************************************************************************/
406 	SPVRTPFXParserShader& GetVertexShader(unsigned int uiIndex);
407 
408 	/*!***************************************************************************
409 	@fn      		GetNumberEffects
410 	@return			Number of effects.
411 	@brief     	    Returns the number of effects referenced in the PFX.
412 	*****************************************************************************/
413 	unsigned int GetNumberEffects() const;
414 
415 	/*!***************************************************************************
416 	@fn      		GetEffect
417 	@param[in]		uiIndex		The index of this effect.
418 	@return			The PFX effect.
419 	@brief     	    Returns a given effect.
420 	*****************************************************************************/
421 	const SPVRTPFXParserEffect& GetEffect(unsigned int uiIndex) const;
422 
423 	/*!***************************************************************************
424 	@fn      		FindEffectByName
425 	@param[in]		Name		Name of the effect.
426 	@return			int
427 	@brief     	    Returns the index of the given string. Returns -1 on failure.
428 	*****************************************************************************/
429 	int FindEffectByName(const CPVRTStringHash& Name) const;
430 
431 	/*!***************************************************************************
432 	@fn      		FindTextureByName
433 	@param[in]		Name		Name of the texture.
434 	@return			int
435 	@brief     	    Returns the index of the given texture. Returns -1 on failure.
436 	*****************************************************************************/
437 	int FindTextureByName(const CPVRTStringHash& Name) const;
438 
439 	/*!***************************************************************************
440 	@fn      		GetNumberTextures
441 	@return			Number of effects.
442 	@brief     	    Returns the number of textures referenced in the PFX.
443 	*****************************************************************************/
444 	unsigned int GetNumberTextures() const;
445 
446 	/*!***************************************************************************
447 	@fn      		GetTexture
448 	@param[in]		uiIndex		The index of this texture
449 	@return			The PFX texture.
450 	@brief     	    Returns a given texture.
451 	*****************************************************************************/
452 	const SPVRTPFXParserTexture* GetTexture(unsigned int uiIndex) const;
453 
454 	/*!***************************************************************************
455 	@fn      		GetPFXFileName
456 	@return			The filename for this PFX file
457 	@brief     	    eturns the PFX file name associated with this object.
458 	*****************************************************************************/
459 	const CPVRTString& GetPFXFileName() const;
460 
461 	/*!***************************************************************************
462 	@fn      		GetPostProcessNames
463 	@return			An array of post process names
464 	@brief     	    Returns a list of prost process effect names.
465 	*****************************************************************************/
466 	const CPVRTArray<CPVRTString>& GetPostProcessNames() const;
467 
468 public:
469 	static const unsigned int							VIEWPORT_SIZE;
470 
471 private:
472     SPVRTPFXParserHeader								m_sHeader;
473 
474 	CPVRTArrayManagedPointers<SPVRTPFXParserTexture>	m_psTexture;
475 	CPVRTArray<SPVRTPFXParserShader>					m_psFragmentShader;
476 	CPVRTArray<SPVRTPFXParserShader>					m_psVertexShader;
477 	CPVRTArray<SPVRTPFXParserEffect>					m_psEffect;
478 	CPVRTArray<SPVRTPFXRenderPass>						m_RenderPasses;
479 
480 	CPVRTString											m_szFileName;
481 	CPVRTPFXParserReadContext*							m_psContext;
482 	CPVRTArray<CPVRTString>								m_aszPostProcessNames;
483 
484 	unsigned int										m_uiViewportWidth;
485 	unsigned int										m_uiViewportHeight;
486 	CPVRTSkipGraphRoot<SPVRTPFXRenderPass*>				m_renderPassSkipGraph;
487 
488 	/*!***************************************************************************
489 	@fn      			Parse
490 	@param[out]			pReturnError	error string
491 	@return				true for success parsing file
492 	@brief     		    Parses a loaded PFX file.
493 	*****************************************************************************/
494 	bool Parse(	CPVRTString * const pReturnError);
495 
496 	/*!***************************************************************************
497 	@fn      			ReduceWhitespace
498 	@param[out]			line		output text
499 	@brief     		    Reduces all white space characters in the string to one
500 						blank space.
501 	*****************************************************************************/
502 	void ReduceWhitespace(char *line);
503 
504 	/*!***************************************************************************
505 	@fn      			GetEndTag
506 	@param[in]			pszTagName		tag name
507 	@param[in]			nStartLine		start line
508 	@param[out]			pnEndLine		line end tag found
509 	@return				true if tag found
510 	@brief     		    Searches for end tag pszTagName from line nStartLine.
511 						Returns true and outputs the line number of the end tag if
512 						found, otherwise returning false.
513 	*****************************************************************************/
514 	bool GetEndTag(const char *pszTagName, int nStartLine, int *pnEndLine);
515 
516 	/*!***************************************************************************
517 	 @brief     		Finds the parameter after the specified delimiting character and
518 						returns the parameter as a string. An empty string is returned
519 						if a parameter cannot be found
520 	 @param[out]		aszSourceString		The string to search
521 	 @param[in]			parameterTag		The tag to find
522 	 @param[in]			delimiter			Delimiters
523 	 @return			Found parameter or empty string
524 	*****************************************************************************/
525 	CPVRTString FindParameter(char *aszSourceString, const CPVRTString &parameterTag, const CPVRTString &delimiter);
526 
527 	/*!***************************************************************************
528 	 @fn      			ReadStringToken
529 	 @param[in]			pszSource			Parameter string to process
530 	 @param[out]		output				Processed string
531 	 @param[out]		ErrorStr			String containing errors
532 	 @param[in]			iLine				The line to read
533 	 @param[in]			pCaller				The caller's name or identifier
534 	 @return			Returns true on success
535 	 @brief     		Processes the null terminated char array as if it's a
536 						formatted string array. Quote marks are determined to be
537 						start and end of strings. If no quote marks are found the
538 						string is delimited by whitespace.
539 	*****************************************************************************/
540 	bool ReadStringToken(char* pszSource, CPVRTString& output, CPVRTString &ErrorStr, int iLine, const char* pCaller);
541 
542 	/*!***************************************************************************
543 	@fn      			ParseHeader
544 	@param[in]			nStartLine		start line number
545 	@param[in]			nEndLine		end line number
546 	@param[out]			pReturnError	error string
547 	@return				true if parse is successful
548 	@brief     		    Parses the HEADER section of the PFX file.
549 	*****************************************************************************/
550 	bool ParseHeader(int nStartLine, int nEndLine, CPVRTString * const pReturnError);
551 
552 	/*!***************************************************************************
553 	@brief     		    Parses the TEXTURES section of the PFX file.
554 						This style is deprecated but remains for backwards
555 						compatibility. ** DEPRECATED **
556 	@param[in]			nStartLine		Start line number
557 	@param[in]			nEndLine		End line number
558 	@param[out]			pReturnError	Error string
559 	@return				true if parse is successful
560 	*****************************************************************************/
561 	bool ParseTextures(int nStartLine, int nEndLine, CPVRTString * const pReturnError);
562 
563 	/*!***************************************************************************
564 	@fn      			ParseTexture
565 	@param[in]			nStartLine		start line number
566 	@param[in]			nEndLine		end line number
567 	@param[out]			pReturnError	error string
568 	@return				true if parse is successful
569 	@brief     		    Parses the TEXTURE section of the PFX file.
570 	*****************************************************************************/
571 	bool ParseTexture(int nStartLine, int nEndLine, CPVRTString * const pReturnError);
572 
573 	/*!***************************************************************************
574 	@fn      			ParseTarget
575 	@param[in]			nStartLine		start line number
576 	@param[in]			nEndLine		end line number
577 	@param[out]			pReturnError	error string
578 	@return				true if parse is successful
579 	@brief     		    Parses the TARGET section of the PFX file.
580 	*****************************************************************************/
581 	bool ParseTarget(int nStartLine, int nEndLine, CPVRTString * const pReturnError);
582 
583 	/*!***************************************************************************
584 	@fn      			ParseGenericSurface
585 	@param[in]			nStartLine		start line number
586 	@param[in]			nEndLine		end line number
587 	@param[out]			Params			Structure containing PFXTexture parameters
588 	@param[out]			KnownCmds		An array of unknown commands for the caller
589 										to check.
590 	@param[in]			pCaller			The caller's description for error messages.
591 	@param[out]			pReturnError	error string
592 	@return				true if parse is successful
593 	@brief     		    Parses generic data from TARGET and TEXTURE blocks. Namely
594 						wrapping and filter commands.
595 	*****************************************************************************/
596 	bool ParseGenericSurface(int nStartLine, int nEndLine, SPVRTPFXParserTexture& Params, CPVRTArray<CPVRTHash>& KnownCmds,
597 							 const char* pCaller, CPVRTString * const pReturnError);
598 
599 	/*!***************************************************************************
600 	@fn      			ParseShader
601 	@param[in]			nStartLine		start line number
602 	@param[in]			nEndLine		end line number
603 	@param[out]			pReturnError	error string
604 	@param[out]			shader			shader data object
605 	@param[in]			pszBlockName	name of block in PFX file
606 	@return				true if parse is successful
607 	@brief     		    Parses the VERTEXSHADER or FRAGMENTSHADER section of the
608 						PFX file.
609 	*****************************************************************************/
610 	bool ParseShader(int nStartLine, int nEndLine, CPVRTString *pReturnError, SPVRTPFXParserShader &shader, const char * const pszBlockName);
611 
612 	/*!***************************************************************************
613 	@fn      			ParseSemantic
614 	@param[out]			semantic		semantic data object
615 	@param[in]			nStartLine		start line number
616 	@param[out]			pReturnError	error string
617 	@return				true if parse is successful
618 	@brief     		    Parses a semantic.
619 	*****************************************************************************/
620 	bool ParseSemantic(SPVRTPFXParserSemantic &semantic, const int nStartLine, CPVRTString * const pReturnError);
621 
622 	/*!***************************************************************************
623 	@fn      			ParseEffect
624 	@param[out]			effect			effect data object
625 	@param[in]			nStartLine		start line number
626 	@param[in]			nEndLine		end line number
627 	@param[out]			pReturnError	error string
628 	@return				true if parse is successful
629 	@brief     		    Parses the EFFECT section of the PFX file.
630 	*****************************************************************************/
631 	bool ParseEffect(SPVRTPFXParserEffect &effect, const int nStartLine, const int nEndLine, CPVRTString * const pReturnError);
632 
633 	/*!***************************************************************************
634 	@fn      		    ParseTextureFlags
635 	@param[in]			c_pszRemainingLine		Pointer to the remaining string
636 	@param[out]			ppFlagsOut				Resultant flags set
637 	@param[in]			uiNumFlags				Number of flags to set
638 	@param[in]			c_ppszFlagNames			Flag names
639 	@param[in]			uiNumFlagNames			Number of flag names
640 	@param[in]			pReturnError			Return error to set
641 	@param[in]			iLineNum				The line number for error reporting
642 	@return			    true if successful
643 	@brief     	        Parses the texture flag sections.
644 	*****************************************************************************/
645 	bool ParseTextureFlags(	const char* c_pszRemainingLine, unsigned int** ppFlagsOut, unsigned int uiNumFlags, const char** c_ppszFlagNames, unsigned int uiNumFlagNames,
646 							CPVRTString * const pReturnError, int iLineNum);
647 	/*!***************************************************************************
648 	 @brief     	Looks through all of the effects in the .pfx and determines
649 					the order of render passes that have been declared with
650 					the RENDER tag (found in [TEXTURES].
651 	 @param[out]	pReturnError
652 	 @return		True if dependency tree is valid. False if there are errors
653 					in the dependency tree (e.g. recursion)
654 	*****************************************************************************/
655 	bool DetermineRenderPassDependencies(CPVRTString * const pReturnError);
656 
657 	/*!***************************************************************************
658 	 @brief     	Recursively look through dependencies until leaf nodes are
659 					encountered. At this point, add a given leaf node to the
660 					aRequiredRenderPasses array and return. Repeat this process
661 					until all dependencies are added to the array.
662 	 @param[in]		aRequiredRenderPasses
663 	 @param[in]		renderPassNode
664 	*****************************************************************************/
665 	void AddRenderPassNodeDependencies(	CPVRTArray<SPVRTPFXRenderPass*> &aRequiredRenderPasses,
666 										CPVRTSkipGraphNode<SPVRTPFXRenderPass*> &renderPassNode);
667 };
668 
669 
670 #endif /* _PVRTPFXPARSER_H_ */
671 
672 /*****************************************************************************
673  End of file (PVRTPFXParser.h)
674 *****************************************************************************/
675 
676