1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4     (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __SCRIPTCOMPILER_H_
30 #define __SCRIPTCOMPILER_H_
31 
32 #include "OgreSharedPtr.h"
33 #include "OgreMaterial.h"
34 #include "OgreHighLevelGpuProgram.h"
35 #include "OgreCompositor.h"
36 #include "OgreCompositionPass.h"
37 #include "OgreAny.h"
38 #include "OgreHeaderPrefix.h"
39 
40 namespace Ogre
41 {
42 	/** \addtogroup Core
43 	*  @{
44 	*/
45 	/** \addtogroup General
46 	*  @{
47 	*/
48 	/** These enums hold the types of the concrete parsed nodes */
49 	enum ConcreteNodeType
50 	{
51 		CNT_VARIABLE,
52 		CNT_VARIABLE_ASSIGN,
53 		CNT_WORD,
54 		CNT_IMPORT,
55 		CNT_QUOTE,
56 		CNT_LBRACE,
57 		CNT_RBRACE,
58 		CNT_COLON
59 	};
60 
61 	/** The ConcreteNode is the struct that holds an un-conditioned sub-tree of parsed input */
62 	struct ConcreteNode;
63 	typedef SharedPtr<ConcreteNode> ConcreteNodePtr;
64 	typedef list<ConcreteNodePtr>::type ConcreteNodeList;
65 	typedef SharedPtr<ConcreteNodeList> ConcreteNodeListPtr;
66 	struct ConcreteNode : public ScriptCompilerAlloc
67 	{
68 		String token, file;
69 		unsigned int line;
70 		ConcreteNodeType type;
71 		ConcreteNodeList children;
72 		ConcreteNode *parent;
73 	};
74 
75 	/** This enum holds the types of the possible abstract nodes */
76 	enum AbstractNodeType
77 	{
78 		ANT_UNKNOWN,
79 		ANT_ATOM,
80 		ANT_OBJECT,
81 		ANT_PROPERTY,
82 		ANT_IMPORT,
83 		ANT_VARIABLE_SET,
84 		ANT_VARIABLE_ACCESS
85 	};
86 	class AbstractNode;
87 	typedef SharedPtr<AbstractNode> AbstractNodePtr;
88 	typedef list<AbstractNodePtr>::type AbstractNodeList;
89 	typedef SharedPtr<AbstractNodeList> AbstractNodeListPtr;
90 
91 	class _OgreExport AbstractNode : public AbstractNodeAlloc
92 	{
93 	public:
94 		String file;
95 		unsigned int line;
96 		AbstractNodeType type;
97 		AbstractNode *parent;
98 		Any context; // A holder for translation context data
99 	public:
100 		AbstractNode(AbstractNode *ptr);
~AbstractNode()101 		virtual ~AbstractNode(){}
102 		/// Returns a new AbstractNode which is a replica of this one.
103 		virtual AbstractNode *clone() const = 0;
104 		/// Returns a string value depending on the type of the AbstractNode.
105 		virtual String getValue() const = 0;
106 	};
107 
108 	/** This is an abstract node which cannot be broken down further */
109 	class _OgreExport AtomAbstractNode : public AbstractNode
110 	{
111 	public:
112 		String value;
113 		uint32 id;
114 	public:
115 		AtomAbstractNode(AbstractNode *ptr);
116 		AbstractNode *clone() const;
117 		String getValue() const;
118 	private:
119 		void parseNumber() const;
120 	};
121 
122 	/** This specific abstract node represents a script object */
123 	class _OgreExport ObjectAbstractNode : public AbstractNode
124 	{
125 	private:
126 		map<String,String>::type mEnv;
127 	public:
128 		String name, cls;
129 		vector<String>::type bases;
130 		uint32 id;
131 		bool abstract;
132 		AbstractNodeList children;
133 		AbstractNodeList values;
134 		AbstractNodeList overrides; // For use when processing object inheritance and overriding
135 	public:
136 		ObjectAbstractNode(AbstractNode *ptr);
137 		AbstractNode *clone() const;
138 		String getValue() const;
139 
140 		void addVariable(const String &name);
141 		void setVariable(const String &name, const String &value);
142 		std::pair<bool,String> getVariable(const String &name) const;
143 		const map<String,String>::type &getVariables() const;
144 	};
145 
146 	/** This abstract node represents a script property */
147 	class _OgreExport PropertyAbstractNode : public AbstractNode
148 	{
149 	public:
150 		String name;
151 		uint32 id;
152 		AbstractNodeList values;
153 	public:
154 		PropertyAbstractNode(AbstractNode *ptr);
155 		AbstractNode *clone() const;
156 		String getValue() const;
157 	};
158 
159 	/** This abstract node represents an import statement */
160 	class _OgreExport ImportAbstractNode : public AbstractNode
161 	{
162 	public:
163 		String target, source;
164 	public:
165 		ImportAbstractNode();
166 		AbstractNode *clone() const;
167 		String getValue() const;
168 	};
169 
170 	/** This abstract node represents a variable assignment */
171 	class _OgreExport VariableAccessAbstractNode : public AbstractNode
172 	{
173 	public:
174 		String name;
175 	public:
176 		VariableAccessAbstractNode(AbstractNode *ptr);
177 		AbstractNode *clone() const;
178 		String getValue() const;
179 	};
180 
181 	class ScriptCompilerEvent;
182 	class ScriptCompilerListener;
183 
184 	/** This is the main class for the compiler. It calls the parser
185 		and processes the CST into an AST and then uses translators
186 		to translate the AST into the final resources.
187 	*/
188 	class _OgreExport ScriptCompiler : public ScriptCompilerAlloc
189 	{
190 	public: // Externally accessible types
191 		//typedef map<String,uint32>::type IdMap;
192 		typedef HashMap<String,uint32> IdMap;
193 
194 		// The container for errors
195 		struct Error : public ScriptCompilerAlloc
196 		{
197 			String file, message;
198 			int line;
199 			uint32 code;
200 		};
201 		typedef SharedPtr<Error> ErrorPtr;
202 		typedef list<ErrorPtr>::type ErrorList;
203 
204 		// These are the built-in error codes
205 		enum{
206 			CE_STRINGEXPECTED,
207 			CE_NUMBEREXPECTED,
208 			CE_FEWERPARAMETERSEXPECTED,
209 			CE_VARIABLEEXPECTED,
210 			CE_UNDEFINEDVARIABLE,
211 			CE_OBJECTNAMEEXPECTED,
212 			CE_OBJECTALLOCATIONERROR,
213 			CE_INVALIDPARAMETERS,
214 			CE_DUPLICATEOVERRIDE,
215 			CE_UNEXPECTEDTOKEN,
216 			CE_OBJECTBASENOTFOUND,
217 			CE_UNSUPPORTEDBYRENDERSYSTEM,
218 			CE_REFERENCETOANONEXISTINGOBJECT
219 		};
220 		static String formatErrorCode(uint32 code);
221 	public:
222 		ScriptCompiler();
~ScriptCompiler()223 		virtual ~ScriptCompiler() {}
224 
225 		/// Takes in a string of script code and compiles it into resources
226 		/**
227 		 * @param str The script code
228 		 * @param source The source of the script code (e.g. a script file)
229 		 * @param group The resource group to place the compiled resources into
230 		 */
231 		bool compile(const String &str, const String &source, const String &group);
232 		/// Compiles resources from the given concrete node list
233 		bool compile(const ConcreteNodeListPtr &nodes, const String &group);
234 		/// Generates the AST from the given string script
235 		AbstractNodeListPtr _generateAST(const String &str, const String &source, bool doImports = false, bool doObjects = false, bool doVariables = false);
236 		/// Compiles the given abstract syntax tree
237 		bool _compile(AbstractNodeListPtr nodes, const String &group, bool doImports = true, bool doObjects = true, bool doVariables = true);
238 		/// Adds the given error to the compiler's list of errors
239 		void addError(uint32 code, const String &file, int line, const String &msg = "");
240 		/// Sets the listener used by the compiler
241 		void setListener(ScriptCompilerListener *listener);
242 		/// Returns the currently set listener
243 		ScriptCompilerListener *getListener();
244 		/// Returns the resource group currently set for this compiler
245 		const String &getResourceGroup() const;
246 		/// Adds a name exclusion to the map
247 		/**
248 		 * Name exclusions identify object types which cannot accept
249 		 * names. This means that excluded types will always have empty names.
250 		 * All values in the object header are stored as object values.
251 		 */
252 		void addNameExclusion(const String &type);
253 		/// Removes a name exclusion
254 		void removeNameExclusion(const String &type);
255 		/// Internal method for firing the handleEvent method
256 		bool _fireEvent(ScriptCompilerEvent *evt, void *retval);
257 	private: // Tree processing
258 		AbstractNodeListPtr convertToAST(const ConcreteNodeListPtr &nodes);
259 		/// This built-in function processes import nodes
260 		void processImports(AbstractNodeListPtr &nodes);
261 		/// Loads the requested script and converts it to an AST
262 		AbstractNodeListPtr loadImportPath(const String &name);
263 		/// Returns the abstract nodes from the given tree which represent the target
264 		AbstractNodeListPtr locateTarget(AbstractNodeList *nodes, const String &target);
265 		/// Handles object inheritance and variable expansion
266 		void processObjects(AbstractNodeList *nodes, const AbstractNodeListPtr &top);
267 		/// Handles processing the variables
268 		void processVariables(AbstractNodeList *nodes);
269 		/// This function overlays the given object on the destination object following inheritance rules
270 		void overlayObject(const AbstractNodePtr &source, ObjectAbstractNode *dest);
271 		/// Returns true if the given class is name excluded
272 		bool isNameExcluded(const String &cls, AbstractNode *parent);
273 		/// This function sets up the initial values in word id map
274 		void initWordMap();
275 	private:
276 		// Resource group
277 		String mGroup;
278 		// The word -> id conversion table
279 		IdMap mIds;
280 		// This is an environment map
281 		typedef map<String,String>::type Environment;
282 		Environment mEnv;
283 
284 		typedef map<String,AbstractNodeListPtr>::type ImportCacheMap;
285 		ImportCacheMap mImports; // The set of imported scripts to avoid circular dependencies
286 		typedef multimap<String,String>::type ImportRequestMap;
287 		ImportRequestMap mImportRequests; // This holds the target objects for each script to be imported
288 
289 		// This stores the imports of the scripts, so they are separated and can be treated specially
290 		AbstractNodeList mImportTable;
291 
292 		// Error list
293 		ErrorList mErrors;
294 
295 		// The listener
296 		ScriptCompilerListener *mListener;
297 	private: // Internal helper classes and processors
298 		class AbstractTreeBuilder
299 		{
300 		private:
301 			AbstractNodeListPtr mNodes;
302 			AbstractNode *mCurrent;
303 			ScriptCompiler *mCompiler;
304 		public:
305 			AbstractTreeBuilder(ScriptCompiler *compiler);
306 			const AbstractNodeListPtr &getResult() const;
307 			void visit(ConcreteNode *node);
308 			static void visit(AbstractTreeBuilder *visitor, const ConcreteNodeList &nodes);
309 		};
310 		friend class AbstractTreeBuilder;
311 	public: // Public translator definitions
312 		// This enum are built-in word id values
313 		enum
314 		{
315 			ID_ON = 1,
316 			ID_OFF = 2,
317 			ID_TRUE = 1,
318 			ID_FALSE = 2,
319 			ID_YES = 1,
320 			ID_NO = 2
321 		};
322 	};
323 
324 	/**
325 	 * This struct is a base class for events which can be thrown by the compilers and caught by
326 	 * subscribers. There are a set number of standard events which are used by Ogre's core.
327 	 * New event types may be derived for more custom compiler processing.
328 	 */
329 	class ScriptCompilerEvent
330 	{
331 	public:
332 		String mType;
333 
ScriptCompilerEvent(const String & type)334 		ScriptCompilerEvent(const String &type):mType(type){}
~ScriptCompilerEvent()335 		virtual ~ScriptCompilerEvent(){}
336 	private: // Non-copyable
337 		ScriptCompilerEvent(const ScriptCompilerEvent&);
338 		ScriptCompilerEvent &operator = (const ScriptCompilerEvent&);
339 	};
340 
341 	/** This is a listener for the compiler. The compiler can be customized with
342 		this listener. It lets you listen in on events occurring during compilation,
343 		hook them, and change the behavior.
344 	*/
345 	class _OgreExport ScriptCompilerListener
346 	{
347 	public:
348 		ScriptCompilerListener();
~ScriptCompilerListener()349 		virtual ~ScriptCompilerListener() {}
350 
351 		/// Returns the concrete node list from the given file
352 		virtual ConcreteNodeListPtr importFile(ScriptCompiler *compiler, const String &name);
353 		/// Allows for responding to and overriding behavior before a CST is translated into an AST
354 		virtual void preConversion(ScriptCompiler *compiler, ConcreteNodeListPtr nodes);
355 		/// Allows vetoing of continued compilation after the entire AST conversion process finishes
356 		/**
357 		 @remarks	Once the script is turned completely into an AST, including import
358 					and override handling, this function allows a listener to exit
359 					the compilation process.
360 		 @return True continues compilation, false aborts
361 		 */
362 		virtual bool postConversion(ScriptCompiler *compiler, const AbstractNodeListPtr&);
363 		/// Called when an error occurred
364 		virtual void handleError(ScriptCompiler *compiler, uint32 code, const String &file, int line, const String &msg);
365 		/// Called when an event occurs during translation, return true if handled
366 		/**
367 		 @remarks	This function is called from the translators when an event occurs that
368 					that can be responded to. Often this is overriding names, or it can be a request for
369 					custom resource creation.
370 		 @arg compiler A reference to the compiler
371 		 @arg evt The event object holding information about the event to be processed
372 		 @arg retval A possible return value from handlers
373 		 @return True if the handler processed the event
374 		*/
375 		virtual bool handleEvent(ScriptCompiler *compiler, ScriptCompilerEvent *evt, void *retval);
376 	};
377 
378 	class ScriptTranslator;
379 	class ScriptTranslatorManager;
380 
381 	/** Manages threaded compilation of scripts. This script loader forwards
382 		scripts compilations to a specific compiler instance.
383 	*/
384 	class _OgreExport ScriptCompilerManager : public Singleton<ScriptCompilerManager>, public ScriptLoader, public ScriptCompilerAlloc
385 	{
386 	private:
387             OGRE_AUTO_MUTEX;
388 
389 		// A list of patterns loaded by this compiler manager
390 		StringVector mScriptPatterns;
391 
392 		// A pointer to the listener used for compiling scripts
393 		ScriptCompilerListener *mListener;
394 
395 		// Stores a map from object types to the translators that handle them
396 		vector<ScriptTranslatorManager*>::type mManagers;
397 
398 		// A pointer to the built-in ScriptTranslatorManager
399 		ScriptTranslatorManager *mBuiltinTranslatorManager;
400 
401 		// A pointer to the specific compiler instance used
402 		OGRE_THREAD_POINTER(ScriptCompiler, mScriptCompiler);
403 	public:
404 		ScriptCompilerManager();
405 		virtual ~ScriptCompilerManager();
406 
407 		/// Sets the listener used for compiler instances
408 		void setListener(ScriptCompilerListener *listener);
409 		/// Returns the currently set listener used for compiler instances
410 		ScriptCompilerListener *getListener();
411 
412 		/// Adds the given translator manager to the list of managers
413 		void addTranslatorManager(ScriptTranslatorManager *man);
414 		/// Removes the given translator manager from the list of managers
415 		void removeTranslatorManager(ScriptTranslatorManager *man);
416 		/// Clears all translator managers
417 		void clearTranslatorManagers();
418 		/// Retrieves a ScriptTranslator from the supported managers
419 		ScriptTranslator *getTranslator(const AbstractNodePtr &node);
420 
421 		/// Adds a script extension that can be handled (e.g. *.material, *.pu, etc.)
422 		void addScriptPattern(const String &pattern);
423 		/// @copydoc ScriptLoader::getScriptPatterns
424         const StringVector& getScriptPatterns(void) const;
425         /// @copydoc ScriptLoader::parseScript
426         void parseScript(DataStreamPtr& stream, const String& groupName);
427         /// @copydoc ScriptLoader::getLoadingOrder
428         Real getLoadingOrder(void) const;
429 
430 		/** Override standard Singleton retrieval.
431         @remarks
432         Why do we do this? Well, it's because the Singleton
433         implementation is in a .h file, which means it gets compiled
434         into anybody who includes it. This is needed for the
435         Singleton template to work, but we actually only want it
436         compiled into the implementation of the class based on the
437         Singleton, not all of them. If we don't change this, we get
438         link errors when trying to use the Singleton-based class from
439         an outside dll.
440         @par
441         This method just delegates to the template version anyway,
442         but the implementation stays in this single compilation unit,
443         preventing link errors.
444         */
445         static ScriptCompilerManager& getSingleton(void);
446         /** Override standard Singleton retrieval.
447         @remarks
448         Why do we do this? Well, it's because the Singleton
449         implementation is in a .h file, which means it gets compiled
450         into anybody who includes it. This is needed for the
451         Singleton template to work, but we actually only want it
452         compiled into the implementation of the class based on the
453         Singleton, not all of them. If we don't change this, we get
454         link errors when trying to use the Singleton-based class from
455         an outside dll.
456         @par
457         This method just delegates to the template version anyway,
458         but the implementation stays in this single compilation unit,
459         preventing link errors.
460         */
461         static ScriptCompilerManager* getSingletonPtr(void);
462 	};
463 
464 	// Standard event types
465 	class _OgreExport PreApplyTextureAliasesScriptCompilerEvent : public ScriptCompilerEvent
466 	{
467 	public:
468 		Material *mMaterial;
469 		AliasTextureNamePairList *mAliases;
470 		static String eventType;
471 
PreApplyTextureAliasesScriptCompilerEvent(Material * material,AliasTextureNamePairList * aliases)472 		PreApplyTextureAliasesScriptCompilerEvent(Material *material, AliasTextureNamePairList *aliases)
473 			:ScriptCompilerEvent(eventType), mMaterial(material), mAliases(aliases){}
474 	};
475 
476 	class _OgreExport ProcessResourceNameScriptCompilerEvent : public ScriptCompilerEvent
477 	{
478 	public:
479 		enum ResourceType
480 		{
481 			TEXTURE,
482 			MATERIAL,
483 			GPU_PROGRAM,
484 			COMPOSITOR
485 		};
486 		ResourceType mResourceType;
487 		String mName;
488 		static String eventType;
489 
ProcessResourceNameScriptCompilerEvent(ResourceType resourceType,const String & name)490 		ProcessResourceNameScriptCompilerEvent(ResourceType resourceType, const String &name)
491 			:ScriptCompilerEvent(eventType), mResourceType(resourceType), mName(name){}
492 	};
493 
494 	class _OgreExport ProcessNameExclusionScriptCompilerEvent : public ScriptCompilerEvent
495 	{
496 	public:
497 		String mClass;
498 		AbstractNode *mParent;
499 		static String eventType;
500 
ProcessNameExclusionScriptCompilerEvent(const String & cls,AbstractNode * parent)501 		ProcessNameExclusionScriptCompilerEvent(const String &cls, AbstractNode *parent)
502 			:ScriptCompilerEvent(eventType), mClass(cls), mParent(parent){}
503 	};
504 
505 	class _OgreExport CreateMaterialScriptCompilerEvent : public ScriptCompilerEvent
506 	{
507 	public:
508 		String mFile, mName, mResourceGroup;
509 		static String eventType;
510 
CreateMaterialScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup)511 		CreateMaterialScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
512 			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}
513 	};
514 
515 	class _OgreExport CreateGpuProgramScriptCompilerEvent : public ScriptCompilerEvent
516 	{
517 	public:
518 		String mFile, mName, mResourceGroup, mSource, mSyntax;
519 		GpuProgramType mProgramType;
520 		static String eventType;
521 
CreateGpuProgramScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup,const String & source,const String & syntax,GpuProgramType programType)522 		CreateGpuProgramScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup, const String &source,
523 			const String &syntax, GpuProgramType programType)
524 			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup), mSource(source),
525 			 mSyntax(syntax), mProgramType(programType)
526 		{}
527 	};
528 
529 	class _OgreExport CreateHighLevelGpuProgramScriptCompilerEvent : public ScriptCompilerEvent
530 	{
531 	public:
532 		String mFile, mName, mResourceGroup, mSource, mLanguage;
533 		GpuProgramType mProgramType;
534 		static String eventType;
535 
CreateHighLevelGpuProgramScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup,const String & source,const String & language,GpuProgramType programType)536 		CreateHighLevelGpuProgramScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup, const String &source,
537 			const String &language, GpuProgramType programType)
538 			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup), mSource(source),
539 			 mLanguage(language), mProgramType(programType)
540 		{}
541 	};
542 
543 	class _OgreExport CreateGpuSharedParametersScriptCompilerEvent : public ScriptCompilerEvent
544 	{
545 	public:
546 		String mFile, mName, mResourceGroup;
547 		static String eventType;
548 
CreateGpuSharedParametersScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup)549 		CreateGpuSharedParametersScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
550 			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}
551 	};
552 
553 	class _OgreExport CreateParticleSystemScriptCompilerEvent : public ScriptCompilerEvent
554 	{
555 	public:
556 		String mFile, mName, mResourceGroup;
557 		static String eventType;
558 
CreateParticleSystemScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup)559 		CreateParticleSystemScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
560 			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}
561 	};
562 
563 	class _OgreExport CreateCompositorScriptCompilerEvent : public ScriptCompilerEvent
564 	{
565 	public:
566 		String mFile, mName, mResourceGroup;
567 		static String eventType;
568 
CreateCompositorScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup)569 		CreateCompositorScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
570 			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}
571 	};
572 
573 	/// This enum defines the integer ids for keywords this compiler handles
574 	enum
575 	{
576 		ID_MATERIAL = 3,
577 		ID_VERTEX_PROGRAM,
578 		ID_GEOMETRY_PROGRAM,
579 		ID_FRAGMENT_PROGRAM,
580 		ID_TECHNIQUE,
581 		ID_PASS,
582 		ID_TEXTURE_UNIT,
583 		ID_VERTEX_PROGRAM_REF,
584 		ID_GEOMETRY_PROGRAM_REF,
585 		ID_FRAGMENT_PROGRAM_REF,
586 		ID_SHADOW_CASTER_VERTEX_PROGRAM_REF,
587 		ID_SHADOW_CASTER_FRAGMENT_PROGRAM_REF,
588 		ID_SHADOW_RECEIVER_VERTEX_PROGRAM_REF,
589 		ID_SHADOW_RECEIVER_FRAGMENT_PROGRAM_REF,
590 		ID_SHADOW_CASTER_MATERIAL,
591 		ID_SHADOW_RECEIVER_MATERIAL,
592 
593         ID_LOD_VALUES,
594         ID_LOD_STRATEGY,
595 		ID_LOD_DISTANCES,
596 		ID_RECEIVE_SHADOWS,
597 		ID_TRANSPARENCY_CASTS_SHADOWS,
598 		ID_SET_TEXTURE_ALIAS,
599 
600 		ID_SOURCE,
601 		ID_SYNTAX,
602 		ID_DEFAULT_PARAMS,
603 		ID_PARAM_INDEXED,
604 		ID_PARAM_NAMED,
605 		ID_PARAM_INDEXED_AUTO,
606 		ID_PARAM_NAMED_AUTO,
607 
608 		ID_SCHEME,
609 		ID_LOD_INDEX,
610 		ID_GPU_VENDOR_RULE,
611 		ID_GPU_DEVICE_RULE,
612 		ID_INCLUDE,
613 		ID_EXCLUDE,
614 
615 		ID_AMBIENT,
616 		ID_DIFFUSE,
617 		ID_SPECULAR,
618 		ID_EMISSIVE,
619 			ID_VERTEXCOLOUR,
620 		ID_SCENE_BLEND,
621 			ID_COLOUR_BLEND,
622 			ID_ONE,
623 			ID_ZERO,
624 			ID_DEST_COLOUR,
625 			ID_SRC_COLOUR,
626 			ID_ONE_MINUS_DEST_COLOUR,
627 			ID_ONE_MINUS_SRC_COLOUR,
628 			ID_DEST_ALPHA,
629 			ID_SRC_ALPHA,
630 			ID_ONE_MINUS_DEST_ALPHA,
631 			ID_ONE_MINUS_SRC_ALPHA,
632 		ID_SEPARATE_SCENE_BLEND,
633 		ID_SCENE_BLEND_OP,
634 			ID_REVERSE_SUBTRACT,
635 			ID_MIN,
636 			ID_MAX,
637 		ID_SEPARATE_SCENE_BLEND_OP,
638 		ID_DEPTH_CHECK,
639 		ID_DEPTH_WRITE,
640 		ID_DEPTH_FUNC,
641 		ID_DEPTH_BIAS,
642 		ID_ITERATION_DEPTH_BIAS,
643 			ID_ALWAYS_FAIL,
644 			ID_ALWAYS_PASS,
645 			ID_LESS_EQUAL,
646 			ID_LESS,
647 			ID_EQUAL,
648 			ID_NOT_EQUAL,
649 			ID_GREATER_EQUAL,
650 			ID_GREATER,
651 		ID_ALPHA_REJECTION,
652 		ID_ALPHA_TO_COVERAGE,
653 		ID_LIGHT_SCISSOR,
654 		ID_LIGHT_CLIP_PLANES,
655 		ID_TRANSPARENT_SORTING,
656 		ID_ILLUMINATION_STAGE,
657 			ID_DECAL,
658 		ID_CULL_HARDWARE,
659 			ID_CLOCKWISE,
660 			ID_ANTICLOCKWISE,
661 		ID_CULL_SOFTWARE,
662 			ID_BACK,
663 			ID_FRONT,
664 		ID_NORMALISE_NORMALS,
665 		ID_LIGHTING,
666 		ID_SHADING,
667 			ID_FLAT,
668 			ID_GOURAUD,
669 			ID_PHONG,
670 		ID_POLYGON_MODE,
671 			ID_SOLID,
672 			ID_WIREFRAME,
673 			ID_POINTS,
674 		ID_POLYGON_MODE_OVERRIDEABLE,
675 		ID_FOG_OVERRIDE,
676 			ID_NONE,
677 			ID_LINEAR,
678 			ID_EXP,
679 			ID_EXP2,
680 		ID_COLOUR_WRITE,
681 		ID_MAX_LIGHTS,
682 		ID_START_LIGHT,
683 		ID_ITERATION,
684 			ID_ONCE,
685 			ID_ONCE_PER_LIGHT,
686 			ID_PER_LIGHT,
687 			ID_PER_N_LIGHTS,
688 			ID_POINT,
689 			ID_SPOT,
690 			ID_DIRECTIONAL,
691 		ID_LIGHT_MASK,
692 		ID_POINT_SIZE,
693 		ID_POINT_SPRITES,
694 		ID_POINT_SIZE_ATTENUATION,
695 		ID_POINT_SIZE_MIN,
696 		ID_POINT_SIZE_MAX,
697 
698 		ID_TEXTURE_ALIAS,
699 		ID_TEXTURE,
700 			ID_1D,
701 			ID_2D,
702 			ID_3D,
703 			ID_CUBIC,
704 			ID_2DARRAY,
705 			ID_UNLIMITED,
706 			ID_ALPHA,
707 			ID_GAMMA,
708 		ID_ANIM_TEXTURE,
709 		ID_CUBIC_TEXTURE,
710 			ID_SEPARATE_UV,
711 			ID_COMBINED_UVW,
712 		ID_TEX_COORD_SET,
713 		ID_TEX_ADDRESS_MODE,
714 			ID_WRAP,
715 			ID_CLAMP,
716 			ID_BORDER,
717 			ID_MIRROR,
718 		ID_TEX_BORDER_COLOUR,
719 		ID_FILTERING,
720 			ID_BILINEAR,
721 			ID_TRILINEAR,
722 			ID_ANISOTROPIC,
723 		ID_CMPTEST,
724 			ID_ON,
725 			ID_OFF,
726 		ID_CMPFUNC,
727 		ID_MAX_ANISOTROPY,
728 		ID_MIPMAP_BIAS,
729 		ID_COLOUR_OP,
730 			ID_REPLACE,
731 			ID_ADD,
732 			ID_MODULATE,
733 			ID_ALPHA_BLEND,
734 		ID_COLOUR_OP_EX,
735 			ID_SOURCE1,
736 			ID_SOURCE2,
737 			ID_MODULATE_X2,
738 			ID_MODULATE_X4,
739 			ID_ADD_SIGNED,
740 			ID_ADD_SMOOTH,
741 			ID_SUBTRACT,
742 			ID_BLEND_DIFFUSE_COLOUR,
743 			ID_BLEND_DIFFUSE_ALPHA,
744 			ID_BLEND_TEXTURE_ALPHA,
745 			ID_BLEND_CURRENT_ALPHA,
746 			ID_BLEND_MANUAL,
747 			ID_DOT_PRODUCT,
748 			ID_SRC_CURRENT,
749 			ID_SRC_TEXTURE,
750 			ID_SRC_DIFFUSE,
751 			ID_SRC_SPECULAR,
752 			ID_SRC_MANUAL,
753 		ID_COLOUR_OP_MULTIPASS_FALLBACK,
754 		ID_ALPHA_OP_EX,
755 		ID_ENV_MAP,
756 			ID_SPHERICAL,
757 			ID_PLANAR,
758 			ID_CUBIC_REFLECTION,
759 			ID_CUBIC_NORMAL,
760 		ID_SCROLL,
761 		ID_SCROLL_ANIM,
762 		ID_ROTATE,
763 		ID_ROTATE_ANIM,
764 		ID_SCALE,
765 		ID_WAVE_XFORM,
766 			ID_SCROLL_X,
767 			ID_SCROLL_Y,
768 			ID_SCALE_X,
769 			ID_SCALE_Y,
770 			ID_SINE,
771 			ID_TRIANGLE,
772 			ID_SQUARE,
773 			ID_SAWTOOTH,
774 			ID_INVERSE_SAWTOOTH,
775 		ID_TRANSFORM,
776 		ID_BINDING_TYPE,
777 			ID_VERTEX,
778 			ID_FRAGMENT,
779 		ID_CONTENT_TYPE,
780 			ID_NAMED,
781 			ID_SHADOW,
782 		ID_TEXTURE_SOURCE,
783 		ID_SHARED_PARAMS,
784 		ID_SHARED_PARAM_NAMED,
785 		ID_SHARED_PARAMS_REF,
786 
787 		ID_PARTICLE_SYSTEM,
788 		ID_EMITTER,
789 		ID_AFFECTOR,
790 
791 		ID_COMPOSITOR,
792 			ID_TARGET,
793 			ID_TARGET_OUTPUT,
794 
795 			ID_INPUT,
796 				ID_PREVIOUS,
797 				ID_TARGET_WIDTH,
798 				ID_TARGET_HEIGHT,
799 				ID_TARGET_WIDTH_SCALED,
800 				ID_TARGET_HEIGHT_SCALED,
801 			ID_COMPOSITOR_LOGIC,
802 			ID_TEXTURE_REF,
803 			ID_SCOPE_LOCAL,
804 			ID_SCOPE_CHAIN,
805 			ID_SCOPE_GLOBAL,
806 			ID_POOLED,
807 			//ID_GAMMA, - already registered for material
808 			ID_NO_FSAA,
809 			ID_DEPTH_POOL,
810 			ID_ONLY_INITIAL,
811 			ID_VISIBILITY_MASK,
812 			ID_LOD_BIAS,
813 			ID_MATERIAL_SCHEME,
814 			ID_SHADOWS_ENABLED,
815 
816 			ID_CLEAR,
817 			ID_STENCIL,
818 			ID_RENDER_SCENE,
819 			ID_RENDER_QUAD,
820 			ID_IDENTIFIER,
821 			ID_FIRST_RENDER_QUEUE,
822 			ID_LAST_RENDER_QUEUE,
823 			ID_QUAD_NORMALS,
824 				ID_CAMERA_FAR_CORNERS_VIEW_SPACE,
825 				ID_CAMERA_FAR_CORNERS_WORLD_SPACE,
826 
827 			ID_BUFFERS,
828 				ID_COLOUR,
829 				ID_DEPTH,
830 			ID_COLOUR_VALUE,
831 			ID_DEPTH_VALUE,
832 			ID_STENCIL_VALUE,
833 
834 			ID_CHECK,
835 			ID_COMP_FUNC,
836 			ID_REF_VALUE,
837 			ID_MASK,
838 			ID_FAIL_OP,
839 				ID_KEEP,
840 				ID_INCREMENT,
841 				ID_DECREMENT,
842 				ID_INCREMENT_WRAP,
843 				ID_DECREMENT_WRAP,
844 				ID_INVERT,
845 			ID_DEPTH_FAIL_OP,
846 			ID_PASS_OP,
847 			ID_TWO_SIDED,
848 #ifdef RTSHADER_SYSTEM_BUILD_CORE_SHADERS
849         ID_RT_SHADER_SYSTEM,
850 #endif
851 		/// Suport for shader model 5.0
852 		// More program IDs
853 		ID_TESSELATION_HULL_PROGRAM,
854 		ID_TESSELATION_DOMAIN_PROGRAM,
855 		ID_COMPUTE_PROGRAM,
856 		ID_TESSELATION_HULL_PROGRAM_REF,
857 		ID_TESSELATION_DOMAIN_PROGRAM_REF,
858 		ID_COMPUTE_PROGRAM_REF,
859 		// More binding IDs
860 		ID_GEOMETRY,
861 		ID_TESSELATION_HULL,
862 		ID_TESSELATION_DOMAIN,
863 		ID_COMPUTE,
864 
865 		// Support for subroutine
866 		ID_SUBROUTINE,
867 
868 		ID_END_BUILTIN_IDS
869 	};
870 	/** @} */
871 	/** @} */
872 }
873 
874 #include "OgreHeaderSuffix.h"
875 
876 #endif
877