Просмотр исходного кода

- Moved all shaders to BSL
- Modified GPU programs and render states so they're saved with the shader instead of being separate resources

Marko Pintera 11 лет назад
Родитель
Сommit
6b920a90d8
59 измененных файлов с 1272 добавлено и 2931 удалено
  1. 0 5
      BansheeCore/BansheeCore.vcxproj
  2. 0 15
      BansheeCore/BansheeCore.vcxproj.filters
  3. 2 2
      BansheeCore/Include/BsBlendState.h
  4. 0 6
      BansheeCore/Include/BsCorePrerequisites.h
  5. 4 3
      BansheeCore/Include/BsDepthStencilState.h
  6. 1 1
      BansheeCore/Include/BsGpuParam.h
  7. 1 1
      BansheeCore/Include/BsGpuParams.h
  8. 4 11
      BansheeCore/Include/BsGpuProgram.h
  9. 0 87
      BansheeCore/Include/BsGpuProgramImportOptions.h
  10. 0 56
      BansheeCore/Include/BsGpuProgramImportOptionsRTTI.h
  11. 0 27
      BansheeCore/Include/BsGpuProgramImporter.h
  12. 1 5
      BansheeCore/Include/BsGpuProgramRTTI.h
  13. 1 1
      BansheeCore/Include/BsMaterial.h
  14. 5 4
      BansheeCore/Include/BsMaterialRTTI.h
  15. 14 50
      BansheeCore/Include/BsPass.h
  16. 27 27
      BansheeCore/Include/BsPassRTTI.h
  17. 4 3
      BansheeCore/Include/BsRasterizerState.h
  18. 4 3
      BansheeCore/Include/BsSamplerState.h
  19. 0 5
      BansheeCore/Include/BsShader.h
  20. 2 4
      BansheeCore/Source/BsBlendState.cpp
  21. 2 4
      BansheeCore/Source/BsDepthStencilState.cpp
  22. 1 7
      BansheeCore/Source/BsGpuParams.cpp
  23. 1 9
      BansheeCore/Source/BsGpuProgram.cpp
  24. 0 24
      BansheeCore/Source/BsGpuProgramImportOptions.cpp
  25. 0 59
      BansheeCore/Source/BsGpuProgramImporter.cpp
  26. 0 2
      BansheeCore/Source/BsImporter.cpp
  27. 6 63
      BansheeCore/Source/BsMaterial.cpp
  28. 18 60
      BansheeCore/Source/BsPass.cpp
  29. 2 4
      BansheeCore/Source/BsRasterizerState.cpp
  30. 2 4
      BansheeCore/Source/BsSamplerState.cpp
  31. 0 49
      BansheeCore/Source/BsShader.cpp
  32. 19 89
      BansheeEditor/Include/BsBuiltinEditorResources.h
  33. 0 10
      BansheeEditor/Include/BsEditorApplication.h
  34. 46 561
      BansheeEditor/Source/BsBuiltinEditorResources.cpp
  35. 10 124
      BansheeEditor/Source/BsEditorApplication.cpp
  36. 1 1
      BansheeEditor/Source/BsScenePicking.cpp
  37. 1 1
      BansheeEditorExec/BsEditorExec.cpp
  38. 0 1
      BansheeEngine/BansheeEngine.vcxproj
  39. 0 3
      BansheeEngine/BansheeEngine.vcxproj.filters
  40. 7 41
      BansheeEngine/Include/BsBuiltinResources.h
  41. 0 37
      BansheeEngine/Include/BsDebugDrawMaterialInfo.h
  42. 1 1
      BansheeEngine/Include/BsGUIMaterialManager.h
  43. 2 1
      BansheeEngine/Source/BsApplication.cpp
  44. 28 238
      BansheeEngine/Source/BsBuiltinResources.cpp
  45. 7 0
      BansheeGLRenderSystem/Source/GLSL/src/BsGLSLGpuProgram.cpp
  46. 7 4
      BansheeRenderer/Source/BsBansheeLitTexRenderableController.cpp
  47. 7 2
      BansheeRenderer/Source/BsBansheeRenderer.cpp
  48. 417 454
      BansheeSL/BsLexerFX.c
  49. 57 57
      BansheeSL/BsLexerFX.l
  50. 434 394
      BansheeSL/BsParserFX.c
  51. 67 22
      BansheeSL/BsParserFX.y
  52. 12 12
      BansheeSL/Include/BsSLFXCompiler.h
  53. 16 16
      BansheeSL/Source/BsSLFXCompiler.cpp
  54. 4 0
      BansheeUtility/Include/BsPath.h
  55. 11 91
      ExampleProject/Main/Main.cpp
  56. 0 59
      MBansheeEditor/ImportOptions.cs
  57. 0 24
      SBansheeEditor/Include/BsScriptImportOptions.h
  58. 0 87
      SBansheeEditor/Source/BsScriptImportOptions.cpp
  59. 16 0
      TODO.txt

+ 0 - 5
BansheeCore/BansheeCore.vcxproj

@@ -342,9 +342,6 @@
     <ClInclude Include="Include\BsGpuParams.h" />
     <ClInclude Include="Include\BsGpuProgInclude.h" />
     <ClInclude Include="Include\BsGpuProgram.h" />
-    <ClInclude Include="Include\BsGpuProgramImporter.h" />
-    <ClInclude Include="Include\BsGpuProgramImportOptions.h" />
-    <ClInclude Include="Include\BsGpuProgramImportOptionsRTTI.h" />
     <ClInclude Include="Include\BsGpuProgramRTTI.h" />
     <ClInclude Include="Include\BsHardwareBuffer.h" />
     <ClInclude Include="Include\BsHardwareBufferManager.h" />
@@ -457,8 +454,6 @@
     <ClCompile Include="Source\BsProfilerGPU.cpp" />
     <ClCompile Include="Source\BsGpuProgInclude.cpp" />
     <ClCompile Include="Source\BsGpuProgram.cpp" />
-    <ClCompile Include="Source\BsGpuProgramImporter.cpp" />
-    <ClCompile Include="Source\BsGpuProgramImportOptions.cpp" />
     <ClCompile Include="Source\BsGpuResourceData.cpp" />
     <ClCompile Include="Source\BsHardwareBufferManager.cpp" />
     <ClCompile Include="Source\BsGpuParam.cpp" />

+ 0 - 15
BansheeCore/BansheeCore.vcxproj.filters

@@ -161,9 +161,6 @@
     <ClInclude Include="Include\BsGameObjectRTTI.h">
       <Filter>Header Files\RTTI</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsGpuProgramImportOptionsRTTI.h">
-      <Filter>Header Files\RTTI</Filter>
-    </ClInclude>
     <ClInclude Include="Include\BsGpuProgramRTTI.h">
       <Filter>Header Files\RTTI</Filter>
     </ClInclude>
@@ -425,12 +422,6 @@
     <ClInclude Include="Include\BsImporter.h">
       <Filter>Header Files\Importer</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsGpuProgramImportOptions.h">
-      <Filter>Header Files\Importer</Filter>
-    </ClInclude>
-    <ClInclude Include="Include\BsGpuProgramImporter.h">
-      <Filter>Header Files\Importer</Filter>
-    </ClInclude>
     <ClInclude Include="Include\BsGpuProgIncludeImporter.h">
       <Filter>Header Files\Importer</Filter>
     </ClInclude>
@@ -748,12 +739,6 @@
     <ClCompile Include="Source\BsGpuProgIncludeImporter.cpp">
       <Filter>Source Files\Importer</Filter>
     </ClCompile>
-    <ClCompile Include="Source\BsGpuProgramImporter.cpp">
-      <Filter>Source Files\Importer</Filter>
-    </ClCompile>
-    <ClCompile Include="Source\BsGpuProgramImportOptions.cpp">
-      <Filter>Source Files\Importer</Filter>
-    </ClCompile>
     <ClCompile Include="Source\BsImporter.cpp">
       <Filter>Source Files\Importer</Filter>
     </ClCompile>

+ 2 - 2
BansheeCore/Include/BsBlendState.h

@@ -178,7 +178,7 @@ namespace BansheeEngine
 	 * 			
 	 * @note	Blend states are immutable. Sim thread only.
 	 */
-	class BS_CORE_EXPORT BlendState : public Resource
+	class BS_CORE_EXPORT BlendState : public IReflectable, public CoreObject
 	{
 	public:
 		virtual ~BlendState() {}
@@ -197,7 +197,7 @@ namespace BansheeEngine
 		/**
 		 * @brief	Creates a new blend state using the specified blend state description structure.
 		 */
-		static HBlendState create(const BLEND_STATE_DESC& desc);
+		static BlendStatePtr create(const BLEND_STATE_DESC& desc);
 
 		/**
 		 * @brief	Returns the default blend state that you may use

+ 0 - 6
BansheeCore/Include/BsCorePrerequisites.h

@@ -304,7 +304,6 @@ namespace BansheeEngine
 		TID_SHADER_OBJECT_PARAM_DESC = 1036,
 		TID_SHADER_PARAM_BLOCK_DESC = 1047,
 		TID_ImportOptions = 1048,
-		TID_GpuProgramImportOptions = 1049,
 		TID_MaterialParamStruct = 1050,
 		TID_Font = 1051,
 		TID_FONT_DESC = 1052,
@@ -341,12 +340,7 @@ namespace BansheeEngine
 	typedef ResourceHandle<Resource> HResource;
 	typedef ResourceHandle<Texture> HTexture;
 	typedef ResourceHandle<Mesh> HMesh;
-	typedef ResourceHandle<GpuProgram> HGpuProgram;
 	typedef ResourceHandle<Material> HMaterial;
-	typedef ResourceHandle<SamplerState> HSamplerState;
-	typedef ResourceHandle<RasterizerState> HRasterizerState;
-	typedef ResourceHandle<DepthStencilState> HDepthStencilState;
-	typedef ResourceHandle<BlendState> HBlendState;
 	typedef ResourceHandle<GpuProgInclude> HGpuProgInclude;
 	typedef ResourceHandle<Font> HFont;
 	typedef ResourceHandle<Shader> HShader;

+ 4 - 3
BansheeCore/Include/BsDepthStencilState.h

@@ -1,7 +1,8 @@
 #pragma once
 
 #include "BsCorePrerequisites.h"
-#include "BsResource.h"
+#include "BsIReflectable.h"
+#include "BsCoreObject.h"
 
 namespace BansheeEngine
 {
@@ -183,7 +184,7 @@ namespace BansheeEngine
 	 *
 	 * @note	Depth stencil states are immutable. Sim thread only.
 	 */
-	class BS_CORE_EXPORT DepthStencilState : public Resource
+	class BS_CORE_EXPORT DepthStencilState : public IReflectable, public CoreObject
 	{
 	public:
 		virtual ~DepthStencilState() {}
@@ -202,7 +203,7 @@ namespace BansheeEngine
 		/**
 		 * @brief	Creates a new depth stencil state using the specified depth stencil state description structure.
 		 */
-		static HDepthStencilState create(const DEPTH_STENCIL_STATE_DESC& desc);
+		static DepthStencilStatePtr create(const DEPTH_STENCIL_STATE_DESC& desc);
 
 		/**
 		 * @brief	Returns the default depth stencil state that you may use when no other is available.

+ 1 - 1
BansheeCore/Include/BsGpuParam.h

@@ -19,7 +19,7 @@ namespace BansheeEngine
 	template<> struct TGpuParamTextureType < true > { typedef SPtr<TextureCore> Type; };
 
 	template<bool Core> struct TGpuParamSamplerStateType { };
-	template<> struct TGpuParamSamplerStateType < false > { typedef HSamplerState Type; };
+	template<> struct TGpuParamSamplerStateType < false > { typedef SamplerStatePtr Type; };
 	template<> struct TGpuParamSamplerStateType < true > { typedef SPtr<SamplerStateCore> Type; };
 
 	/**

+ 1 - 1
BansheeCore/Include/BsGpuParams.h

@@ -153,7 +153,7 @@ namespace BansheeEngine
 		{ 
 			typedef GpuParams GpuParamsType; 
 			typedef HTexture TextureType;
-			typedef HSamplerState SamplerType;
+			typedef SamplerStatePtr SamplerType;
 			typedef SPtr<GpuParamBlockBuffer> ParamsBufferType;
 		};
 

+ 4 - 11
BansheeCore/Include/BsGpuProgram.h

@@ -2,7 +2,8 @@
 
 #include "BsCorePrerequisites.h"
 #include "BsDrawOps.h"
-#include "BsResource.h"
+#include "BsCoreObject.h"
+#include "BsIReflectable.h"
 #include "BsGpuParamDesc.h"
 
 namespace BansheeEngine 
@@ -189,7 +190,7 @@ namespace BansheeEngine
 	 *
 	 * @note	Sim thread only.
 	 */
-	class BS_CORE_EXPORT GpuProgram : public Resource
+	class BS_CORE_EXPORT GpuProgram : public IReflectable, public CoreObject
 	{
 	public:
 		virtual ~GpuProgram() { }
@@ -247,15 +248,7 @@ namespace BansheeEngine
 		 * @param	includes	Optional includes to append to the source before compiling.
 		 * @param	requiresAdjacency	If true then adjacency information will be provided when rendering using this program.
 		 */
-		static HGpuProgram create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype,
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes = nullptr, bool requiresAdjacency = false);
-
-		/**
-		 * @copydoc	create
-		 *
-		 * @note	Internal method. For normal use call "create".
-		 */
-		static GpuProgramPtr _createPtr(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, 
+		static GpuProgramPtr create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype,
 			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes = nullptr, bool requiresAdjacency = false);
 
 	protected:

+ 0 - 87
BansheeCore/Include/BsGpuProgramImportOptions.h

@@ -1,87 +0,0 @@
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "BsImportOptions.h"
-#include "BsGpuProgram.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Contains import options you may use to control how is a GPU program (i.e. shader)
-	 * 			file imported.
-	 */
-	class BS_CORE_EXPORT GpuProgramImportOptions : public ImportOptions
-	{
-	public:
-		GpuProgramImportOptions();
-
-		/**
-		 * @brief	Sets the name of the GPU program entry point method (e.g. "main").
-		 */
-		void setEntryPoint(const String& entryPoint) { mEntryPoint = entryPoint; }
-
-		/**
-		 * @brief	Sets the language the GPU program is written in (e.g. HLSL9, GLSL, HLSL11).
-		 */
-		void setLanguage(const String& language) { mLanguage = language; }
-
-		/**
-		 * @brief	Sets GPU program profile. Determines minimal feature-set the GPU program
-		 * 			requires in order to function.
-		 */
-		void setProfile(GpuProgramProfile profile) { mProfile = profile; }
-
-		/**
-		 * @brief	Sets GPU program type (e.g. vertex, pixel, etc.).
-		 */
-		void setType(GpuProgramType type) { mType = type; }
-
-		/**
-		 * @brief	Sets optional GPU program include files which may be used
-		 * 			for sharing code across multiple programs.
-		 */
-		void setIncludes(const Vector<HGpuProgInclude>& includes) { mIncludes = includes; }
-
-		/**
-		 * @brief	Gets the name of the GPU program entry point method (e.g. "main").
-		 */
-		const String& getEntryPoint() const { return mEntryPoint; }
-
-		/**
-		 * @brief	Gets the language the GPU program is written in (e.g. HLSL9, GLSL, HLSL11).
-		 */
-		const String& getLanguage() const { return mLanguage; }
-
-		/**
-		 * @brief	Gets GPU program profile. Determines minimal feature-set the GPU program
-		 * 			requires in order to function.
-		 */
-		GpuProgramProfile getProfile() const { return mProfile; }
-
-		/**
-		 * @brief	Gets GPU program type (e.g. vertex, pixel, etc.).
-		 */
-		GpuProgramType getType() const { return mType; }
-
-		/**
-		 * @brief	Gets optional GPU program include files which may be used
-		 * 			for sharing code across multiple programs.
-		 */
-		const Vector<HGpuProgInclude>& getIncludes() const { return mIncludes; }
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class GpuProgramImportOptionsRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
-
-	private:
-		String mEntryPoint;
-		String mLanguage;
-		GpuProgramProfile mProfile;
-		GpuProgramType mType;
-		Vector<HGpuProgInclude> mIncludes;
-	};
-}

+ 0 - 56
BansheeCore/Include/BsGpuProgramImportOptionsRTTI.h

@@ -1,56 +0,0 @@
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsGpuProgramImportOptions.h"
-
-namespace BansheeEngine
-{
-	class BS_CORE_EXPORT GpuProgramImportOptionsRTTI : public RTTIType<GpuProgramImportOptions, ImportOptions, GpuProgramImportOptionsRTTI>
-	{
-	private:
-		String& getEntryPoint(GpuProgramImportOptions* obj) { return obj->mEntryPoint; }
-		void setEntryPoint(GpuProgramImportOptions* obj, String& value) { obj->mEntryPoint = value; }
-
-		String& getLanguage(GpuProgramImportOptions* obj) { return obj->mLanguage; }
-		void setLanguage(GpuProgramImportOptions* obj, String& value) { obj->mLanguage = value; }
-
-		GpuProgramProfile& getProfile(GpuProgramImportOptions* obj) { return obj->mProfile; }
-		void setProfile(GpuProgramImportOptions* obj, GpuProgramProfile& value) { obj->mProfile = value; }
-
-		GpuProgramType& getType(GpuProgramImportOptions* obj) { return obj->mType; }
-		void setType(GpuProgramImportOptions* obj, GpuProgramType& value) { obj->mType = value; }
-
-		HGpuProgInclude& getInclude(GpuProgramImportOptions* obj, UINT32 arrIdx) { return obj->mIncludes[arrIdx]; }
-		void setInclude(GpuProgramImportOptions* obj, UINT32 arrIdx, HGpuProgInclude& value) { obj->mIncludes[arrIdx] = value; }
-		UINT32 getNumIncludes(GpuProgramImportOptions* obj) { return (UINT32)obj->mIncludes.size(); }
-		void setNumIncludes(GpuProgramImportOptions* obj, UINT32 num) { obj->mIncludes.clear(); obj->mIncludes.resize(num); }
-
-	public:
-		GpuProgramImportOptionsRTTI()
-		{
-			addPlainField("mEntryPoint", 0, &GpuProgramImportOptionsRTTI::getEntryPoint, &GpuProgramImportOptionsRTTI::setEntryPoint);
-			addPlainField("mLanguage", 1, &GpuProgramImportOptionsRTTI::getLanguage, &GpuProgramImportOptionsRTTI::setLanguage);
-			addPlainField("mProfile", 2, &GpuProgramImportOptionsRTTI::getProfile, &GpuProgramImportOptionsRTTI::setProfile);
-			addPlainField("mType", 3, &GpuProgramImportOptionsRTTI::getType, &GpuProgramImportOptionsRTTI::setType);
-			addReflectableArrayField("mIncludes", 4, &GpuProgramImportOptionsRTTI::getInclude, &GpuProgramImportOptionsRTTI::getNumIncludes, 
-				&GpuProgramImportOptionsRTTI::setInclude, &GpuProgramImportOptionsRTTI::setNumIncludes);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "GpuProgramImportOptions";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_GpuProgramImportOptions;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return bs_shared_ptr<GpuProgramImportOptions, PoolAlloc>();
-		}
-	};
-}

+ 0 - 27
BansheeCore/Include/BsGpuProgramImporter.h

@@ -1,27 +0,0 @@
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "BsSpecificImporter.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Importer for GPU programs (i.e. shaders). File must end with ".gpuprog" extension,
-	 * 			and actual type of the program is determined via import options.
-	 */
-	class BS_CORE_EXPORT GpuProgramImporter : public SpecificImporter
-	{
-	public:
-		/** @copydoc SpecificImporter::isExtensionSupported */
-		virtual bool isExtensionSupported(const WString& ext) const;
-
-		/** @copydoc SpecificImporter::isMagicNumberSupported */
-		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
-
-		/** @copydoc SpecificImporter::import */
-		virtual ResourcePtr import(const Path& filePath, ConstImportOptionsPtr importOptions);
-
-		/** @copydoc SpecificImporter::createImportOptions */
-		virtual ImportOptionsPtr createImportOptions() const;
-	};
-}

+ 1 - 5
BansheeCore/Include/BsGpuProgramRTTI.h

@@ -6,12 +6,9 @@
 
 namespace BansheeEngine
 {
-	class BS_CORE_EXPORT GpuProgramRTTI : public RTTIType<GpuProgram, Resource, GpuProgramRTTI>
+	class BS_CORE_EXPORT GpuProgramRTTI : public RTTIType<GpuProgram, IReflectable, GpuProgramRTTI>
 	{
 	private:
-		UINT32& getSize(GpuProgram* obj) { return obj->mSize; }
-		void setSize(GpuProgram* obj, UINT32& val) { obj->mSize = val; }
-
 		GpuProgramType& getType(GpuProgram* obj) { return obj->mProperties.mType; }
 		void setType(GpuProgram* obj, GpuProgramType& val) { obj->mProperties.mType = val; }
 
@@ -33,7 +30,6 @@ namespace BansheeEngine
 	public:
 		GpuProgramRTTI()
 		{
-			addPlainField("mSize", 0, &GpuProgramRTTI::getSize, &GpuProgramRTTI::setSize);
 			addPlainField("mType", 2, &GpuProgramRTTI::getType, &GpuProgramRTTI::setType);
 			addPlainField("mNeedsAdjacencyInfo", 3, &GpuProgramRTTI::getNeedsAjdInfo, &GpuProgramRTTI::setNeedsAjdInfo);
 			addPlainField("mEntryPoint", 4, &GpuProgramRTTI::getEntryPoint, &GpuProgramRTTI::setEntryPoint);

+ 1 - 1
BansheeCore/Include/BsMaterial.h

@@ -65,7 +65,7 @@ namespace BansheeEngine
 	template<> struct TGpuParamBlockBufferPtrType<true> { typedef SPtr<GpuParamBlockBufferCore> Type; };
 
 	template<bool Core> struct TGpuProgramType { };
-	template<> struct TGpuProgramType<false> { typedef HGpuProgram Type; };
+	template<> struct TGpuProgramType<false> { typedef GpuProgramPtr Type; };
 	template<> struct TGpuProgramType<true> { typedef SPtr<GpuProgramCore> Type; };
 
 	typedef TPassParameters<false> PassParameters;

+ 5 - 4
BansheeCore/Include/BsMaterialRTTI.h

@@ -10,6 +10,7 @@
 #include "BsMaterial.h"
 #include "BsGpuParams.h"
 #include "BsShader.h"
+#include "BsSamplerState.h"
 #include "BsDebug.h"
 #include "BsException.h"
 
@@ -119,7 +120,7 @@ namespace BansheeEngine
 	{
 	public:
 		String name;
-		HSamplerState value;
+		SamplerStatePtr value;
 
 		friend class MaterialSamplerStateParamRTTI;
 		static RTTITypeBase* getRTTIStatic();
@@ -424,13 +425,13 @@ namespace BansheeEngine
 		String& getName(MaterialSamplerStateParam* obj) { return obj->name; }
 		void setName(MaterialSamplerStateParam* obj, String& name) { obj->name = name; }
 
-		HSamplerState& getValue(MaterialSamplerStateParam* obj) { return obj->value; }
-		void setValue(MaterialSamplerStateParam* obj, HSamplerState& value) { obj->value = value; }
+		SamplerStatePtr getValue(MaterialSamplerStateParam* obj) { return obj->value; }
+		void setValue(MaterialSamplerStateParam* obj, SamplerStatePtr value) { obj->value = value; }
 
 		MaterialSamplerStateParamRTTI()
 		{
 			addPlainField("name", 0, &MaterialSamplerStateParamRTTI::getName, &MaterialSamplerStateParamRTTI::setName);
-			addReflectableField("value", 1, &MaterialSamplerStateParamRTTI::getValue, &MaterialSamplerStateParamRTTI::setValue);
+			addReflectablePtrField("value", 1, &MaterialSamplerStateParamRTTI::getValue, &MaterialSamplerStateParamRTTI::setValue);
 		}
 
 		virtual const String& getRTTIName()

+ 14 - 50
BansheeCore/Include/BsPass.h

@@ -4,7 +4,6 @@
 #include "BsColor.h"
 #include "BsIReflectable.h"
 #include "BsCoreObject.h"
-#include "BsIResourceListener.h"
 
 namespace BansheeEngine
 {
@@ -13,17 +12,17 @@ namespace BansheeEngine
 	 */
 	struct PASS_DESC
 	{
-		HBlendState blendState;
-		HRasterizerState rasterizerState;
-		HDepthStencilState depthStencilState;
+		BlendStatePtr blendState;
+		RasterizerStatePtr rasterizerState;
+		DepthStencilStatePtr depthStencilState;
 		UINT32 stencilRefValue;
 
-		HGpuProgram vertexProgram;
-		HGpuProgram fragmentProgram;
-		HGpuProgram geometryProgram;
-		HGpuProgram hullProgram;
-		HGpuProgram domainProgram;
-		HGpuProgram computeProgram;
+		GpuProgramPtr vertexProgram;
+		GpuProgramPtr fragmentProgram;
+		GpuProgramPtr geometryProgram;
+		GpuProgramPtr hullProgram;
+		GpuProgramPtr domainProgram;
+		GpuProgramPtr computeProgram;
 	};
 
 	/**
@@ -56,10 +55,10 @@ namespace BansheeEngine
 	template<>
 	struct TPassTypes < false >
 	{
-		typedef HBlendState BlendStateType;
-		typedef HRasterizerState RasterizerStateType;
-		typedef HDepthStencilState DepthStencilStateType;
-		typedef HGpuProgram GpuProgramType;
+		typedef BlendStatePtr BlendStateType;
+		typedef RasterizerStatePtr RasterizerStateType;
+		typedef DepthStencilStatePtr DepthStencilStateType;
+		typedef GpuProgramPtr GpuProgramType;
 		typedef PASS_DESC PassDescType;
 	};
 
@@ -127,11 +126,6 @@ namespace BansheeEngine
 		TPass();
 		TPass(const PassDescType& desc);
 
-		/**
-		 * @copydoc	IResourceListener::markResourcesDirty
-		 */
-		virtual void _markResourcesDirty() { }
-
 		PassDescType mData;
     };
 
@@ -168,7 +162,7 @@ namespace BansheeEngine
 	 *
 	 * @note	Sim thread.
 	 */
-	class BS_CORE_EXPORT Pass : public IReflectable, public CoreObject, public TPass<false>, public IResourceListener
+	class BS_CORE_EXPORT Pass : public IReflectable, public CoreObject, public TPass<false>
     {
     public:
 		virtual ~Pass() { }
@@ -195,31 +189,6 @@ namespace BansheeEngine
 		 */
 		CoreSyncData syncToCore(FrameAlloc* allocator);
 
-		/**
-		 * @copydoc	IResourceListener::markResourcesDirty
-		 */
-		void _markResourcesDirty();
-
-		/**
-		* @copydoc	IResourceListener::getResourceDependencies
-		*/
-		void getListenerResources(Vector<HResource>& resources);
-
-		/**
-		* @copydoc IResourceListener::notifyResourceLoaded
-		*/
-		void notifyResourceLoaded(const HResource& resource) { markCoreDirty(); }
-
-		/**
-		* @copydoc IResourceListener::notifyResourceDestroyed
-		*/
-		void notifyResourceDestroyed(const HResource& resource) { markCoreDirty(); }
-
-		/**
-		* @copydoc IResourceListener::notifyResourceChanged
-		*/
-		void notifyResourceChanged(const HResource& resource) { markCoreDirty(); }
-
 		/**
 		 * @copydoc	CoreObject::createCore
 		 */
@@ -230,11 +199,6 @@ namespace BansheeEngine
 		 */
 		void getCoreDependencies(Vector<SPtr<CoreObject>>& dependencies);
 
-		/**
-		 * @copydoc	CoreObject::initialize
-		 */
-		virtual void initialize();
-
 		/**
 		 * @brief	Creates a new empty pass but doesn't initialize it.
 		 */

+ 27 - 27
BansheeCore/Include/BsPassRTTI.h

@@ -9,45 +9,45 @@ namespace BansheeEngine
 	class BS_CORE_EXPORT PassRTTI : public RTTIType<Pass, IReflectable, PassRTTI>
 	{
 	private:
-		HBlendState& getBlendState(Pass* obj) { return obj->mData.blendState; }
-		void setBlendState(Pass* obj, HBlendState& val) { obj->mData.blendState = val; }
+		BlendStatePtr getBlendState(Pass* obj) { return obj->mData.blendState; }
+		void setBlendState(Pass* obj, BlendStatePtr val) { obj->mData.blendState = val; }
 
-		HRasterizerState& getRasterizerState(Pass* obj) { return obj->mData.rasterizerState; }
-		void setRasterizerState(Pass* obj, HRasterizerState& val) { obj->mData.rasterizerState = val; }
+		RasterizerStatePtr getRasterizerState(Pass* obj) { return obj->mData.rasterizerState; }
+		void setRasterizerState(Pass* obj, RasterizerStatePtr val) { obj->mData.rasterizerState = val; }
 
-		HDepthStencilState& getDepthStencilState(Pass* obj) { return obj->mData.depthStencilState; }
-		void setDepthStencilState(Pass* obj, HDepthStencilState& val) { obj->mData.depthStencilState = val; }
+		DepthStencilStatePtr getDepthStencilState(Pass* obj) { return obj->mData.depthStencilState; }
+		void setDepthStencilState(Pass* obj, DepthStencilStatePtr val) { obj->mData.depthStencilState = val; }
 
-		HGpuProgram& getVertexProgram(Pass* obj) { return obj->mData.vertexProgram; }
-		void setVertexProgram(Pass* obj, HGpuProgram& val) { obj->mData.vertexProgram = val; }
+		GpuProgramPtr getVertexProgram(Pass* obj) { return obj->mData.vertexProgram; }
+		void setVertexProgram(Pass* obj, GpuProgramPtr val) { obj->mData.vertexProgram = val; }
 
-		HGpuProgram& getFragmentProgram(Pass* obj) { return obj->mData.fragmentProgram; }
-		void setFragmentProgram(Pass* obj, HGpuProgram& val) { obj->mData.fragmentProgram = val; }
+		GpuProgramPtr getFragmentProgram(Pass* obj) { return obj->mData.fragmentProgram; }
+		void setFragmentProgram(Pass* obj, GpuProgramPtr val) { obj->mData.fragmentProgram = val; }
 
-		HGpuProgram& getGeometryProgram(Pass* obj) { return obj->mData.geometryProgram; }
-		void setGeometryProgram(Pass* obj, HGpuProgram& val) { obj->mData.geometryProgram = val; }
+		GpuProgramPtr getGeometryProgram(Pass* obj) { return obj->mData.geometryProgram; }
+		void setGeometryProgram(Pass* obj, GpuProgramPtr val) { obj->mData.geometryProgram = val; }
 
-		HGpuProgram& getHullProgram(Pass* obj) { return obj->mData.hullProgram; }
-		void setHullProgram(Pass* obj, HGpuProgram& val) { obj->mData.hullProgram = val; }
+		GpuProgramPtr getHullProgram(Pass* obj) { return obj->mData.hullProgram; }
+		void setHullProgram(Pass* obj, GpuProgramPtr val) { obj->mData.hullProgram = val; }
 
-		HGpuProgram& getDomainProgram(Pass* obj) { return obj->mData.domainProgram; }
-		void setDomainProgram(Pass* obj, HGpuProgram& val) { obj->mData.domainProgram = val; }
+		GpuProgramPtr getDomainProgram(Pass* obj) { return obj->mData.domainProgram; }
+		void setDomainProgram(Pass* obj, GpuProgramPtr val) { obj->mData.domainProgram = val; }
 
-		HGpuProgram& getComputeProgram(Pass* obj) { return obj->mData.computeProgram; }
-		void setComputeProgram(Pass* obj, HGpuProgram& val) { obj->mData.computeProgram = val; }
+		GpuProgramPtr getComputeProgram(Pass* obj) { return obj->mData.computeProgram; }
+		void setComputeProgram(Pass* obj, GpuProgramPtr val) { obj->mData.computeProgram = val; }
 	public:
 		PassRTTI()
 		{
-			addReflectableField("mBlendState", 0, &PassRTTI::getBlendState, &PassRTTI::setBlendState);
-			addReflectableField("mRasterizerState", 1, &PassRTTI::getRasterizerState, &PassRTTI::setRasterizerState);
-			addReflectableField("mDepthStencilState", 2, &PassRTTI::getDepthStencilState, &PassRTTI::setDepthStencilState);
+			addReflectablePtrField("mBlendState", 0, &PassRTTI::getBlendState, &PassRTTI::setBlendState);
+			addReflectablePtrField("mRasterizerState", 1, &PassRTTI::getRasterizerState, &PassRTTI::setRasterizerState);
+			addReflectablePtrField("mDepthStencilState", 2, &PassRTTI::getDepthStencilState, &PassRTTI::setDepthStencilState);
 
-			addReflectableField("mVertexProgram", 3, &PassRTTI::getVertexProgram, &PassRTTI::setVertexProgram);
-			addReflectableField("mFragmentProgram", 4, &PassRTTI::getFragmentProgram, &PassRTTI::setFragmentProgram);
-			addReflectableField("mGeometryProgram", 5, &PassRTTI::getGeometryProgram, &PassRTTI::setGeometryProgram);
-			addReflectableField("mHullProgram", 6, &PassRTTI::getHullProgram, &PassRTTI::setHullProgram);
-			addReflectableField("mDomainProgram", 7, &PassRTTI::getDomainProgram, &PassRTTI::setDomainProgram);
-			addReflectableField("mComputeProgram", 8, &PassRTTI::getComputeProgram, &PassRTTI::setComputeProgram);
+			addReflectablePtrField("mVertexProgram", 3, &PassRTTI::getVertexProgram, &PassRTTI::setVertexProgram);
+			addReflectablePtrField("mFragmentProgram", 4, &PassRTTI::getFragmentProgram, &PassRTTI::setFragmentProgram);
+			addReflectablePtrField("mGeometryProgram", 5, &PassRTTI::getGeometryProgram, &PassRTTI::setGeometryProgram);
+			addReflectablePtrField("mHullProgram", 6, &PassRTTI::getHullProgram, &PassRTTI::setHullProgram);
+			addReflectablePtrField("mDomainProgram", 7, &PassRTTI::getDomainProgram, &PassRTTI::setDomainProgram);
+			addReflectablePtrField("mComputeProgram", 8, &PassRTTI::getComputeProgram, &PassRTTI::setComputeProgram);
 		}
 
 		virtual void onDeserializationEnded(IReflectable* obj)

+ 4 - 3
BansheeCore/Include/BsRasterizerState.h

@@ -1,7 +1,8 @@
 #pragma once
 
 #include "BsCorePrerequisites.h"
-#include "BsResource.h"
+#include "BsIReflectable.h"
+#include "BsCoreObject.h"
 
 namespace BansheeEngine
 {
@@ -157,7 +158,7 @@ namespace BansheeEngine
 	 *
 	 * @note	Rasterizer states are immutable. Sim thread only.
 	 */
-	class BS_CORE_EXPORT RasterizerState : public Resource
+	class BS_CORE_EXPORT RasterizerState : public IReflectable, public CoreObject
 	{
 	public:
 		virtual ~RasterizerState() {}
@@ -176,7 +177,7 @@ namespace BansheeEngine
 		/**
 		 * @brief	Creates a new rasterizer state using the specified rasterizer state descriptor structure.
 		 */
-		static HRasterizerState create(const RASTERIZER_STATE_DESC& desc);
+		static RasterizerStatePtr create(const RASTERIZER_STATE_DESC& desc);
 
 		/**
 		 * @brief	Returns the default rasterizer state.

+ 4 - 3
BansheeCore/Include/BsSamplerState.h

@@ -5,7 +5,8 @@
 #include "BsPixelUtil.h"
 #include "BsTexture.h"
 #include "BsColor.h"
-#include "BsResource.h"
+#include "BsIReflectable.h"
+#include "BsCoreObject.h"
 
 namespace BansheeEngine 
 {
@@ -132,7 +133,7 @@ namespace BansheeEngine
 	 *
 	 *			Sim thread.
 	 */
-	class BS_CORE_EXPORT SamplerState : public Resource
+	class BS_CORE_EXPORT SamplerState : public IReflectable, public CoreObject
     {
     public:
 		virtual ~SamplerState() {}
@@ -151,7 +152,7 @@ namespace BansheeEngine
 		/**
 		 * @brief	Creates a new sampler state using the provided descriptor structure.
 		 */
-		static HSamplerState create(const SAMPLER_STATE_DESC& desc);
+		static SamplerStatePtr create(const SAMPLER_STATE_DESC& desc);
 
 		/**
 		 * @brief	Returns the default sampler state.

+ 0 - 5
BansheeCore/Include/BsShader.h

@@ -318,11 +318,6 @@ namespace BansheeEngine
 	private:
 		Shader(const String& name, const SHADER_DESC& desc, const Vector<SPtr<Technique>>& techniques);
 
-		/**
-		 * @copydoc	Resource::getResourceDependencies
-		 */
-		void getResourceDependencies(Vector<HResource>& dependencies) const;
-
 		/**
 		 * @copydoc	CoreObject::getCoreDependencies
 		 */

+ 2 - 4
BansheeCore/Source/BsBlendState.cpp

@@ -106,11 +106,9 @@ namespace BansheeEngine
 		return RenderStateManager::instance().getDefaultBlendState();
 	}
 
-	HBlendState BlendState::create(const BLEND_STATE_DESC& desc)
+	BlendStatePtr BlendState::create(const BLEND_STATE_DESC& desc)
 	{
-		BlendStatePtr blendStatePtr = RenderStateManager::instance().createBlendState(desc);
-
-		return static_resource_cast<BlendState>(gResources()._createResourceHandle(blendStatePtr));
+		return RenderStateManager::instance().createBlendState(desc);
 	}
 
 	/************************************************************************/

+ 2 - 4
BansheeCore/Source/BsDepthStencilState.cpp

@@ -55,11 +55,9 @@ namespace BansheeEngine
 		return mProperties;
 	}
 
-	HDepthStencilState DepthStencilState::create(const DEPTH_STENCIL_STATE_DESC& desc)
+	DepthStencilStatePtr DepthStencilState::create(const DEPTH_STENCIL_STATE_DESC& desc)
 	{
-		DepthStencilStatePtr depthStencilPtr = RenderStateManager::instance().createDepthStencilState(desc);
-
-		return static_resource_cast<DepthStencilState>(gResources()._createResourceHandle(depthStencilPtr));
+		return RenderStateManager::instance().createDepthStencilState(desc);
 	}
 
 	/************************************************************************/

+ 1 - 7
BansheeCore/Source/BsGpuParams.cpp

@@ -517,7 +517,7 @@ UINT32 GpuParamsBase::getDataParamSize(const String& name) const
 		{
 			new (&samplers[i]) SPtr<SamplerStateCore>();
 
-			if (mSamplerStates[i].isLoaded())
+			if (mSamplerStates[i] != nullptr)
 				samplers[i] = mSamplerStates[i]->getCore();
 			else
 				samplers[i] = nullptr;
@@ -533,11 +533,5 @@ UINT32 GpuParamsBase::getDataParamSize(const String& name) const
 			if (mTextures[i] != nullptr)
 				resources.push_back(mTextures[i]);
 		}
-
-		for (UINT32 i = 0; i < mNumSamplerStates; i++)
-		{
-			if (mSamplerStates[i] != nullptr)
-				resources.push_back(mSamplerStates[i]);
-		}
 	}
 }

+ 1 - 9
BansheeCore/Source/BsGpuProgram.cpp

@@ -115,16 +115,8 @@ namespace BansheeEngine
 		}
 	}
 
-	HGpuProgram GpuProgram::create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype,
+	GpuProgramPtr GpuProgram::create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype,
 		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requiresAdjacency)
-	{
-		GpuProgramPtr programPtr = _createPtr(source, entryPoint, language, gptype, profile, includes, requiresAdjacency);
-
-		return static_resource_cast<GpuProgram>(gResources()._createResourceHandle(programPtr));
-	}
-
-	GpuProgramPtr GpuProgram::_createPtr(const String& source, const String& entryPoint,
-		const String& language, GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requiresAdjacency)
 	{
 		return GpuProgramManager::instance().create(source, entryPoint, language, gptype, profile, includes, requiresAdjacency);
 	}

+ 0 - 24
BansheeCore/Source/BsGpuProgramImportOptions.cpp

@@ -1,24 +0,0 @@
-#include "BsGpuProgramImportOptions.h"
-#include "BsGpuProgramImportOptionsRTTI.h"
-
-namespace BansheeEngine
-{
-	GpuProgramImportOptions::GpuProgramImportOptions()
-		:mProfile(GPP_NONE), mType(GPT_VERTEX_PROGRAM)
-	{
-
-	}
-
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* GpuProgramImportOptions::getRTTIStatic()
-	{
-		return GpuProgramImportOptionsRTTI::instance();
-	}
-
-	RTTITypeBase* GpuProgramImportOptions::getRTTI() const
-	{
-		return GpuProgramImportOptions::getRTTIStatic();
-	}
-}

+ 0 - 59
BansheeCore/Source/BsGpuProgramImporter.cpp

@@ -1,59 +0,0 @@
-#include "BsGpuProgramImporter.h"
-#include "BsDataStream.h"
-#include "BsFileSystem.h"
-#include "BsGpuProgramImportOptions.h"
-#include "BsGpuProgram.h"
-#include "BsDebug.h"
-
-namespace BansheeEngine
-{
-	bool GpuProgramImporter::isExtensionSupported(const WString& ext) const
-	{
-		if(ext == L"gpuprog")
-			return true;
-
-		return false;
-	}
-
-	bool GpuProgramImporter::isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const
-	{
-		// Gpu program files are plain-text so no magic number
-		return true;
-	}
-
-	ResourcePtr GpuProgramImporter::import(const Path& filePath, ConstImportOptionsPtr importOptions)
-	{
-		WString ext = filePath.getWExtension();
-		ext = ext.substr(1, ext.size() - 1); // Remove the .
-
-		DataStreamPtr stream = FileSystem::openFile(filePath);
-		String shaderSource = stream->getAsString();
-
-		const GpuProgramImportOptions* gpuProgImportOptions = static_cast<const GpuProgramImportOptions*>(importOptions.get());
-
-		String entryPoint = gpuProgImportOptions->getEntryPoint();
-		GpuProgramProfile profile = gpuProgImportOptions->getProfile();
-		String language = gpuProgImportOptions->getLanguage();
-		GpuProgramType gptype = gpuProgImportOptions->getType();
-		Vector<HGpuProgInclude> includes = gpuProgImportOptions->getIncludes();
-
-		GpuProgramPtr gpuProgram = GpuProgram::_createPtr(shaderSource, entryPoint, language, gptype, profile, &includes);
-		gpuProgram->blockUntilCoreInitialized();
-
-		if (!gpuProgram->isCompiled())
-		{
-			LOGERR("Failed compiling GPU program: " + filePath.toString() + ". Error: " + gpuProgram->getCompileErrorMessage());
-			// TODO - Return some dummy program here?
-		}
-
-		WString fileName = filePath.getWFilename(false);
-		gpuProgram->setName(fileName);
-
-		return gpuProgram;
-	}
-
-	ImportOptionsPtr GpuProgramImporter::createImportOptions() const
-	{
-		return bs_shared_ptr<GpuProgramImportOptions, PoolAlloc>();
-	}
-}

+ 0 - 2
BansheeCore/Source/BsImporter.cpp

@@ -3,7 +3,6 @@
 #include "BsFileSystem.h"
 #include "BsSpecificImporter.h"
 #include "BsGpuProgIncludeImporter.h"
-#include "BsGpuProgramImporter.h"
 #include "BsImportOptions.h"
 #include "BsDebug.h"
 #include "BsDataStream.h"
@@ -16,7 +15,6 @@ namespace BansheeEngine
 	Importer::Importer()
 	{
 		_registerAssetImporter(bs_new<GpuProgIncludeImporter>());
-		_registerAssetImporter(bs_new<GpuProgramImporter>());
 	}
 
 	Importer::~Importer()

+ 6 - 63
BansheeCore/Source/BsMaterial.cpp

@@ -359,50 +359,44 @@ namespace BansheeEngine
 		{
 			PassPtr curPass = technique->getPass(i);
 
-			HGpuProgram vertProgram = curPass->getVertexProgram();
+			GpuProgramPtr vertProgram = curPass->getVertexProgram();
 			if (vertProgram)
 			{
-				vertProgram.blockUntilLoaded();
 				vertProgram->blockUntilCoreInitialized();
 				allParamDescs.push_back(vertProgram->getParamDesc());
 			}
 
-			HGpuProgram fragProgram = curPass->getFragmentProgram();
+			GpuProgramPtr fragProgram = curPass->getFragmentProgram();
 			if (fragProgram)
 			{
-				fragProgram.blockUntilLoaded();
 				fragProgram->blockUntilCoreInitialized();
 				allParamDescs.push_back(fragProgram->getParamDesc());
 			}
 
-			HGpuProgram geomProgram = curPass->getGeometryProgram();
+			GpuProgramPtr geomProgram = curPass->getGeometryProgram();
 			if (geomProgram)
 			{
-				geomProgram.blockUntilLoaded();
 				geomProgram->blockUntilCoreInitialized();
 				allParamDescs.push_back(geomProgram->getParamDesc());
 			}
 
-			HGpuProgram hullProgram = curPass->getHullProgram();
+			GpuProgramPtr hullProgram = curPass->getHullProgram();
 			if (hullProgram)
 			{
-				hullProgram.blockUntilLoaded();
 				hullProgram->blockUntilCoreInitialized();
 				allParamDescs.push_back(hullProgram->getParamDesc());
 			}
 
-			HGpuProgram domainProgram = curPass->getDomainProgram();
+			GpuProgramPtr domainProgram = curPass->getDomainProgram();
 			if (domainProgram)
 			{
-				domainProgram.blockUntilLoaded();
 				domainProgram->blockUntilCoreInitialized();
 				allParamDescs.push_back(domainProgram->getParamDesc());
 			}
 
-			HGpuProgram computeProgram = curPass->getComputeProgram();
+			GpuProgramPtr computeProgram = curPass->getComputeProgram();
 			if (computeProgram)
 			{
-				computeProgram.blockUntilLoaded();
 				computeProgram->blockUntilCoreInitialized();
 				allParamDescs.push_back(computeProgram->getParamDesc());
 			}
@@ -1015,58 +1009,7 @@ namespace BansheeEngine
 	void Material::getListenerResources(Vector<HResource>& resources)
 	{
 		if (mShader != nullptr)
-		{
 			resources.push_back(mShader);
-
-			if (mShader.isLoaded())
-			{
-				TechniquePtr bestTechnique = mShader->getBestTechnique();
-				if (bestTechnique != nullptr)
-				{
-					UINT32 numPasses = bestTechnique->getNumPasses();
-					for (UINT32 i = 0; i < numPasses; i++)
-					{
-						PassPtr pass = bestTechnique->getPass(i);
-
-						HGpuProgram vertProg = pass->getVertexProgram();
-						if (vertProg != nullptr)
-							resources.push_back(vertProg);
-
-						HGpuProgram fragProg = pass->getFragmentProgram();
-						if (fragProg != nullptr)
-							resources.push_back(fragProg);
-
-						HGpuProgram geomProg = pass->getGeometryProgram();
-						if (geomProg != nullptr)
-							resources.push_back(geomProg);
-
-						HGpuProgram domProg = pass->getDomainProgram();
-						if (domProg != nullptr)
-							resources.push_back(domProg);
-
-						HGpuProgram hullProg = pass->getHullProgram();
-						if (hullProg != nullptr)
-							resources.push_back(hullProg);
-
-						HGpuProgram computeProg = pass->getComputeProgram();
-						if (computeProg != nullptr)
-							resources.push_back(computeProg);
-
-						HBlendState blendState = pass->getBlendState();
-						if (blendState != nullptr)
-							resources.push_back(blendState);
-
-						HRasterizerState rasterizerState = pass->getRasterizerState();
-						if (rasterizerState != nullptr)
-							resources.push_back(rasterizerState);
-
-						HDepthStencilState depthStencilState = pass->getDepthStencilState();
-						if (depthStencilState != nullptr)
-							resources.push_back(depthStencilState);
-					}
-				}
-			}
-		}
 	}
 
 	void Material::getResourceDependencies(Vector<HResource>& dependencies) const

+ 18 - 60
BansheeCore/Source/BsPass.cpp

@@ -16,16 +16,16 @@ namespace BansheeEngine
 	 */
 	void convertPassDesc(const PASS_DESC& input, PASS_DESC_CORE& output)
 	{
-		output.blendState = input.blendState.isLoaded() ? input.blendState->getCore() : nullptr;
-		output.rasterizerState = input.rasterizerState.isLoaded() ? input.rasterizerState->getCore() : nullptr;
-		output.depthStencilState = input.depthStencilState.isLoaded() ? input.depthStencilState->getCore() : nullptr;
+		output.blendState = input.blendState != nullptr ? input.blendState->getCore() : nullptr;
+		output.rasterizerState = input.rasterizerState != nullptr ? input.rasterizerState->getCore() : nullptr;
+		output.depthStencilState = input.depthStencilState != nullptr ? input.depthStencilState->getCore() : nullptr;
 		output.stencilRefValue = input.stencilRefValue;
-		output.vertexProgram = input.vertexProgram.isLoaded() ? input.vertexProgram->getCore() : nullptr;
-		output.fragmentProgram = input.fragmentProgram.isLoaded() ? input.fragmentProgram->getCore() : nullptr;
-		output.geometryProgram = input.geometryProgram.isLoaded() ? input.geometryProgram->getCore() : nullptr;
-		output.hullProgram = input.hullProgram.isLoaded() ? input.hullProgram->getCore() : nullptr;
-		output.domainProgram = input.domainProgram.isLoaded() ? input.domainProgram->getCore() : nullptr;
-		output.hullProgram = input.hullProgram.isLoaded() ? input.hullProgram->getCore() : nullptr;
+		output.vertexProgram = input.vertexProgram != nullptr ? input.vertexProgram->getCore() : nullptr;
+		output.fragmentProgram = input.fragmentProgram != nullptr ? input.fragmentProgram->getCore() : nullptr;
+		output.geometryProgram = input.geometryProgram != nullptr ? input.geometryProgram->getCore() : nullptr;
+		output.hullProgram = input.hullProgram != nullptr ? input.hullProgram->getCore() : nullptr;
+		output.domainProgram = input.domainProgram != nullptr ? input.domainProgram->getCore() : nullptr;
+		output.hullProgram = input.hullProgram != nullptr ? input.hullProgram->getCore() : nullptr;
 	}
 
 	template<bool Core>
@@ -113,13 +113,6 @@ namespace BansheeEngine
 		return passPtr;
 	}
 
-	void Pass::initialize()
-	{
-		_markResourcesDirty();
-
-		CoreObject::initialize();
-	}
-
 	CoreSyncData Pass::syncToCore(FrameAlloc* allocator)
 	{
 		UINT32 size = sizeof(PASS_DESC_CORE);
@@ -131,69 +124,34 @@ namespace BansheeEngine
 		return CoreSyncData(data, size);
 	}
 
-	void Pass::_markResourcesDirty()
-	{
-		markListenerResourcesDirty();
-	}
-
 	void Pass::getCoreDependencies(Vector<SPtr<CoreObject>>& dependencies)
-	{
-		if (mData.blendState.isLoaded())
-			dependencies.push_back(mData.blendState.getInternalPtr());
-
-		if (mData.rasterizerState.isLoaded())
-			dependencies.push_back(mData.rasterizerState.getInternalPtr());
-
-		if (mData.depthStencilState.isLoaded())
-			dependencies.push_back(mData.depthStencilState.getInternalPtr());
-
-		if (mData.vertexProgram.isLoaded())
-			dependencies.push_back(mData.vertexProgram.getInternalPtr());
-
-		if (mData.fragmentProgram.isLoaded())
-			dependencies.push_back(mData.fragmentProgram.getInternalPtr());
-
-		if (mData.geometryProgram.isLoaded())
-			dependencies.push_back(mData.geometryProgram.getInternalPtr());
-
-		if (mData.hullProgram.isLoaded())
-			dependencies.push_back(mData.hullProgram.getInternalPtr());
-
-		if (mData.domainProgram.isLoaded())
-			dependencies.push_back(mData.domainProgram.getInternalPtr());
-
-		if (mData.computeProgram.isLoaded())
-			dependencies.push_back(mData.computeProgram.getInternalPtr());
-	}
-
-	void Pass::getListenerResources(Vector<HResource>& resources)
 	{
 		if (mData.blendState != nullptr)
-			resources.push_back(mData.blendState);
+			dependencies.push_back(mData.blendState);
 
 		if (mData.rasterizerState != nullptr)
-			resources.push_back(mData.rasterizerState);
+			dependencies.push_back(mData.rasterizerState);
 
 		if (mData.depthStencilState != nullptr)
-			resources.push_back(mData.depthStencilState);
+			dependencies.push_back(mData.depthStencilState);
 
 		if (mData.vertexProgram != nullptr)
-			resources.push_back(mData.vertexProgram);
+			dependencies.push_back(mData.vertexProgram);
 
 		if (mData.fragmentProgram != nullptr)
-			resources.push_back(mData.fragmentProgram);
+			dependencies.push_back(mData.fragmentProgram);
 
 		if (mData.geometryProgram != nullptr)
-			resources.push_back(mData.geometryProgram);
+			dependencies.push_back(mData.geometryProgram);
 
 		if (mData.hullProgram != nullptr)
-			resources.push_back(mData.hullProgram);
+			dependencies.push_back(mData.hullProgram);
 
 		if (mData.domainProgram != nullptr)
-			resources.push_back(mData.domainProgram);
+			dependencies.push_back(mData.domainProgram);
 
 		if (mData.computeProgram != nullptr)
-			resources.push_back(mData.computeProgram);
+			dependencies.push_back(mData.computeProgram);
 	}
 
 	PassPtr Pass::create(const PASS_DESC& desc)

+ 2 - 4
BansheeCore/Source/BsRasterizerState.cpp

@@ -52,11 +52,9 @@ namespace BansheeEngine
 		return RenderStateManager::instance().getDefaultRasterizerState();
 	}
 
-	HRasterizerState RasterizerState::create(const RASTERIZER_STATE_DESC& desc)
+	RasterizerStatePtr RasterizerState::create(const RASTERIZER_STATE_DESC& desc)
 	{
-		RasterizerStatePtr rasterizerPtr = RenderStateManager::instance().createRasterizerState(desc);
-
-		return static_resource_cast<RasterizerState>(gResources()._createResourceHandle(rasterizerPtr));
+		return RenderStateManager::instance().createRasterizerState(desc);
 	}
 
 	/************************************************************************/

+ 2 - 4
BansheeCore/Source/BsSamplerState.cpp

@@ -63,11 +63,9 @@ namespace BansheeEngine
 		return RenderStateCoreManager::instance().createSamplerStateInternal(mProperties.mData);
 	}
 
-	HSamplerState SamplerState::create(const SAMPLER_STATE_DESC& desc)
+	SamplerStatePtr SamplerState::create(const SAMPLER_STATE_DESC& desc)
 	{
-		SamplerStatePtr samplerPtr = RenderStateManager::instance().createSamplerState(desc);
-
-		return static_resource_cast<SamplerState>(gResources()._createResourceHandle(samplerPtr));
+		return RenderStateManager::instance().createSamplerState(desc);
 	}
 
 	const SamplerStatePtr& SamplerState::getDefault()

+ 0 - 49
BansheeCore/Source/BsShader.cpp

@@ -206,55 +206,6 @@ namespace BansheeEngine
 		return shaderCorePtr;
 	}
 
-	void Shader::getResourceDependencies(Vector<HResource>& dependencies) const
-	{
-		TechniquePtr bestTechnique = getBestTechnique();
-		if (bestTechnique == nullptr) // No valid technique
-			return;
-
-		UINT32 numPasses = bestTechnique->getNumPasses();
-		for (UINT32 i = 0; i < numPasses; i++)
-		{
-			PassPtr pass = bestTechnique->getPass(i);
-
-			HGpuProgram vertProg = pass->getVertexProgram();
-			if (vertProg != nullptr)
-				dependencies.push_back(vertProg);
-
-			HGpuProgram fragProg = pass->getFragmentProgram();
-			if (fragProg != nullptr)
-				dependencies.push_back(fragProg);
-
-			HGpuProgram geomProg = pass->getGeometryProgram();
-			if (geomProg != nullptr)
-				dependencies.push_back(geomProg);
-
-			HGpuProgram domProg = pass->getDomainProgram();
-			if (domProg != nullptr)
-				dependencies.push_back(domProg);
-
-			HGpuProgram hullProg = pass->getHullProgram();
-			if (hullProg != nullptr)
-				dependencies.push_back(hullProg);
-
-			HGpuProgram computeProg = pass->getComputeProgram();
-			if (computeProg != nullptr)
-				dependencies.push_back(computeProg);
-
-			HBlendState blendState = pass->getBlendState();
-			if (blendState != nullptr)
-				dependencies.push_back(blendState);
-
-			HRasterizerState rasterizerState = pass->getRasterizerState();
-			if (rasterizerState != nullptr)
-				dependencies.push_back(rasterizerState);
-
-			HDepthStencilState depthStencilState = pass->getDepthStencilState();
-			if (depthStencilState != nullptr)
-				dependencies.push_back(depthStencilState);
-		}
-	}
-
 	void Shader::getCoreDependencies(Vector<SPtr<CoreObject>>& dependencies)
 	{
 		for (auto& technique : mTechniques)

+ 19 - 89
BansheeEditor/Include/BsBuiltinEditorResources.h

@@ -10,7 +10,7 @@ namespace BansheeEngine
 	class BS_ED_EXPORT BuiltinEditorResources : public BansheeEngine::Module<BuiltinEditorResources>
 	{
 	public:
-		BuiltinEditorResources(RenderSystemPlugin activeRSPlugin);
+		BuiltinEditorResources();
 
 		const GUISkin& getSkin() const { return mSkin; }
 
@@ -93,11 +93,6 @@ namespace BansheeEngine
 		 */
 		static HSpriteTexture getGUITexture(const WString& name);
 
-		/**
-		 * @brief	Loads a GPU program with the specified filename.
-		 */
-		HGpuProgram getGpuProgram(const WString& name);
-
 		/**
 		 * @brief	Imports a GUI skin texture with the specified filename.
 		 *			Saves the imported texture in engine-ready format in the corresponding
@@ -106,68 +101,9 @@ namespace BansheeEngine
 		static void importGUITexture(const WString& name);
 
 		/**
-		 * @brief	Loads and compiles a shader for dock overlay rendering.
-		 */
-		void initDockDropOverlayShader();
-
-		/**
-		 * @brief	Loads and compiles a shader for scene grid rendering.
+		 * @brief	Loads a shader with the specified filename
 		 */
-		void initSceneGridShader();
-
-		/**
-		 * @brief	Loads and compiles a shader used for scene picking (non alpha).
-		 */
-		void initPickingShader(CullingMode cullMode);
-
-		/**
-		 * @brief	Loads and compiles a shader used for scene picking (alpha).
-		 */
-		void initPickingAlphaShader(CullingMode cullMode);
-
-		/**
-		 * @brief	Loads and compiles a shader used for rendering wireframe gizmos.
-		 */
-		void initWireGizmoShader();
-
-		/**
-		 * @brief	Loads and compiles a shader used for rendering solid gizmos.
-		 */
-		void initSolidGizmoShader();
-
-		/**
-		 * @brief	Loads and compiles a shader used for rendering icon gizmos.
-		 */
-		void initIconGizmoShader();
-
-		/**
-		 * @brief	Loads and compiles a shader used for scene picking of non-transparent gizmos.
-		 */
-		void initGizmoPickingShader();
-
-		/**
-		 * @brief	Loads and compiles a shader used for scene picking of possibly transparent gizmos.
-		 */
-		void initGizmoPickingAlphaShader();
-
-		/**
-		 * @brief	Loads and compiles a shader used for rendering wireframe handles.
-		 */
-		void initWireHandleShader();
-
-		/**
-		 * @brief	Loads and compiles a shader used for rendering solid handles.
-		 */
-		void initSolidHandleShader();
-
-		/**
-		 * @brief	Loads and compiles a shader used for displaying selected objects.
-		 */
-		void initSelectionShader();
-
-		RenderSystemPlugin mRenderSystemPlugin;
-		WString mActiveShaderSubFolder;
-		StringID mActiveRenderSystem;
+		static HShader getShader(const WString& name);
 
 		HShader mShaderDockOverlay;
 		HShader mShaderSceneGrid;
@@ -323,27 +259,21 @@ namespace BansheeEngine
 		static const WString ProgressBarFillTex;
 		static const WString ProgressBarBgTex;
 
-		static const WString ShaderDockOverlayVSFile;
-		static const WString ShaderDockOverlayPSFile;
-		static const WString SceneGridVSFile;
-		static const WString SceneGridPSFile;
-		static const WString PickingVSFile;
-		static const WString PickingPSFile;
-		static const WString PickingAlphaVSFile;
-		static const WString PickingAlphaPSFile;
-		static const WString ShaderWireGizmoVSFile;
-		static const WString ShaderWireGizmoPSFile;
-		static const WString ShaderSolidGizmoVSFile;
-		static const WString ShaderSolidGizmoPSFile;
-		static const WString ShaderIconGizmo0VSFile;
-		static const WString ShaderIconGizmo0PSFile;
-		static const WString ShaderIconGizmo1VSFile;
-		static const WString ShaderIconGizmo1PSFile;
-		static const WString GizmoPickingVSFile;
-		static const WString GizmoPickingPSFile;
-		static const WString GizmoPickingAlphaVSFile;
-		static const WString GizmoPickingAlphaPSFile;
-		static const WString SelectionVSFile;
-		static const WString SelectionPSFile;
+		static const WString ShaderDockOverlayFile;
+		static const WString ShaderSceneGridFile;
+		static const WString ShaderPickingCullNoneFile;
+		static const WString ShaderPickingCullCWFile;
+		static const WString ShaderPickingCullCCWFile;
+		static const WString ShaderPickingAlphaCullNoneFile;
+		static const WString ShaderPickingAlphaCullCWFile;
+		static const WString ShaderPickingAlphaCullCCWFile;
+		static const WString ShaderWireGizmoFile;
+		static const WString ShaderSolidGizmoFile;
+		static const WString ShaderWireHandleFile;
+		static const WString ShaderSolidHandleFile;
+		static const WString ShaderIconGizmoFile;
+		static const WString ShaderGizmoPickingFile;
+		static const WString ShaderGizmoPickingAlphaFile;
+		static const WString ShaderSelectionFile;
 	};
 }

+ 0 - 10
BansheeEditor/Include/BsEditorApplication.h

@@ -57,17 +57,7 @@ namespace BansheeEngine
 
 		// DEBUG ONLY
 
-		HGpuProgram mFragProgRef;
-		HGpuProgram mVertProgRef;
-
 		HShader mTestShader;
-		TechniquePtr mNewTechniqueGL;
-		PassPtr mNewPassGL;
-		TechniquePtr mNewTechniqueDX;
-		PassPtr mNewPassDX;
-		TechniquePtr mNewTechniqueDX11;
-		PassPtr mNewPassDX11;
-
 		HMaterial mTestMaterial;
 		HTexture mTestTexRef;
 		HMesh mDbgMeshRef;

+ 46 - 561
BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -35,7 +35,6 @@
 #include "BsBlendState.h"
 #include "BsDepthStencilState.h"
 #include "BsRasterizerState.h"
-#include "BsGpuProgramImportOptions.h"
 #include "BsResources.h"
 #include "BsRTTIType.h"
 #include "BsFileSystem.h"
@@ -189,76 +188,43 @@ namespace BansheeEngine
 	/* 									SHADERS                      		*/
 	/************************************************************************/
 
-	struct GpuProgramImportData
+	const WString BuiltinEditorResources::ShaderDockOverlayFile = L"DockDropOverlay.bsl";
+	const WString BuiltinEditorResources::ShaderSceneGridFile = L"SceneGrid.bsl";
+	const WString BuiltinEditorResources::ShaderPickingCullNoneFile = L"PickingCullNone.bsl";
+	const WString BuiltinEditorResources::ShaderPickingCullCWFile = L"PickingCullCW.bsl";
+	const WString BuiltinEditorResources::ShaderPickingCullCCWFile = L"PickingCullCCW.bsl";
+	const WString BuiltinEditorResources::ShaderPickingAlphaCullNoneFile = L"PickingAlphaCullNone.bsl";
+	const WString BuiltinEditorResources::ShaderPickingAlphaCullCWFile = L"PickingAlphaCullCW.bsl";
+	const WString BuiltinEditorResources::ShaderPickingAlphaCullCCWFile = L"PickingAlphaCullCCW.bsl";
+	const WString BuiltinEditorResources::ShaderWireGizmoFile = L"WireGizmo.bsl";
+	const WString BuiltinEditorResources::ShaderSolidGizmoFile = L"SolidGizmo.bsl";
+	const WString BuiltinEditorResources::ShaderWireHandleFile = L"WireHandle.bsl";
+	const WString BuiltinEditorResources::ShaderSolidHandleFile = L"SolidHandle.bsl";
+	const WString BuiltinEditorResources::ShaderIconGizmoFile = L"IconGizmo.bsl";
+	const WString BuiltinEditorResources::ShaderGizmoPickingFile = L"GizmoPicking.bsl";
+	const WString BuiltinEditorResources::ShaderGizmoPickingAlphaFile = L"GizmoPickingAlpha.bsl";
+	const WString BuiltinEditorResources::ShaderSelectionFile = L"Selection.bsl";
+
+	BuiltinEditorResources::BuiltinEditorResources()
 	{
-		WString filename;
-		String entryPoint;
-		GpuProgramType type;
-		GpuProgramProfile profile;
-		String language;
-		WString folder;
-	};
-
-	const WString BuiltinEditorResources::ShaderDockOverlayVSFile = L"dockDropOverlayVS.gpuprog";
-	const WString BuiltinEditorResources::ShaderDockOverlayPSFile = L"dockDropOverlayPS.gpuprog";
-	const WString BuiltinEditorResources::SceneGridVSFile = L"sceneGridVS.gpuprog";
-	const WString BuiltinEditorResources::SceneGridPSFile = L"sceneGridPS.gpuprog";
-	const WString BuiltinEditorResources::PickingVSFile = L"pickingVS.gpuprog";
-	const WString BuiltinEditorResources::PickingPSFile = L"pickingPS.gpuprog";
-	const WString BuiltinEditorResources::PickingAlphaVSFile = L"pickingAlphaVS.gpuprog";
-	const WString BuiltinEditorResources::PickingAlphaPSFile = L"pickingAlphaPS.gpuprog";
-	const WString BuiltinEditorResources::ShaderWireGizmoVSFile = L"wireGizmoVS.gpuprog";
-	const WString BuiltinEditorResources::ShaderWireGizmoPSFile = L"wireGizmoPS.gpuprog";
-	const WString BuiltinEditorResources::ShaderSolidGizmoVSFile = L"solidGizmoVS.gpuprog";
-	const WString BuiltinEditorResources::ShaderSolidGizmoPSFile = L"solidGizmoPS.gpuprog";
-	const WString BuiltinEditorResources::ShaderIconGizmo0VSFile = L"iconGizmo0VS.gpuprog";
-	const WString BuiltinEditorResources::ShaderIconGizmo0PSFile = L"iconGizmo0PS.gpuprog";
-	const WString BuiltinEditorResources::ShaderIconGizmo1VSFile = L"iconGizmo1VS.gpuprog";
-	const WString BuiltinEditorResources::ShaderIconGizmo1PSFile = L"iconGizmo1PS.gpuprog";
-	const WString BuiltinEditorResources::GizmoPickingVSFile = L"pickingGizmoVS.gpuprog";
-	const WString BuiltinEditorResources::GizmoPickingPSFile = L"pickingGizmoPS.gpuprog";
-	const WString BuiltinEditorResources::GizmoPickingAlphaVSFile = L"pickingGizmoAlphaVS.gpuprog";
-	const WString BuiltinEditorResources::GizmoPickingAlphaPSFile = L"pickingGizmoAlphaPS.gpuprog";
-	const WString BuiltinEditorResources::SelectionVSFile = L"selectionVS.gpuprog";
-	const WString BuiltinEditorResources::SelectionPSFile = L"selectionPS.gpuprog";
-
-	BuiltinEditorResources::BuiltinEditorResources(RenderSystemPlugin activeRSPlugin)
-		:mRenderSystemPlugin(activeRSPlugin)
-	{
-		switch (activeRSPlugin)
-		{
-		case RenderSystemPlugin::DX11:
-			mActiveShaderSubFolder = HLSL11ShaderSubFolder;
-			mActiveRenderSystem = RenderAPIDX11;
-			break;
-		case RenderSystemPlugin::DX9:
-			mActiveShaderSubFolder = HLSL9ShaderSubFolder;
-			mActiveRenderSystem = RenderAPIDX9;
-			break;
-		case RenderSystemPlugin::OpenGL:
-			mActiveShaderSubFolder = GLSLShaderSubFolder;
-			mActiveRenderSystem = RenderAPIOpenGL;
-			break;
-		}
-
 		preprocess();
 
-		initDockDropOverlayShader();
-		initSceneGridShader();
-		initPickingShader(CULL_NONE);
-		initPickingShader(CULL_CLOCKWISE);
-		initPickingShader(CULL_COUNTERCLOCKWISE);
-		initPickingAlphaShader(CULL_NONE);
-		initPickingAlphaShader(CULL_CLOCKWISE);
-		initPickingAlphaShader(CULL_COUNTERCLOCKWISE);
-		initWireGizmoShader();
-		initSolidGizmoShader();
-		initIconGizmoShader();
-		initGizmoPickingShader();
-		initGizmoPickingAlphaShader();
-		initWireHandleShader();
-		initSolidHandleShader();
-		initSelectionShader();
+		mShaderDockOverlay = getShader(ShaderDockOverlayFile);
+		mShaderSceneGrid = getShader(ShaderSceneGridFile);
+		mShaderPicking[(int)CULL_NONE] = getShader(ShaderPickingCullNoneFile);
+		mShaderPicking[(int)CULL_CLOCKWISE] = getShader(ShaderPickingCullCWFile);
+		mShaderPicking[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingCullCCWFile);
+		mShaderPickingAlpha[(int)CULL_NONE] = getShader(ShaderPickingAlphaCullNoneFile);
+		mShaderPickingAlpha[(int)CULL_CLOCKWISE] = getShader(ShaderPickingAlphaCullCWFile);
+		mShaderPickingAlpha[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingAlphaCullCCWFile);
+		mShaderGizmoSolid = getShader(ShaderSolidGizmoFile);
+		mShaderGizmoWire = getShader(ShaderWireGizmoFile);
+		mShaderGizmoIcon = getShader(ShaderIconGizmoFile);
+		mShaderGizmoPicking = getShader(ShaderGizmoPickingFile);
+		mShaderGizmoAlphaPicking = getShader(ShaderGizmoPickingAlphaFile);
+		mShaderHandleSolid = getShader(ShaderSolidHandleFile);
+		mShaderHandleWire = getShader(ShaderWireHandleFile);
+		mShaderSelection = getShader(ShaderSelectionFile);
 
 		Path fontPath = FileSystem::getWorkingDirectoryPath();
 		fontPath.append(DefaultSkinFolder);
@@ -1192,76 +1158,6 @@ namespace BansheeEngine
 			TreeViewSelectionBackground, TreeViewEditBox, TreeViewElementHighlight, TreeViewElementSepHighlight, ProgressBarBgTex,
 			ProgressBarFillTex, ColorPickerSliderHorzHandleTex, ColorPickerSliderVertHandleTex, ColorPickerSlider2DHandleTex };
 
-		static const GpuProgramImportData GPU_PROGRAM_IMPORT_DATA[] = 
-		{
-			{ SceneGridVSFile,			"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ SceneGridPSFile,			"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ ShaderDockOverlayVSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ ShaderDockOverlayPSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ PickingVSFile,			"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ PickingPSFile,			"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ PickingAlphaVSFile,		"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ PickingAlphaPSFile,		"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ ShaderWireGizmoVSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ ShaderWireGizmoPSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ ShaderSolidGizmoVSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ ShaderSolidGizmoPSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ ShaderIconGizmo0VSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ ShaderIconGizmo0PSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ ShaderIconGizmo1VSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ ShaderIconGizmo1PSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ GizmoPickingVSFile,		"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ GizmoPickingPSFile,		"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ GizmoPickingAlphaVSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ GizmoPickingAlphaPSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ SelectionVSFile,			"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ SelectionPSFile,			"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"hlsl", HLSL11ShaderSubFolder },
-			{ SceneGridVSFile,			"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ SceneGridPSFile,			"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ ShaderDockOverlayVSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_2_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ ShaderDockOverlayPSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_2_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ PickingVSFile,			"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ PickingPSFile,			"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ PickingAlphaVSFile,		"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ PickingAlphaPSFile,		"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ ShaderWireGizmoVSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ ShaderWireGizmoPSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ ShaderSolidGizmoVSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ ShaderSolidGizmoPSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ ShaderIconGizmo0VSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ ShaderIconGizmo0PSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ ShaderIconGizmo1VSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ ShaderIconGizmo1PSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ GizmoPickingVSFile,		"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ GizmoPickingPSFile,		"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ GizmoPickingAlphaVSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ GizmoPickingAlphaPSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_3_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ SelectionVSFile,			"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_2_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ SelectionPSFile,			"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_FS_2_0,		"hlsl", HLSL9ShaderSubFolder },
-			{ SceneGridVSFile,			"main",		GPT_VERTEX_PROGRAM,		GPP_VS_2_0,		"glsl", GLSLShaderSubFolder },
-			{ SceneGridPSFile,			"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_2_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderDockOverlayVSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderDockOverlayPSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ PickingVSFile,			"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ PickingPSFile,			"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ PickingAlphaVSFile,		"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ PickingAlphaPSFile,		"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderWireGizmoVSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderWireGizmoPSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderSolidGizmoVSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderSolidGizmoPSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderIconGizmo0VSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderIconGizmo0PSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderIconGizmo1VSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderIconGizmo1PSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ GizmoPickingVSFile,		"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ GizmoPickingPSFile,		"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ GizmoPickingAlphaVSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ GizmoPickingAlphaPSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ SelectionVSFile,			"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ SelectionPSFile,			"main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0,		"glsl", GLSLShaderSubFolder },
-		};
-
 		if (FileSystem::exists(DefaultSkinFolderRaw))
 		{
 			FileSystem::remove(DefaultSkinFolder);
@@ -1310,37 +1206,23 @@ namespace BansheeEngine
 
 		if (FileSystem::exists(DefaultShaderFolderRaw))
 		{
-			Path shaderFolder = DefaultShaderFolder;
-			shaderFolder.append(mActiveShaderSubFolder);
+			FileSystem::remove(DefaultShaderFolder);
 
-			FileSystem::remove(shaderFolder);
+			Vector<Path> directories;
+			Vector<Path> files;
+			FileSystem::getChildren(DefaultShaderFolderRaw, files, directories);
 
-			for (auto& importData : GPU_PROGRAM_IMPORT_DATA)
+			for (auto& shaderFile : files)
 			{
-				if (importData.folder != mActiveShaderSubFolder)
-					continue;
-
-				Path gpuProgInputLoc = DefaultShaderFolderRaw;
-				gpuProgInputLoc.append(importData.folder);
-				gpuProgInputLoc.append(importData.filename);
+				HShader shader = Importer::instance().import<Shader>(shaderFile);
 
-				Path gpuProgOutputLoc = DefaultShaderFolder;
-				gpuProgOutputLoc.append(importData.folder);
-				gpuProgOutputLoc.append(importData.filename + L".asset");
-
-				ImportOptionsPtr gpuProgImportOptions = Importer::instance().createImportOptions(gpuProgInputLoc);
-				if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
+				if (shader != nullptr)
 				{
-					GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
+					Path gpuProgOutputLoc = DefaultShaderFolder;
+					gpuProgOutputLoc.append(shaderFile.getWFilename() + L".asset");
 
-					importOptions->setEntryPoint(importData.entryPoint);
-					importOptions->setLanguage(importData.language);
-					importOptions->setProfile(importData.profile);
-					importOptions->setType(importData.type);
+					Resources::instance().save(shader, gpuProgOutputLoc, true);
 				}
-
-				HGpuProgram gpuProgram = Importer::instance().import<GpuProgram>(gpuProgInputLoc, gpuProgImportOptions);
-				Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
 			}
 		}
 
@@ -1375,409 +1257,12 @@ namespace BansheeEngine
 		return Resources::instance().load<SpriteTexture>(texturePath);
 	}
 
-	HGpuProgram BuiltinEditorResources::getGpuProgram(const WString& name)
+	HShader BuiltinEditorResources::getShader(const WString& name)
 	{
 		Path programPath = DefaultShaderFolder;
-		programPath.append(mActiveShaderSubFolder);
 		programPath.append(name + L".asset");
 
-		return gResources().load<GpuProgram>(programPath);
-	}
-
-	void BuiltinEditorResources::initDockDropOverlayShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(ShaderDockOverlayVSFile);
-		HGpuProgram psProgram = getGpuProgram(ShaderDockOverlayPSFile);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.blendState = blendState;
-		passDesc.depthStencilState = depthState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		shaderDesc.addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-
-		shaderDesc.addParameter("tintColor", "tintColor", GPDT_FLOAT4);
-		shaderDesc.addParameter("highlightColor", "highlightColor", GPDT_FLOAT4);
-		shaderDesc.addParameter("highlightActive", "highlightActive", GPDT_FLOAT4);
-
-		mShaderDockOverlay = Shader::create("DockDropOverlayShader", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initSceneGridShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(SceneGridVSFile);
-		HGpuProgram psProgram = getGpuProgram(SceneGridPSFile);
-
-		BLEND_STATE_DESC blendDesc;
-		blendDesc.renderTargetDesc[0].blendEnable = true;
-		blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
-		blendDesc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
-
-		HBlendState blendState = BlendState::create(blendDesc);
-
-		RASTERIZER_STATE_DESC rasterizerDesc;
-		rasterizerDesc.cullMode = CULL_NONE;
-
-		HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
-
-		DEPTH_STENCIL_STATE_DESC depthStencilDesc;
-		depthStencilDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilDesc);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.blendState = blendState;
-		passDesc.rasterizerState = rasterizerState;
-		passDesc.depthStencilState = depthStencilState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-		shaderDesc.addParameter("worldCameraPos", "worldCameraPos", GPDT_FLOAT4);
-		shaderDesc.addParameter("gridColor", "gridColor", GPDT_FLOAT4);
-		shaderDesc.addParameter("gridSpacing", "gridSpacing", GPDT_FLOAT1);
-		shaderDesc.addParameter("gridBorderWidth", "gridBorderWidth", GPDT_FLOAT1);
-		shaderDesc.addParameter("gridFadeOutStart", "gridFadeOutStart", GPDT_FLOAT1);
-		shaderDesc.addParameter("gridFadeOutEnd", "gridFadeOutEnd", GPDT_FLOAT1);
-		shaderDesc.queuePriority = -10000;
-
-		mShaderSceneGrid = Shader::create("SceneGridShader", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initPickingShader(CullingMode cullMode)
-	{
-		UINT32 modeIdx = (UINT32)cullMode;
-
-		HGpuProgram vsProgram = getGpuProgram(PickingVSFile);
-		HGpuProgram psProgram = getGpuProgram(PickingPSFile);
-
-		RASTERIZER_STATE_DESC rasterizerDesc;
-		rasterizerDesc.scissorEnable = true;
-		rasterizerDesc.cullMode = cullMode;
-
-		HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.rasterizerState = rasterizerState;
-
-		PassPtr newPass = Pass::create(passDesc);
-
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("colorIndex", "colorIndex", GPDT_FLOAT4);
-		shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
-
-		mShaderPicking[modeIdx] = Shader::create("PickingShader", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initPickingAlphaShader(CullingMode cullMode)
-	{
-		UINT32 modeIdx = (UINT32)cullMode;
-
-		HGpuProgram vsProgram = getGpuProgram(PickingAlphaVSFile);
-		HGpuProgram psProgram = getGpuProgram(PickingAlphaPSFile);
-
-		RASTERIZER_STATE_DESC rasterizerDesc;
-		rasterizerDesc.scissorEnable = true;
-		rasterizerDesc.cullMode = cullMode;
-
-		HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.rasterizerState = rasterizerState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
-		shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
-
-		shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-
-		shaderDesc.addParameter("alphaCutoff", "alphaCutoff", GPDT_FLOAT1);
-		shaderDesc.addParameter("colorIndex", "colorIndex", GPDT_FLOAT4);
-		shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
-
-		mShaderPickingAlpha[modeIdx] = Shader::create("PickingAlphaShader", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initWireGizmoShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(ShaderWireGizmoVSFile);
-		HGpuProgram psProgram = getGpuProgram(ShaderWireGizmoPSFile);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-
-		mShaderGizmoWire = Shader::create("GizmoWire", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initSolidGizmoShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(ShaderSolidGizmoVSFile);
-		HGpuProgram psProgram = getGpuProgram(ShaderSolidGizmoPSFile);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-
-		mShaderGizmoSolid = Shader::create("GizmoSolid", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initWireHandleShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(ShaderWireGizmoVSFile);
-		HGpuProgram psProgram = getGpuProgram(ShaderWireGizmoPSFile);
-
-		DEPTH_STENCIL_STATE_DESC depthStencilStateDesc;
-		depthStencilStateDesc.depthWriteEnable = false;
-		depthStencilStateDesc.depthReadEnable = false;
-
-		HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilStateDesc);
-
-		BLEND_STATE_DESC blendDesc;
-		blendDesc.renderTargetDesc[0].blendEnable = true;
-		blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(blendDesc);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.depthStencilState = depthStencilState;
-		passDesc.blendState = blendState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-
-		mShaderHandleWire = Shader::create("HandleWire", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initSolidHandleShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(ShaderSolidGizmoVSFile);
-		HGpuProgram psProgram = getGpuProgram(ShaderSolidGizmoPSFile);
-
-		DEPTH_STENCIL_STATE_DESC depthStencilStateDesc;
-		depthStencilStateDesc.depthWriteEnable = false;
-		depthStencilStateDesc.depthReadEnable = false;
-
-		HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilStateDesc);
-
-		BLEND_STATE_DESC blendDesc;
-		blendDesc.renderTargetDesc[0].blendEnable = true;
-		blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(blendDesc);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.depthStencilState = depthStencilState;
-		passDesc.blendState = blendState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-
-		mShaderHandleSolid = Shader::create("HandleSolid", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initIconGizmoShader()
-	{
-		HGpuProgram vsProgram0 = getGpuProgram(ShaderIconGizmo0VSFile);
-		HGpuProgram psProgram0 = getGpuProgram(ShaderIconGizmo0PSFile);
-		HGpuProgram vsProgram1 = getGpuProgram(ShaderIconGizmo1VSFile);
-		HGpuProgram psProgram1 = getGpuProgram(ShaderIconGizmo1PSFile);
-
-		BLEND_STATE_DESC blendDesc;
-		blendDesc.renderTargetDesc[0].blendEnable = true;
-		blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(blendDesc);
-
-		DEPTH_STENCIL_STATE_DESC depthStencilState0Desc;
-		depthStencilState0Desc.depthWriteEnable = false;
-		depthStencilState0Desc.depthComparisonFunc = CMPF_LESS_EQUAL;
-
-		HDepthStencilState depthStencilState0 = DepthStencilState::create(depthStencilState0Desc);
-
-		DEPTH_STENCIL_STATE_DESC depthStencilState1Desc;
-		depthStencilState1Desc.depthWriteEnable = false;
-		depthStencilState1Desc.depthComparisonFunc = CMPF_GREATER;
-
-		HDepthStencilState depthStencilState1 = DepthStencilState::create(depthStencilState1Desc);
-
-		PASS_DESC pass0Desc;
-		pass0Desc.vertexProgram = vsProgram0;
-		pass0Desc.fragmentProgram = psProgram0;
-		pass0Desc.blendState = blendState;
-		pass0Desc.depthStencilState = depthStencilState0;
-
-		PassPtr newPass0 = Pass::create(pass0Desc);
-
-		PASS_DESC pass1Desc;
-		pass1Desc.vertexProgram = vsProgram1;
-		pass1Desc.fragmentProgram = psProgram1;
-		pass1Desc.blendState = blendState;
-		pass1Desc.depthStencilState = depthStencilState1;
-
-		PassPtr newPass1 = Pass::create(pass1Desc);
-
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass0, newPass1 });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-		shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
-		shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
-		shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-
-		mShaderGizmoIcon = Shader::create("GizmoIcon", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initGizmoPickingShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(GizmoPickingVSFile);
-		HGpuProgram psProgram = getGpuProgram(GizmoPickingPSFile);
-
-		RASTERIZER_STATE_DESC rasterizerDesc;
-		rasterizerDesc.scissorEnable = true;
-
-		HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.rasterizerState = rasterizerState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-
-		mShaderGizmoPicking = Shader::create("GizmoPickingShader", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initGizmoPickingAlphaShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(GizmoPickingAlphaVSFile);
-		HGpuProgram psProgram = getGpuProgram(GizmoPickingAlphaPSFile);
-
-		RASTERIZER_STATE_DESC rasterizerDesc;
-		rasterizerDesc.scissorEnable = true;
-
-		HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
-		
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.rasterizerState = rasterizerState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
-		shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
-
-		shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-
-		shaderDesc.addParameter("alphaCutoff", "alphaCutoff", GPDT_FLOAT1);
-		shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-
-		mShaderGizmoAlphaPicking = Shader::create("GizmoPickingAlphaShader", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinEditorResources::initSelectionShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(SelectionVSFile);
-		HGpuProgram psProgram = getGpuProgram(SelectionPSFile);
-
-		RASTERIZER_STATE_DESC rasterizerDesc;
-		rasterizerDesc.polygonMode = PM_WIREFRAME;
-		rasterizerDesc.depthBias = 0.00001f;
-
-		HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
-
-		BLEND_STATE_DESC blendDesc;
-		blendDesc.renderTargetDesc[0].blendEnable = true;
-		blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(blendDesc);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.rasterizerState = rasterizerState;
-		passDesc.blendState = blendState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
-		shaderDesc.addParameter("color", "color", GPDT_FLOAT4);
-
-		mShaderSelection = Shader::create("Selection", shaderDesc, { newTechnique });
+		return gResources().load<Shader>(programPath);
 	}
 
 	HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const

+ 10 - 124
BansheeEditor/Source/BsEditorApplication.cpp

@@ -23,7 +23,6 @@
 #include "BsSceneObject.h"
 #include "BsImporter.h"
 #include "BsGpuProgram.h"
-#include "BsGpuProgramImportOptions.h"
 #include "BsShader.h"
 #include "BsTexture.h"
 #include "BsMaterial.h"
@@ -68,7 +67,7 @@ namespace BansheeEngine
 		// TODO - Load project settings
 		mEditorSettings = bs_shared_ptr<EditorSettings>();
 
-		BuiltinEditorResources::startUp(renderSystemPlugin);
+		BuiltinEditorResources::startUp();
 
 		{
 			auto inputConfig = VirtualInput::instance().getConfiguration();
@@ -129,25 +128,12 @@ namespace BansheeEngine
 
 		gResources().unload(mTestTexRef);
 		gResources().unload(mDbgMeshRef);
-		gResources().unload(mFragProgRef);
-		gResources().unload(mVertProgRef);
+		gResources().unload(mTestShader);
 		gResources().unload(mTestMaterial);
 
 		mTestMaterial = nullptr;
 		mTestTexRef = nullptr;
 		mDbgMeshRef = nullptr;
-		mFragProgRef = nullptr;
-		mVertProgRef = nullptr;
-
-		mNewPassGL = nullptr;
-		mNewTechniqueGL = nullptr;
-
-		mNewPassDX = nullptr;
-		mNewTechniqueDX = nullptr;
-
-		mNewPassDX11 = nullptr;
-		mNewTechniqueDX11 = nullptr;
-
 		mTestShader = nullptr;
 
 		/************************************************************************/
@@ -175,121 +161,21 @@ namespace BansheeEngine
 		/* 								DEBUG CODE                      		*/
 		/************************************************************************/
 
-		HShader dummyParsedShader = Importer::instance().import<Shader>("..\\..\\..\\..\\Data\\Raw\\Engine\\Shaders\\DummyFX.bsl");
-		assert(dummyParsedShader != nullptr);
+		HShader dummyParsedShader = Importer::instance().import<Shader>("..\\..\\..\\..\\Data\\Raw\\Engine\\Shaders\\TestFX.bsl");
+		assert(dummyParsedShader != nullptr); // Ad hoc unit test
 
 		RenderAPICore* renderSystem = RenderAPICore::instancePtr();
 
 		HSceneObject testModelGO = SceneObject::create("TestMesh");
 		HRenderable testRenderable = testModelGO->addComponent<Renderable>();
 
-		WString psLoc;
-		WString vsLoc;
-
-		GpuProgramProfile psProfile;
-		GpuProgramProfile vsProfile;
-
-		String psEntry;
-		String vsEntry;
-
-		String language;
-
-		switch (mActiveRSPlugin)
-		{
-		case RenderSystemPlugin::DX11:
-		{
-										 psLoc = L"..\\..\\..\\..\\Data\\hlsl11_ps.gpuprog";
-										 vsLoc = L"..\\..\\..\\..\\Data\\hlsl11_vs.gpuprog";
-										 language = "hlsl";
-										 psProfile = GPP_FS_4_0;
-										 vsProfile = GPP_VS_4_0;
-										 psEntry = "ps_main";
-										 vsEntry = "vs_main";
-										 break;
-		}
-		case RenderSystemPlugin::DX9:
-		{
-										psLoc = L"..\\..\\..\\..\\Data\\hlsl9_ps.gpuprog";
-										vsLoc = L"..\\..\\..\\..\\Data\\hlsl9_vs.gpuprog";
-										language = "hlsl";
-										psProfile = GPP_FS_2_0;
-										vsProfile = GPP_VS_2_0;
-										psEntry = "ps_main";
-										vsEntry = "vs_main";
-										break;
-		}
-		case RenderSystemPlugin::OpenGL:
-		{
-										   psLoc = L"..\\..\\..\\..\\Data\\glsl_ps.gpuprog";
-										   vsLoc = L"..\\..\\..\\..\\Data\\glsl_vs.gpuprog";
-										   language = "glsl";
-										   psProfile = GPP_FS_2_0;
-										   vsProfile = GPP_VS_2_0;
-										   psEntry = "main";
-										   vsEntry = "main";
-										   break;
-		}
-		}
-
-		ImportOptionsPtr gpuProgImportOptions = Importer::instance().createImportOptions(psLoc);
-		if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
-		{
-			GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
+		WString testShaderLoc = L"..\\..\\..\\..\\Data\\Test.bsl";;
+		
+		mTestShader = Importer::instance().import<Shader>(testShaderLoc);
 
-			importOptions->setEntryPoint(psEntry);
-			importOptions->setLanguage(language);
-			importOptions->setProfile(psProfile);
-			importOptions->setType(GPT_FRAGMENT_PROGRAM);
-		}
-
-		mFragProgRef = Importer::instance().import<GpuProgram>(psLoc, gpuProgImportOptions);
-
-		gpuProgImportOptions = Importer::instance().createImportOptions(vsLoc);
-		if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
-		{
-			GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
-
-			importOptions->setEntryPoint(vsEntry);
-			importOptions->setLanguage(language);
-			importOptions->setProfile(vsProfile);
-			importOptions->setType(GPT_VERTEX_PROGRAM);
-		}
-
-		mVertProgRef = Importer::instance().import<GpuProgram>(vsLoc, gpuProgImportOptions);
-
-		gResources().save(mVertProgRef, L"C:\\vertProgCg.vprog", true);
-		gResources().unload(mVertProgRef);
-		mVertProgRef = gResources().load<GpuProgram>(L"C:\\vertProgCg.vprog");
-
-		gResources().save(mFragProgRef, L"C:\\fragProgCg.vprog", true);
-		gResources().unload(mFragProgRef);
-		mFragProgRef = gResources().load<GpuProgram>(L"C:\\fragProgCg.vprog");
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = mVertProgRef;
-		passDesc.fragmentProgram = mFragProgRef;
-
-		mNewPassGL = Pass::create(passDesc);
-		mNewTechniqueGL = Technique::create(RenderAPIOpenGL, "BansheeRenderer", { mNewPassGL });
-
-		// TODO - I need to create different techniques for different render systems (and renderers, if there were any),
-		// which is redundant as some techniques can be reused. I should add a functionality that supports multiple
-		// render systems/renderers per technique
-		mNewPassDX = Pass::create(passDesc);
-		mNewTechniqueDX = Technique::create(RenderAPIDX9, "BansheeRenderer", { mNewPassDX });
-
-		mNewPassDX11 = Pass::create(passDesc);
-		mNewTechniqueDX11 = Technique::create(RenderAPIDX11, "BansheeRenderer", { mNewPassDX11 });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4, RPS_WorldViewProjTfrm);
-
-		shaderDesc.addParameter("samp", "samp", GPOT_SAMPLER2D);
-		shaderDesc.addParameter("tex", "tex", GPOT_TEXTURE2D);
-
-		shaderDesc.setParamBlockAttribs("PerObject", true, GPBU_DYNAMIC, RBS_PerObject);
-
-		mTestShader = Shader::create("TestShader", shaderDesc, { mNewTechniqueGL, mNewTechniqueDX, mNewTechniqueDX11 });
+		gResources().save(mTestShader, L"C:\\testShader.asset", true);
+		gResources().unload(mTestShader);
+		mTestShader = gResources().load<Shader>(L"C:\\testShader.asset");
 
 		mTestMaterial = Material::create(mTestShader);
 

+ 1 - 1
BansheeEditor/Source/BsScenePicking.cpp

@@ -125,7 +125,7 @@ namespace BansheeEngine
 						if (firstPass->getRasterizerState() == nullptr)
 							rasterizerState = RasterizerState::getDefault();
 						else
-							rasterizerState = firstPass->getRasterizerState().getInternalPtr();
+							rasterizerState = firstPass->getRasterizerState();
 
 						CullingMode cullMode = rasterizerState->getProperties().getCullMode();
 

+ 1 - 1
BansheeEditorExec/BsEditorExec.cpp

@@ -65,7 +65,7 @@ int CALLBACK WinMain(
 	InitializeDebugConsole();
 #endif
 
-	EditorApplication::startUp(RenderSystemPlugin::OpenGL);
+	EditorApplication::startUp(RenderSystemPlugin::DX11);
 	EditorApplication::instance().runMainLoop();
 	EditorApplication::shutDown();
 

+ 0 - 1
BansheeEngine/BansheeEngine.vcxproj

@@ -286,7 +286,6 @@
     <ClInclude Include="Include\BsGUICommandEvent.h" />
     <ClInclude Include="Include\BsGUIContent.h" />
     <ClInclude Include="Include\BsGUIContextMenu.h" />
-    <ClInclude Include="Include\BsDebugDrawMaterialInfo.h" />
     <ClInclude Include="Include\BsGUIDropDownBox.h" />
     <ClInclude Include="Include\BsGUIDropDownBoxManager.h" />
     <ClInclude Include="Include\BsGUIDropDownHitBox.h" />

+ 0 - 3
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -206,9 +206,6 @@
     <ClInclude Include="Include\BsGUIMaterialInfo.h">
       <Filter>Header Files\GUI</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsDebugDrawMaterialInfo.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Include\BsScriptManager.h">
       <Filter>Header Files\Script</Filter>
     </ClInclude>

+ 7 - 41
BansheeEngine/Include/BsBuiltinResources.h

@@ -5,7 +5,6 @@
 #include "BsModule.h"
 #include "BsVector2I.h"
 #include "BsGUIMaterialInfo.h"
-#include "BsDebugDrawMaterialInfo.h"
 #include "BsApplication.h"
 
 namespace BansheeEngine
@@ -16,7 +15,7 @@ namespace BansheeEngine
 	class BS_EXPORT BuiltinResources : public BansheeEngine::Module<BuiltinResources>
 	{
 	public:
-		BuiltinResources(RenderSystemPlugin activeRSPlugin);
+		BuiltinResources();
 		~BuiltinResources();
 
 		/**
@@ -118,11 +117,6 @@ namespace BansheeEngine
 		 */
 		static HTexture getCursorTexture(const WString& name);
 
-		/**
-		 * @brief	Loads a GPU program with the specified filename.
-		 */
-		HGpuProgram getGpuProgram(const WString& name);
-
 		/**
 		 * @brief	Imports a GUI skin texture with the specified filename.
 		 *			Saves the imported texture in engine-ready format in the corresponding
@@ -138,26 +132,9 @@ namespace BansheeEngine
 		static void importCursorTexture(const WString& name);
 
 		/**
-		 * @brief	Loads an compiles a shader for text rendering.
-		 */
-		void initSpriteTextShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for image sprite rendering.
+		 * @brief	Loads a shader with the specified filename
 		 */
-		void initSpriteImageShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for non-transparent image sprite rendering.
-		 */
-		void initSpriteNonAlphaImageShader();
-
-		/**
-		 * @brief	Loads an compiles a simple shader to be used with no other is usable.
-		 */
-		void initDummyShader();
-
-		RenderSystemPlugin mRenderSystemPlugin;
+		static HShader getShader(const WString& name);
 
 		GUISkin mSkin;
 
@@ -179,9 +156,6 @@ namespace BansheeEngine
 		HShader mShaderSpriteNonAlphaImage;
 		HShader mShaderDummy;
 
-		WString mActiveShaderSubFolder;
-		StringID mActiveRenderSystem;
-
 		static const Path DefaultSkinFolderRaw;
 		static const Path DefaultCursorFolderRaw;
 		static const Path DefaultShaderFolderRaw;
@@ -190,10 +164,6 @@ namespace BansheeEngine
 		static const Path DefaultCursorFolder;
 		static const Path DefaultShaderFolder;
 
-		static const WString HLSL11ShaderSubFolder;
-		static const WString HLSL9ShaderSubFolder;
-		static const WString GLSLShaderSubFolder;
-
 		static const WString DefaultFontFilename;
 		static const UINT32 DefaultFontSize;
 
@@ -283,13 +253,9 @@ namespace BansheeEngine
 		static const Vector2I CursorSizeNWSEHotspot;
 		static const Vector2I CursorSizeWEHotspot;
 
-		static const WString ShaderSpriteTextVSFile;
-		static const WString ShaderSpriteTextPSFile;
-		static const WString ShaderSpriteImageVSFile;
-		static const WString ShaderSpriteImagePSFile;
-		static const WString ShaderDockOverlayVSFile;
-		static const WString ShaderDockOverlayPSFile;
-		static const WString ShaderDummyVSFile;
-		static const WString ShaderDummyPSFile;
+		static const WString ShaderSpriteTextFile;
+		static const WString ShaderSpriteImageAlphaFile;
+		static const WString ShaderSpriteImageNoAlphaFile;
+		static const WString ShaderDummyFile;
 	};
 }

+ 0 - 37
BansheeEngine/Include/BsDebugDrawMaterialInfo.h

@@ -1,37 +0,0 @@
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsGpuParam.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Contains data required for setting up and rendering with 
-	 *			material used for debug 2D clip space object rendering.
-	 */
-	struct DebugDraw2DClipSpaceMatInfo
-	{
-		HMaterial material;
-	};
-
-	/**
-	 * @brief	Contains data required for setting up and rendering with 
-	 *			material used for debug 2D screen space object rendering.
-	 */
-	struct DebugDraw2DScreenSpaceMatInfo
-	{
-		HMaterial material;
-		GpuParamFloat invViewportWidth;
-		GpuParamFloat invViewportHeight;
-	};
-
-	/**
-	 * @brief	Contains data required for setting up and rendering with 
-	 *			material used for debug 3D object rendering.
-	 */
-	struct DebugDraw3DMatInfo
-	{
-		HMaterial material;
-		GpuParamMat4 matViewProj;
-	};
-}

+ 1 - 1
BansheeEngine/Include/BsGUIMaterialManager.h

@@ -100,7 +100,7 @@ namespace BansheeEngine
 			UINT32 refCount;
 		};
 
-		HSamplerState mGUISamplerState;
+		SamplerStatePtr mGUISamplerState;
 
 		mutable Vector<GUIMaterial> mTextMaterials;
 		mutable Vector<GUIMaterial> mImageMaterials;

+ 2 - 1
BansheeEngine/Source/BsApplication.cpp

@@ -30,6 +30,7 @@ namespace BansheeEngine
 		desc.importers.push_back("BansheeFreeImgImporter");
 		desc.importers.push_back("BansheeFBXImporter");
 		desc.importers.push_back("BansheeFontImporter");
+		desc.importers.push_back("BansheeSL");
 
 		return desc;
 	}
@@ -43,7 +44,7 @@ namespace BansheeEngine
 
 		VirtualInput::startUp();
 		ScriptManager::startUp();
-		BuiltinResources::startUp(renderSystem);
+		BuiltinResources::startUp();
 		GUIManager::startUp();
 		GUIMaterialManager::startUp();
 		OverlayManager::startUp();

+ 28 - 238
BansheeEngine/Source/BsBuiltinResources.cpp

@@ -11,7 +11,6 @@
 
 #include "BsFont.h"
 #include "BsFontImportOptions.h"
-#include "BsGpuProgramImportOptions.h"
 #include "BsImporter.h"
 #include "BsResources.h"
 #include "BsGpuProgram.h"
@@ -40,10 +39,6 @@ namespace BansheeEngine
 	const Path BuiltinResources::DefaultCursorFolder = L"..\\..\\..\\..\\Data\\Engine\\Cursors\\";
 	const Path BuiltinResources::DefaultShaderFolder = L"..\\..\\..\\..\\Data\\Engine\\Shaders\\";
 
-	const WString BuiltinResources::HLSL11ShaderSubFolder = L"HLSL11/";
-	const WString BuiltinResources::HLSL9ShaderSubFolder = L"HLSL9/";
-	const WString BuiltinResources::GLSLShaderSubFolder = L"GLSL/";
-
 	/************************************************************************/
 	/* 								GUI TEXTURES                      		*/
 	/************************************************************************/
@@ -142,24 +137,10 @@ namespace BansheeEngine
 	/* 									SHADERS                      		*/
 	/************************************************************************/
 
-	struct GpuProgramImportData
-	{
-		WString filename;
-		String entryPoint;
-		GpuProgramType type;
-		GpuProgramProfile profile;
-		String language;
-		WString folder;
-	};
-
-	const WString BuiltinResources::ShaderSpriteTextVSFile = L"spriteTextVS.gpuprog";
-	const WString BuiltinResources::ShaderSpriteTextPSFile = L"spriteTextPS.gpuprog";
-	const WString BuiltinResources::ShaderSpriteImageVSFile = L"spriteImageVS.gpuprog";
-	const WString BuiltinResources::ShaderSpriteImagePSFile = L"spriteImagePS.gpuprog";
-	const WString BuiltinResources::ShaderDockOverlayVSFile = L"dockDropOverlayVS.gpuprog";
-	const WString BuiltinResources::ShaderDockOverlayPSFile = L"dockDropOverlayPS.gpuprog";
-	const WString BuiltinResources::ShaderDummyVSFile = L"dummyVS.gpuprog";
-	const WString BuiltinResources::ShaderDummyPSFile = L"dummyPS.gpuprog";
+	const WString BuiltinResources::ShaderSpriteTextFile = L"SpriteText.bsl";
+	const WString BuiltinResources::ShaderSpriteImageAlphaFile = L"SpriteImageAlpha.bsl";
+	const WString BuiltinResources::ShaderSpriteImageNoAlphaFile = L"SpriteImageNoAlpha.bsl";
+	const WString BuiltinResources::ShaderDummyFile = L"Dummy.bsl";
 
 	BuiltinResources::~BuiltinResources()
 	{
@@ -175,31 +156,14 @@ namespace BansheeEngine
 		mCursorSizeWE = nullptr;
 	}
 
-	BuiltinResources::BuiltinResources(RenderSystemPlugin activeRSPlugin)
-		:mRenderSystemPlugin(activeRSPlugin)
+	BuiltinResources::BuiltinResources()
 	{
-		switch (activeRSPlugin)
-		{
-		case RenderSystemPlugin::DX11:
-			mActiveShaderSubFolder = HLSL11ShaderSubFolder;
-			mActiveRenderSystem = RenderAPIDX11;
-			break;
-		case RenderSystemPlugin::DX9:
-			mActiveShaderSubFolder = HLSL9ShaderSubFolder;
-			mActiveRenderSystem = RenderAPIDX9;
-			break;
-		case RenderSystemPlugin::OpenGL:
-			mActiveShaderSubFolder = GLSLShaderSubFolder;
-			mActiveRenderSystem = RenderAPIOpenGL;
-			break;
-		}
-
 		preprocess();
 
-		initSpriteTextShader();
-		initSpriteImageShader();
-		initSpriteNonAlphaImageShader();
-		initDummyShader();
+		mShaderSpriteText = getShader(ShaderSpriteTextFile);
+		mShaderSpriteImage = getShader(ShaderSpriteImageAlphaFile);
+		mShaderSpriteNonAlphaImage = getShader(ShaderSpriteImageNoAlphaFile);
+		mShaderDummy = getShader(ShaderDummyFile);
 
 		mWhiteSpriteTexture = getSkinTexture(WhiteTex);
 
@@ -657,28 +621,6 @@ namespace BansheeEngine
 		static const WString CURSOR_TEXTURES[] = { CursorArrowTex, CursorArrowDragTex, CursorArrowLeftRightTex, CursorIBeamTex,
 			CursorDenyTex, CursorWaitTex, CursorSizeNESWTex, CursorSizeNSTex, CursorSizeNWSETex, CursorSizeWETex };
 
-		static const GpuProgramImportData GPU_PROGRAM_IMPORT_DATA[] =
-		{
-			{ ShaderSpriteTextVSFile,				"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder},
-			{ ShaderSpriteTextPSFile,				"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
-			{ ShaderSpriteImageVSFile,				"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
-			{ ShaderSpriteImagePSFile,				"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
-			{ ShaderDummyVSFile,					"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
-			{ ShaderDummyPSFile,					"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
-			{ ShaderSpriteTextVSFile,				"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
-			{ ShaderSpriteTextPSFile,				"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_2_0, "hlsl", HLSL9ShaderSubFolder },
-			{ ShaderSpriteImageVSFile,				"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
-			{ ShaderSpriteImagePSFile,				"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_2_0, "hlsl", HLSL9ShaderSubFolder },
-			{ ShaderDummyVSFile,					"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
-			{ ShaderDummyPSFile,					"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_FS_2_0, "hlsl", HLSL9ShaderSubFolder },
-			{ ShaderSpriteTextVSFile,				"main",			GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
-			{ ShaderSpriteTextPSFile,				"main",			GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
-			{ ShaderSpriteImageVSFile,				"main",			GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
-			{ ShaderSpriteImagePSFile,				"main",			GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
-			{ ShaderDummyVSFile,					"main",			GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
-			{ ShaderDummyPSFile,					"main",			GPT_FRAGMENT_PROGRAM,	GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
-		};
-
 		if (FileSystem::exists(DefaultCursorFolderRaw))
 		{
 			FileSystem::remove(DefaultCursorFolder);
@@ -735,37 +677,23 @@ namespace BansheeEngine
 
 		if (FileSystem::exists(DefaultShaderFolderRaw))
 		{
-			Path shaderFolder = DefaultShaderFolder;
-			shaderFolder.append(mActiveShaderSubFolder);
+			FileSystem::remove(DefaultShaderFolder);
 
-			FileSystem::remove(shaderFolder);
+			Vector<Path> directories;
+			Vector<Path> files;
+			FileSystem::getChildren(DefaultShaderFolderRaw, files, directories);
 
-			for (auto& importData : GPU_PROGRAM_IMPORT_DATA)
+			for (auto& shaderFile : files)
 			{
-				if (importData.folder != mActiveShaderSubFolder)
-					continue;
-
-				Path gpuProgInputLoc = DefaultShaderFolderRaw;
-				gpuProgInputLoc.append(importData.folder);
-				gpuProgInputLoc.append(importData.filename);
-
-				Path gpuProgOutputLoc = DefaultShaderFolder;
-				gpuProgOutputLoc.append(importData.folder);
-				gpuProgOutputLoc.append(importData.filename + L".asset");
+				HShader shader = Importer::instance().import<Shader>(shaderFile);
 
-				ImportOptionsPtr gpuProgImportOptions = Importer::instance().createImportOptions(gpuProgInputLoc);
-				if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
+				if (shader != nullptr)
 				{
-					GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
+					Path gpuProgOutputLoc = DefaultShaderFolder;
+					gpuProgOutputLoc.append(shaderFile.getWFilename() + L".asset");
 
-					importOptions->setEntryPoint(importData.entryPoint);
-					importOptions->setLanguage(importData.language);
-					importOptions->setProfile(importData.profile);
-					importOptions->setType(importData.type);
+					Resources::instance().save(shader, gpuProgOutputLoc, true);
 				}
-
-				HGpuProgram gpuProgram = Importer::instance().import<GpuProgram>(gpuProgInputLoc, gpuProgImportOptions);
-				Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
 			}
 		}
 
@@ -781,6 +709,14 @@ namespace BansheeEngine
 		return Resources::instance().load<SpriteTexture>(texturePath);
 	}
 
+	HShader BuiltinResources::getShader(const WString& name)
+	{
+		Path programPath = DefaultShaderFolder;
+		programPath.append(name + L".asset");
+
+		return gResources().load<Shader>(programPath);
+	}
+
 	HTexture BuiltinResources::getCursorTexture(const WString& name)
 	{
 		Path cursorPath = FileSystem::getWorkingDirectoryPath();
@@ -790,15 +726,6 @@ namespace BansheeEngine
 		return Resources::instance().load<Texture>(cursorPath);
 	}
 
-	HGpuProgram BuiltinResources::getGpuProgram(const WString& name)
-	{
-		Path programPath = DefaultShaderFolder;
-		programPath.append(mActiveShaderSubFolder);
-		programPath.append(name + L".asset");
-
-		return gResources().load<GpuProgram>(programPath);
-	}
-
 	void BuiltinResources::importSkinTexture(const WString& name)
 	{
 		Path texturePath = FileSystem::getWorkingDirectoryPath();
@@ -831,144 +758,7 @@ namespace BansheeEngine
 		HTexture tex = Importer::instance().import<Texture>(inputPath);
 		Resources::instance().save(tex, ouputPath, true);
 	}
-
-	void BuiltinResources::initSpriteTextShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(ShaderSpriteTextVSFile);
-		HGpuProgram psProgram = getGpuProgram(ShaderSpriteTextPSFile);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-		desc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
-
-		HBlendState blendState = BlendState::create(desc);
-		
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.blendState = blendState;
-		passDesc.depthStencilState = depthState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
-		shaderDesc.addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		shaderDesc.addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-
-		shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
-		shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
-
-		shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-		shaderDesc.addParameter("tint", "tint", GPDT_FLOAT4);
-
-		mShaderSpriteText = Shader::create("TextSpriteShader", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinResources::initSpriteImageShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(ShaderSpriteImageVSFile);
-		HGpuProgram psProgram = getGpuProgram(ShaderSpriteImagePSFile);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-		desc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
-
-		HBlendState blendState = BlendState::create(desc);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.blendState = blendState;
-		passDesc.depthStencilState = depthState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
-		shaderDesc.addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		shaderDesc.addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-
-		shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
-		shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
-
-		shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-		shaderDesc.addParameter("tint", "tint", GPDT_FLOAT4);
-
-		mShaderSpriteImage = Shader::create("ImageSpriteShader", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinResources::initSpriteNonAlphaImageShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(ShaderSpriteImageVSFile);
-		HGpuProgram psProgram = getGpuProgram(ShaderSpriteImagePSFile);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-		passDesc.depthStencilState = depthState;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
-		shaderDesc.addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		shaderDesc.addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-
-		shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
-		shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
-
-		shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-		shaderDesc.addParameter("tint", "tint", GPDT_FLOAT4);
-
-		mShaderSpriteNonAlphaImage = Shader::create("NonAlphaImageSpriteShader", shaderDesc, { newTechnique });
-	}
-
-	void BuiltinResources::initDummyShader()
-	{
-		HGpuProgram vsProgram = getGpuProgram(ShaderDummyVSFile);
-		HGpuProgram psProgram = getGpuProgram(ShaderDummyPSFile);
-
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vsProgram;
-		passDesc.fragmentProgram = psProgram;
-
-		PassPtr newPass = Pass::create(passDesc);
-		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererAny, { newPass });
-
-		SHADER_DESC shaderDesc;
-		shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
-
-		mShaderDummy = Shader::create("DummyShader", shaderDesc, { newTechnique });
-	}
-
+	
 	const PixelData& BuiltinResources::getCursorArrow(Vector2I& hotSpot)
 	{
 		hotSpot = CursorArrowHotspot;

+ 7 - 0
BansheeGLRenderSystem/Source/GLSL/src/BsGLSLGpuProgram.cpp

@@ -87,6 +87,8 @@ namespace BansheeEngine
 
 	void GLSLGpuProgramCore::initialize()
 	{
+		static const char GLSL_VERSION_LINE[] = "#version 430\n";
+
 		if (!isSupported())
 		{
 			mIsCompiled = false;
@@ -127,6 +129,11 @@ namespace BansheeEngine
 		{
 			Vector<GLchar*> lines;
 
+			GLchar* firstLineData = (GLchar*)stackAlloc(sizeof(GLSL_VERSION_LINE));
+			memcpy(firstLineData, GLSL_VERSION_LINE, sizeof(GLSL_VERSION_LINE));
+
+			lines.push_back(firstLineData);
+
 			UINT32 lineLength = 0;
 			for (UINT32 i = 0; i < source.size(); i++)
 			{

+ 7 - 4
BansheeRenderer/Source/BsBansheeLitTexRenderableController.cpp

@@ -337,8 +337,7 @@ namespace BansheeEngine
 		}
 		else if (rsName == RenderAPIOpenGL)
 		{
-			String vsCode = R"(#version 400
-
+			String vsCode = R"(
 			uniform PerFrame
 			{
 				float time;
@@ -351,13 +350,17 @@ namespace BansheeEngine
 
 			in vec3 bs_position;
 
+			out gl_PerVertex
+			{
+				vec4 gl_Position;
+			};
+
 			void main()
 			{
 				gl_Position = matWorldViewProj * vec4(bs_position.xyz + vec3(sin(time), 0, 0), 1);
 			})";
 
-			String psCode = R"(#version 400
-
+			String psCode = R"(
 			uniform Static
 			{
 				vec4 lightDir;

+ 7 - 2
BansheeRenderer/Source/BsBansheeRenderer.cpp

@@ -431,7 +431,7 @@ namespace BansheeEngine
 		}
 		else if (rsName == RenderAPIOpenGL)
 		{
-			String vsCode = R"(#version 400
+			String vsCode = R"(
 				uniform PerObject
 				{
 					mat4 matWorldViewProj;
@@ -439,12 +439,17 @@ namespace BansheeEngine
 
 				in vec3 bs_position;
 
+				out gl_PerVertex
+				{
+					vec4 gl_Position;
+				};
+
 				void main()
 				{
 					gl_Position = matWorldViewProj * vec4(bs_position.xyz, 1);
 				})";
 
-			String psCode = R"(#version 400
+			String psCode = R"(
 				out vec4 fragColor;
 
 				void main()

+ 417 - 454
BansheeSL/BsLexerFX.c

@@ -370,91 +370,82 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[753] =
+static yyconst flex_int16_t yy_accept[674] =
     {   0,
-        1,    1,  169,  167,    1,    1,  167,  167,    2,    2,
-      140,  139,  166,  166,  166,  166,  138,  166,  166,  166,
-      166,  166,  166,  166,  137,  166,  166,   94,   95,   96,
+        1,    1,  169,  167,    1,    1,  167,  167,  167,    2,
+        2,  140,  139,  166,  166,  166,  166,  138,  166,  166,
+      166,  166,  166,  166,  166,  166,  166,  166,  137,  166,
+      166,   94,   95,   96,  166,  166,  166,  166,  166,  166,
+      166,    1,    0,    5,    2,  165,    0,    2,    0,  166,
+      166,  166,  166,  166,  166,  166,  146,  166,  166,  166,
+      166,  166,  166,  104,  166,  166,  166,  166,  166,  166,
+      166,  110,  166,  166,  166,  166,  145,  144,  113,  166,
+      166,  166,  166,  166,  166,  108,  166,  166,  166,  166,
+      166,  166,  166,  166,  166,   84,  166,  166,  166,  166,
+
+      166,  143,  142,  166,  141,  166,  166,  166,  166,  166,
       166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
       166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,    1,    0,    5,  165,    0,    2,    0,  166,  166,
-      166,  166,  166,  146,  166,  166,  166,  166,  166,  166,
-      166,  166,  166,  166,  145,  144,  166,  166,  166,  166,
-      166,  166,  166,   84,  166,  166,  166,  143,  142,  141,
+      166,  166,  166,    2,  165,    4,    3,  166,  131,  166,
+      166,  166,  166,  166,  166,  166,  166,  166,  105,  166,
+      166,  166,  166,  166,  118,  166,  166,  166,  166,  166,
+      166,  166,  166,  166,  150,  112,  166,  166,  117,  121,
+      166,  166,  166,  166,  109,  166,  135,  134,  166,  166,
+      166,  166,  166,  166,  111,  166,  166,  122,  166,  166,
+      166,  166,  166,  166,  149,  166,  148,  147,  166,  166,
+
+      166,  166,  166,  132,  166,  166,  166,  166,  166,  166,
       166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-
-      166,  166,  166,  166,  166,  166,  166,  166,  166,  104,
-      166,  166,  110,  166,  166,  113,  166,  166,  166,  108,
-      166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,  166,  166,  166,  166,  166,  166,  165,    4,    3,
-      166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,  166,  166,  166,  166,  166,  166,  166,  150,  166,
-      166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,  166,  166,  149,  148,  147,  166,  166,  166,  166,
-      166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,  131,  166,  166,  166,  166,  105,  166,  166,  166,
-
-      166,  166,  166,  166,  112,  166,  166,  166,  166,  109,
-      166,  135,  134,  166,  111,  166,  166,  122,  166,  166,
+      166,  166,  166,  166,  166,  166,  166,  166,  166,    0,
+        4,  166,  166,  166,  166,  166,  166,  166,  166,  166,
+      166,  166,  166,  166,  166,   57,  166,  127,  166,  166,
+      166,  166,   83,  166,  106,   72,   56,  166,  166,   52,
+      166,  166,  166,  114,  166,  166,  166,  166,  166,  166,
+      166,  166,  166,  166,  166,  166,  166,  107,  166,  166,
+       48,  166,  166,  166,  151,  133,  166,  166,  128,  166,
       166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,    0,    4,  166,  166,  166,  166,  166,  166,  166,
-      166,  166,  166,  166,   57,  166,   83,  166,   72,   56,
-      166,  166,   52,  166,  166,  166,  166,  166,  166,  166,
-      166,  166,  166,  166,   48,  166,  166,  151,  166,  166,
-      166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,  166,  166,  166,  166,   97,  166,  166,  166,  166,
-      166,  106,  166,  166,  166,  166,  114,  166,  166,  166,
 
-      166,  166,  166,  166,  166,  107,  166,  166,  166,  166,
-      166,  166,  166,    6,  166,  101,  152,  115,    0,    4,
-      166,  166,   80,  166,   78,   38,  166,  166,   79,  166,
+      166,  166,  166,  166,  101,  152,  166,  115,  166,  166,
+       97,  166,  166,  166,  166,  166,  166,    6,  166,    0,
+        4,  166,  159,  166,   80,  166,  166,   78,   38,  166,
+      166,  154,   79,  166,  166,  166,  166,  129,  166,  166,
       166,  166,  166,  166,  166,  166,  166,  166,   77,  166,
       166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-       40,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,  166,  166,  166,  166,   73,   98,  166,  166,  154,
-      166,  166,  166,    7,    8,  166,  166,  166,  166,  166,
-      166,  166,  166,  166,  166,  157,  166,  166,  102,  166,
-      166,  166,  100,   63,  166,  166,  166,   44,  166,  166,
-
-      166,  166,  166,  166,  166,  166,  166,   53,  166,  166,
-      166,  166,  166,  166,  166,  166,  166,   92,   91,  166,
-      166,  166,  166,  166,  166,  166,  166,  166,   82,  166,
-      166,   76,  166,  166,  166,   49,  166,  166,  155,  166,
-      166,  166,    9,   10,   11,  166,  121,  158,   12,   13,
-       14,   15,   16,   17,   18,   19,   20,  153,  166,  103,
-      166,  166,  166,   99,  166,  163,  166,  166,  166,  166,
-      166,  166,  166,   54,  166,  166,  166,  166,  166,  166,
-      166,   47,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,  166,  166,  166,  166,   61,  166,   67,  166,  166,
-
-      166,  166,  166,  166,  166,  166,  164,  166,  166,  136,
-      166,  166,  116,  128,  166,  166,  166,  166,  166,  166,
-      166,  166,  166,  166,  166,  166,  166,   50,   51,  166,
-       46,  166,   89,  166,  166,  166,  166,  166,   41,   45,
+      166,  166,  166,  157,  166,  166,   40,  166,  166,  102,
+      130,  166,  166,  166,  166,  166,  166,  166,  166,  166,
+      166,  166,  166,  166,  166,  166,  166,   73,   98,    7,
+        8,  166,  166,  166,  166,  100,   63,  162,  166,  166,
+
+      166,  155,   44,  166,  166,  166,  166,  166,  166,  166,
+      123,  166,  166,  166,  166,  166,   53,  166,  166,  166,
+      166,  166,  158,  166,  153,  166,  166,  166,  166,   92,
+       91,  166,  166,  166,  103,  166,  160,  166,  166,  166,
+      166,  166,  124,  163,  166,  166,  166,  166,   82,  166,
+      166,   76,  166,  166,  166,   49,  166,    9,   10,   11,
+       12,   13,   14,   15,   16,   17,   18,   19,   20,   99,
+      166,  166,  166,  166,  166,  166,   54,  166,  120,  125,
+      164,  166,  166,  166,  166,  166,  166,  119,   47,  166,
+      161,  166,  166,  166,  166,  166,  166,  166,  136,  166,
+
+      166,  166,  116,  166,  126,  166,  166,   61,  166,   67,
+      166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
+      166,  166,  166,  166,  166,  166,   50,   51,  166,   46,
+      166,   89,  166,  166,  166,  166,  156,  166,   41,   45,
       166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
       166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,  166,  156,  166,  166,  166,  132,  166,  166,  166,
       166,  166,  166,  166,   58,   60,   64,  166,  166,   87,
        86,   88,  166,  166,  166,   21,   22,   23,  166,  166,
        39,  166,  166,  166,  166,   42,   26,   27,   28,  166,
-
-      166,   81,  166,  118,  166,  117,  166,  160,  166,  124,
-      166,  166,  166,  166,  166,   31,  166,  166,   65,  166,
-       90,  166,   43,  166,  166,  166,  166,  166,  166,   55,
-      166,  166,  166,  166,  166,  166,  166,  166,  166,  161,
-      166,  166,  166,   85,  166,  166,   93,  166,   66,  166,
-      166,   62,   25,   24,  166,  166,  166,  166,  166,  166,
-       30,   29,  166,  159,  166,  166,  166,  166,  166,  166,
-      166,   36,   34,  166,  166,  166,  166,  166,  166,  166,
-       32,  166,  166,  166,  127,  166,  166,  166,  166,  166,
-      166,   37,  166,  166,   71,  166,  166,  166,  166,   33,
-
-      166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
-      166,   70,  166,  166,   35,  166,  120,  166,  123,  119,
-      166,  166,  166,   74,  166,   59,   68,  166,  162,  166,
-      166,  130,  166,  166,   75,   69,  166,  166,  166,  133,
-      166,  166,  126,  166,  166,  166,  166,  129,  166,  166,
-      125,    0
+      166,   81,  166,  166,  166,  166,   31,  166,  166,   65,
+
+      166,   90,  166,   43,  166,  166,  166,  166,  166,  166,
+       55,  166,  166,  166,  166,  166,   85,  166,  166,   93,
+      166,   66,  166,  166,   62,   25,   24,  166,  166,  166,
+      166,  166,  166,   30,   29,  166,  166,   36,   34,  166,
+      166,  166,  166,  166,  166,  166,   32,  166,  166,   37,
+      166,  166,   71,  166,  166,  166,  166,   33,  166,  166,
+      166,   70,  166,  166,   35,   74,  166,   59,   68,  166,
+       75,   69,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -463,16 +454,16 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    2,    1,    4,    1,    1,    1,    1,    1,    1,
-        1,    1,    5,    1,    5,    6,    7,    8,    9,   10,
-       11,   12,   13,   13,   13,   13,   13,    1,    1,    1,
-        1,    1,    1,    1,   14,   15,   16,   17,   18,   19,
-       20,   21,   22,   23,   23,   24,   25,   23,   26,   27,
-       28,   29,   30,   31,   32,   33,   34,   35,   23,   36,
-        1,    1,    1,    1,   37,    1,   38,   39,   40,   41,
-
-       42,   43,   44,   45,   46,   23,   47,   48,   49,   50,
-       51,   52,   53,   54,   55,   56,   57,   58,   59,   60,
-       61,   62,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    5,    1,    6,    7,    8,    9,   10,   11,
+       12,   13,   14,   14,   14,   14,   14,    1,    1,    1,
+        1,    1,    1,    1,   15,   16,   17,   18,   19,   20,
+       21,   22,   23,   24,   25,   26,   27,   28,   29,   30,
+       31,   32,   33,   34,   35,   36,   37,   38,   39,   40,
+        1,    1,    1,    1,   24,    1,   41,   42,   43,   44,
+
+       45,   46,   47,   48,   49,   24,   50,   51,   52,   53,
+       54,   55,   56,   57,   58,   59,   60,   61,   24,   62,
+       63,   24,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -489,293 +480,270 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[63] =
+static yyconst flex_int32_t yy_meta[64] =
     {   0,
-        1,    1,    2,    1,    1,    1,    1,    3,    3,    3,
-        3,    3,    3,    4,    4,    4,    4,    3,    3,    5,
+        1,    1,    2,    1,    1,    1,    1,    1,    3,    3,
+        3,    3,    3,    3,    4,    4,    4,    4,    3,    3,
+        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    4,    4,    4,
-        4,    3,    3,    5,    5,    5,    5,    5,    5,    5,
+        4,    4,    4,    4,    3,    3,    5,    5,    5,    5,
         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5
+        5,    5,    5
     } ;
 
-static yyconst flex_int16_t yy_base[758] =
+static yyconst flex_int16_t yy_base[679] =
     {   0,
-        0,    0,  825,  826,   61,   63,  820,  816,   61,   69,
-       54,   62,   32,   42,    0,   53,   72,  765,  771,  782,
-       52,  767,   47,  761,   97,   78,   66,    0,  775,  762,
-      796,   74,  763,   85,   58,  760,   88,  756,  761,  768,
-       82,   59,   52,  759,   92,  766,   90,  753,  751,   86,
-      763,  146,  800,  826,    0,  142,  150,    0,    0,  779,
-      761,  749,  748,    0,  115,  745,  742,  119,  749,   90,
-      747,  749,  746,  755,    0,  778,  740,  742,  124,  739,
-      126,  121,  740,    0,  120,  741,  744,    0,  771,  162,
-      734,  734,  134,  730,  724,  136,  726,  139,  727,  724,
-
-      731,  738,  734,  728,  727,  716,  717,  711,  731,    0,
-      141,  718,    0,  136,  716,  724,  143,  723,  714,  721,
-       32,  135,  709,  148,  719,  705,  713,  706,  719,  145,
-      718,  716,  697,  715,  698,  713,  696,    0,  176,    0,
-      703,  694,  702,  704,  695,  704,  702,  700,  690,  688,
-      684,  690,  681,  680,  697,  686,  685,  688,    0,  682,
-      682,  681,  686,  683,  707,  711,  705,  173,  667,  684,
-      666,  669,  662,    0,    0,  704,  676,  664,  667,  659,
-      675,  658,  661,  653,  665,  663,  651,  664,  649,  648,
-      657,    0,  664,  646,  649,  658,    0,  649,  643,  640,
-
-      657,  646,  638,  654,    0,  637,  648,  637,  646,    0,
-      193,    0,    0,  633,    0,  149,  640,    0,  630,  634,
-      635,  628,  635,  626,  623,  622,  635,  632,  633,  622,
-      622,  202,  826,  622,  629,  632,  619,  627,  620,  624,
-      650,  610,  159,  606,    0,  617,    0,  615,    0,    0,
-      611,  617,    0,  601,  157,  600,  610,  605,  608,  607,
-      182,  614,  605,  601,    0,  595,  606,    0,  605,  598,
-      603,  589,  589,  602,  601,  600,  597,  588,  580,  595,
-      593,  592,  585,  577,  580,    0,  588,  577,  586,  581,
-      577,    0,  583,  568,  581,  568,    0,  583,  560,  559,
-
-      558,  566,  568,  567,  566,    0,  557,  574,  569,  569,
-      569,  562,  553,    0,  564,    0,    0,    0,  221,  227,
-      563,  549,  572,  561,    0,  546,  546,  542,    0,  544,
-      541,  547,  226,  545,  552,  537,  551,  549,    0,  552,
-      541,  542,  539,  538,  525,  534,  531,  527,  539,  534,
-        0,  525,  536,  536,  525,  537,  532,  527,  516,  515,
-      524,  515,  553,  507,  541,    0,    0,  509,  510,    0,
-      514,  512,  515,    0,  213,  511,  503,  504,  233,  237,
-      240,  503,  505,  507,  498,  516,  512,  510,    0,  508,
-      509,  510,    0,    0,  492,  495,  530,    0,  528,  500,
-
-      500,  499,  498,  493,  490,  495,  482,    0,  485,  480,
-      491,  482,  487,  474,  474,  472,  471,    0,    0,  511,
-      487,  468,  467,  480,  467,  503,  465,  479,    0,  469,
-      501,    0,  462,  472,  456,    0,  474,  457,    0,  468,
-      471,  468,    0,    0,    0,  465,    0,  469,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,  451,    0,
-      462,  463,  460,    0,  239,    0,  461,  475,  483,  441,
-      446,  453,  476,    0,  479,  455,  446,  453,  444,  433,
-      427,    0,  446,  444,  443,  433,  441,  440,  435,  431,
-      437,  417,  423,  247,  434,    0,  427,  233,  417,  416,
-
-      255,  429,  416,  419,  419,  412,    0,  417,  426,    0,
-      411,  415,    0,  426,  442,  405,  409,  408,  415,  409,
-      414,  398,  397,  398,  400,  410,  394,    0,    0,  411,
-        0,  394,    0,  393,  392,  407,  392,  389,    0,    0,
-      425,  424,  423,  407,  386,  395,  384,  393,  380,  390,
-      390,  414,  413,  412,  396,  384,  379,  373,  368,  377,
-      366,  372,    0,  368,  373,  403,  380,  375,  357,  371,
-      362,  358,  361,  367,    0,    0,    0,  367,  358,    0,
-        0,    0,  352,  358,  350,    0,  379,    0,  388,  346,
-        0,  254,  183,  355,  357,    0,    0,  374,    0,  383,
-
-      355,    0,  350,  358,  343,  356,  340,    0,  341,  353,
-      335,  346,  345,  344,  331,  355,  343,  339,    0,  325,
-        0,  338,    0,  349,  360,  332,  338,  321,  333,    0,
-      317,  330,  341,  352,  315,  328,  308,  316,  306,    0,
-      306,  317,  320,    0,  307,  306,    0,  325,    0,  316,
-      342,    0,    0,    0,  341,  315,  303,  328,  310,  297,
-        0,    0,  321,  312,  294,  247,  293,  304,  295,  286,
-      305,    0,    0,  288,  293,  294,  292,  288,  299,  311,
-      306,  300,  293,  294,  294,  310,  291,  274,  264,   95,
-      143,    0,  166,  189,    0,  198,  217,  236,  241,    0,
-
-      228,  226,  233,  265,  229,  227,  241,  230,  243,  236,
-      232,    0,  241,  234,    0,  238,    0,  241,  255,    0,
-      251,  240,  240,    0,  255,    0,    0,  250,    0,  240,
-      253,    0,  245,  259,    0,    0,  260,  253,  262,    0,
-      251,  248,    0,  252,  266,  267,  256,    0,  256,  270,
-        0,  826,  312,  315,  320,  323,  311
+        0,    0,  774,  775,   62,   64,  769,   59,  764,   67,
+       75,   75,   77,   78,   79,  740,   60,  105,  710,   55,
+        0,  750,   73,  112,   81,   88,   84,  708,  130,  123,
+      115,    0,  722,   79,  103,  111,   93,  725,  717,  707,
+      705,  145,  758,  775,  174,    0,  180,  188,    0,    0,
+      735,  742,  736,  714,  702,  701,    0,  723,  120,  697,
+      694,  715,  736,    0,  128,  699,  732,  714,  719,   36,
+      694,    0,  722,  695,  692,  701,    0,  726,  721,  685,
+      687,  137,  126,  718,  708,  716,  681,  695,  175,  149,
+      151,  681,  700,  188,  711,    0,  696,  705,  152,  678,
+
+      681,    0,  710,  694,  197,  688,  669,  695,  703,  704,
+      702,  665,  118,  661,  655,  169,  657,  172,  658,  655,
+      679,  695,  660,  676,  666,  657,  646,  653,  649,  643,
+      660,  640,  658,  207,    0,  203,    0,  649,    0,  664,
+      639,  647,  649,  675,  639,  648,  646,  644,    0,  661,
+      633,  631,  627,  633,  646,  209,  667,  622,  621,  638,
+      652,  626,  625,  628,    0,    0,  622,  622,  635,    0,
+      620,  625,  639,  649,    0,  620,    0,    0,  634,  645,
+      649,  643,  208,  603,    0,  196,  638,    0,  627,  631,
+      617,  599,  602,  595,    0,  628,    0,  638,  636,  607,
+
+      627,  214,  615,    0,  593,  596,  588,  604,  587,  590,
+      582,  594,  592,  580,  593,  578,  617,  605,  575,  604,
+      583,  590,  576,  571,  587,  227,  570,  581,  578,  245,
+      775,  571,  594,  577,  580,  567,  600,  574,  567,  571,
+      599,  584,  556,  192,  552,    0,  579,    0,  212,  589,
+      582,  560,    0,  558,    0,    0,    0,  554,  560,    0,
+      572,  543,  181,    0,  587,  541,  571,  550,  545,  548,
+      547,  204,  554,  545,  567,  566,  565,    0,  556,  537,
+        0,  531,  542,  571,    0,    0,  540,  566,    0,  215,
+      562,  559,  530,  535,  521,  521,  534,  533,  532,  529,
+
+      520,  512,  527,  525,    0,    0,  524,    0,  517,  509,
+        0,  521,  506,  502,  501,  500,  516,    0,  515,  252,
+      258,  514,  541,  499,  522,  511,  522,    0,  495,  495,
+      491,    0,    0,  493,  490,  496,  532,    0,  525,  529,
+      521,  257,  490,  497,  482,  525,  495,  493,    0,  505,
+      495,  503,  483,  484,  481,  480,  468,  476,  473,  469,
+      497,  499,  490,  506,  477,  472,    0,  503,  462,    0,
+        0,  497,  501,  499,  470,  470,  459,  471,  466,  461,
+      450,  449,  458,  449,  489,  442,  476,    0,    0,    0,
+      264,  268,  271,  274,  458,    0,    0,    0,  443,  446,
+
+      483,    0,    0,  481,  451,  451,  450,  449,  463,  476,
+        0,  474,  441,  438,  443,  430,    0,  433,  428,  454,
+      438,  429,  464,  433,    0,  420,  420,  418,  417,    0,
+        0,  459,  433,  441,    0,  453,    0,  412,  411,  450,
+      423,  451,    0,    0,  409,  447,  407,  421,    0,  411,
+      445,    0,  404,  414,  398,    0,  416,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      429,  438,  394,  399,  406,  431,    0,  434,    0,    0,
+        0,  408,  399,  406,  397,  386,  381,    0,    0,  399,
+        0,  397,  396,  386,  394,  393,  388,  384,    0,  403,
+
+      389,  370,    0,  375,    0,  280,  386,    0,  379,  264,
+      369,  368,  288,  381,  368,  371,  370,  377,  371,  376,
+      360,  359,  360,  362,  372,  356,    0,    0,  373,    0,
+      356,    0,  355,  354,  369,  354,    0,  351,    0,    0,
+      389,  388,  387,  369,  348,  357,  346,  355,  342,  352,
+      352,  378,  377,  376,  358,  346,  341,  346,  328,  342,
+      333,  329,  332,  338,    0,    0,    0,  338,  329,    0,
+        0,    0,  323,  329,  321,    0,  351,    0,  361,  317,
+        0,  286,   96,  326,  328,    0,    0,  346,    0,  356,
+      326,    0,  325,  324,  323,  310,  334,  322,  318,    0,
+
+      304,    0,  317,    0,  328,  341,  311,  317,  300,  312,
+        0,  296,  309,  320,  333,  294,    0,  293,  292,    0,
+      311,    0,  302,  330,    0,    0,    0,  329,  301,  289,
+      315,  296,  283,    0,    0,  307,  297,    0,    0,  280,
+      285,  286,  284,  280,  291,  304,  298,  292,  281,    0,
+      282,  285,    0,  266,  266,  282,  285,    0,  271,  255,
+      245,    0,  245,  230,    0,    0,  198,    0,    0,  126,
+        0,    0,  775,  306,  309,  314,  317,   94
     } ;
 
-static yyconst flex_int16_t yy_def[758] =
+static yyconst flex_int16_t yy_def[679] =
     {   0,
-      752,    1,  752,  752,  752,  752,  753,  752,  752,  752,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  752,  753,  752,  755,  752,  752,  756,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  755,  757,  756,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  752,  752,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  752,  752,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
-      754,    0,  752,  752,  752,  752,  752
+      673,    1,  673,  673,  673,  673,  674,  673,  673,  673,
+      673,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  673,  674,  673,  673,  676,  673,  673,  677,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  673,  676,  678,  677,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  673,
+      673,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  673,
+      673,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
+      675,  675,    0,  673,  673,  673,  673,  673
     } ;
 
-static yyconst flex_int16_t yy_nxt[889] =
+static yyconst flex_int16_t yy_nxt[839] =
     {   0,
-        4,    5,    6,    7,    4,    4,    8,    9,   10,   10,
-       10,   10,   10,   11,   12,   13,   14,   15,   16,   17,
-       18,   19,   15,   20,   21,   22,   23,   24,   25,   26,
-       27,   28,   29,   30,   15,   31,   15,   32,   33,   34,
-       35,   36,   37,   38,   15,   39,   40,   41,   42,   43,
-       44,   45,   15,   46,   47,   48,   49,   15,   50,   15,
-       15,   51,   52,   52,   52,   52,   56,   60,   57,   57,
-       57,   57,   57,   57,   56,   64,   57,   57,   57,   57,
-       57,   57,   68,   70,   85,   75,   76,  211,   69,   81,
-       72,  212,   71,  123,   61,   58,  121,   82,   73,  111,
-
-       86,   62,  124,   97,  122,   63,   74,   98,   83,   65,
-       88,   89,   66,   77,  103,   92,   90,   93,  112,   94,
-       58,  104,   67,  105,  108,  114,   99,  119,   95,  126,
-      106,  135,  109,   96,  129,  115,  708,  120,   91,  136,
-      130,  153,  127,  110,  154,  131,  132,   52,   52,  139,
-      139,  139,  139,  139,  139,   56,  145,   57,   57,   57,
-       57,   57,   57,  162,  163,  146,  149,  150,  151,  165,
-      167,  179,  168,  170,  171,  175,  176,  183,  186,  180,
-      199,  202,  206,  203,  213,  166,  709,  216,  214,  184,
-      217,  260,  223,  232,  233,  200,  330,  261,  187,  303,
-
-      207,  224,  299,  300,  301,  304,  319,  710,  338,  320,
-      320,  320,  320,  320,  320,  331,  339,  232,  233,  345,
-      629,  262,  443,  444,  445,  630,  711,  346,  320,  320,
-      320,  320,  320,  320,  320,  320,  320,  320,  320,  320,
-      404,  405,  449,  450,  451,  233,  452,  453,  454,  455,
-      456,  457,  514,  712,  406,  541,  542,  543,  547,  407,
-      685,  548,  544,  552,  553,  554,  549,  515,  627,  233,
-      555,  713,  628,  714,  715,  686,  716,  717,  718,  719,
-      720,  721,  722,  723,  724,  725,  726,  727,  728,  729,
-      730,  731,  732,  733,  734,  735,  736,  737,  738,  739,
-
-      740,  741,  742,  743,  744,  745,  746,  747,  748,  749,
-      750,  751,   53,  139,   53,   53,   53,   59,   59,   59,
-      138,  707,  138,  138,  138,  140,  140,  706,  705,  704,
-      703,  702,  701,  700,  699,  698,  697,  696,  695,  694,
-      693,  692,  691,  690,  689,  688,  687,  684,  683,  682,
-      681,  680,  679,  678,  677,  676,  675,  674,  673,  672,
-      671,  670,  669,  668,  667,  666,  665,  664,  663,  662,
-      661,  660,  659,  658,  657,  656,  655,  654,  653,  652,
-      651,  650,  649,  648,  647,  646,  645,  644,  643,  642,
-      641,  640,  639,  638,  637,  636,  635,  634,  633,  632,
-
-      631,  626,  625,  624,  623,  622,  621,  620,  619,  618,
-      617,  616,  615,  614,  613,  612,  611,  610,  609,  608,
-      607,  606,  605,  604,  603,  602,  601,  600,  599,  598,
-      597,  596,  595,  594,  593,  592,  591,  590,  589,  588,
-      587,  586,  585,  584,  583,  582,  581,  580,  579,  578,
-      577,  576,  575,  574,  573,  572,  571,  570,  569,  568,
-      567,  566,  565,  564,  563,  562,  561,  560,  559,  558,
-      557,  556,  551,  550,  546,  545,  540,  539,  538,  537,
-      536,  535,  534,  533,  532,  531,  530,  529,  528,  527,
-      526,  525,  524,  523,  522,  521,  520,  519,  518,  517,
-
-      516,  513,  512,  511,  510,  509,  508,  507,  506,  505,
-      504,  503,  502,  501,  500,  499,  498,  497,  496,  495,
-      494,  493,  492,  491,  490,  489,  488,  487,  486,  485,
-      484,  483,  482,  481,  480,  479,  478,  477,  476,  475,
-      474,  473,  472,  471,  470,  469,  468,  467,  466,  465,
-      464,  463,  462,  461,  460,  459,  458,  448,  447,  446,
-      442,  441,  440,  439,  438,  437,  436,  435,  434,  433,
-      432,  431,  430,  429,  428,  427,  426,  425,  424,  423,
-      422,  421,  420,  419,  418,  417,  416,  415,  414,  413,
-      412,  411,  410,  409,  408,  403,  402,  401,  400,  399,
-
-      398,  397,  396,  395,  394,  393,  392,  391,  390,  389,
-      388,  387,  386,  385,  384,  383,  382,  381,  380,  379,
-      378,  377,  376,  375,  374,  373,  372,  371,  370,  369,
-      368,  367,  366,  365,  364,  363,  362,  361,  360,  359,
-      358,  357,  356,  355,  354,  353,  352,  351,  350,  349,
-      348,  347,  344,  343,  342,  341,  340,  337,  336,  335,
-      334,  333,  332,  329,  328,  327,  326,  325,  324,  323,
-      322,  321,  318,  317,  316,  315,  314,  313,  312,  311,
-      310,  309,  308,  307,  306,  305,  302,  298,  297,  296,
-      295,  294,  293,  292,  291,  290,  289,  288,  287,  286,
-
-      285,  284,  283,  282,  281,  280,  279,  278,  277,  276,
-      275,  274,  273,  272,  271,  270,  269,  268,  267,  266,
-      265,  264,  263,  259,  258,  257,  256,  255,  254,  253,
-      252,  251,  250,  249,  248,  247,  246,  245,  244,  243,
-      242,  241,  240,  239,  238,  237,  236,  235,  234,  231,
-      230,  229,  228,  227,  226,  225,  222,  221,  220,  219,
-      218,  215,  210,  209,  208,  205,  204,  201,  198,  197,
-      196,  195,  194,  193,  192,  191,  190,  189,  188,  185,
-      182,  181,  178,  177,  174,  173,  172,  169,  164,  161,
-      160,  159,  158,  157,  156,  155,  152,  148,  147,  144,
-
-      143,  142,  141,   54,  137,  134,  133,  128,  125,  118,
-      117,  116,  113,  107,  102,  101,  100,   87,   84,   80,
-       79,   78,   55,   54,  752,    3,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752
+        4,    5,    6,    7,    4,    8,    4,    9,   10,   11,
+       11,   11,   11,   11,   12,   13,   14,   15,   16,   17,
+       18,   19,   20,   21,   22,   23,   24,   25,   26,   27,
+       28,   29,   30,   31,   32,   33,   34,   21,   21,   35,
+       36,   21,   21,   21,   21,   37,   21,   21,   21,   21,
+       21,   38,   21,   21,   21,   21,   21,   39,   40,   41,
+       21,   21,   21,   42,   42,   42,   42,   45,   45,   45,
+       45,   45,   45,   47,   73,   48,   48,   48,   48,   48,
+       48,   47,   82,   48,   48,   48,   48,   48,   48,   51,
+      158,   57,   52,  159,   62,   85,  136,   67,   97,   93,
+
+       74,  121,   53,   63,   49,   58,   86,   83,   75,   94,
+      122,   68,   98,   87,   64,   95,   76,   69,   54,   77,
+       78,  124,  125,   70,   99,   55,   88,   59,   49,   56,
+       60,   65,   71,  128,   89,  123,  610,   66,   79,   61,
+      100,  611,   96,  129,  102,  103,   42,   42,  104,   80,
+      105,  108,   90,  169,  109,  117,  110,  111,  206,  118,
+       91,  126,  106,  112,  145,  113,  207,  114,  171,  172,
+      127,   92,  170,  146,  107,  672,  115,  119,  151,  152,
+      153,  116,  134,  134,  134,  134,  134,  134,  136,  136,
+      136,  136,  136,  136,   47,  180,   48,   48,   48,   48,
+
+       48,   48,  178,  182,  186,  183,  179,  187,  191,  192,
+      181,  197,  198,  210,  213,  134,  134,  134,  134,  134,
+      134,  230,  231,  248,  275,  211,  338,  271,  289,  371,
+      276,  249,  334,  214,  272,  348,  290,  314,  315,  316,
+      250,  671,  349,  339,  357,  291,  372,  230,  231,  320,
+      320,  335,  358,  321,  321,  321,  321,  321,  321,  273,
+      321,  321,  321,  321,  321,  321,  321,  321,  321,  321,
+      321,  321,  413,  414,  458,  459,  460,  231,  461,  462,
+      463,  464,  465,  466,  467,  468,  469,  670,  415,  541,
+      542,  543,  547,  416,  669,  548,  544,  552,  553,  554,
+
+      549,  608,  668,  231,  555,  609,   43,  667,   43,   43,
+       43,   50,   50,   50,  135,  666,  135,  135,  135,  137,
+      137,  665,  664,  663,  662,  661,  660,  659,  658,  657,
+      656,  655,  654,  653,  652,  651,  650,  649,  648,  647,
+      646,  645,  644,  643,  642,  641,  640,  639,  638,  637,
+      636,  635,  634,  633,  632,  631,  630,  629,  628,  627,
+      626,  625,  624,  623,  622,  621,  620,  619,  618,  617,
+      616,  615,  614,  613,  612,  607,  606,  605,  604,  603,
+      602,  601,  600,  599,  598,  597,  596,  595,  594,  593,
+      592,  591,  590,  589,  588,  587,  586,  585,  584,  583,
+
+      582,  581,  580,  579,  578,  577,  576,  575,  574,  573,
+      572,  571,  570,  569,  568,  567,  566,  565,  564,  563,
+      562,  561,  560,  559,  558,  557,  556,  551,  550,  546,
+      545,  540,  539,  538,  537,  536,  535,  534,  533,  532,
+      531,  530,  529,  528,  527,  526,  525,  524,  523,  522,
+      521,  520,  519,  518,  517,  516,  515,  514,  513,  512,
+      511,  510,  509,  508,  507,  506,  505,  504,  503,  502,
+      501,  500,  499,  498,  497,  496,  495,  494,  493,  492,
+      491,  490,  489,  488,  487,  486,  485,  484,  483,  482,
+      481,  480,  479,  478,  477,  476,  475,  474,  473,  472,
+
+      471,  470,  457,  456,  455,  454,  453,  452,  451,  450,
+      449,  448,  447,  446,  445,  444,  443,  442,  441,  440,
+      439,  438,  437,  436,  435,  434,  433,  432,  431,  430,
+      429,  428,  427,  426,  425,  424,  423,  422,  421,  420,
+      419,  418,  417,  412,  411,  410,  409,  408,  407,  406,
+      405,  404,  403,  402,  401,  400,  399,  398,  397,  396,
+      395,  394,  393,  392,  391,  390,  389,  388,  387,  386,
+      385,  384,  383,  382,  381,  380,  379,  378,  377,  376,
+      375,  374,  373,  370,  369,  368,  367,  366,  365,  364,
+      363,  362,  361,  360,  359,  356,  355,  354,  353,  352,
+
+      351,  350,  347,  346,  345,  344,  343,  342,  341,  340,
+      337,  336,  333,  332,  331,  330,  329,  328,  327,  326,
+      325,  324,  323,  322,  319,  318,  317,  313,  312,  311,
+      310,  309,  308,  307,  306,  305,  304,  303,  302,  301,
+      300,  299,  298,  297,  296,  295,  294,  293,  292,  288,
+      287,  286,  285,  284,  283,  282,  281,  280,  279,  278,
+      277,  274,  270,  269,  268,  267,  266,  265,  264,  263,
+      262,  261,  260,  259,  258,  257,  256,  255,  254,  253,
+      252,  251,  247,  246,  245,  244,  243,  242,  241,  240,
+      239,  238,  237,  236,  235,  234,  233,  232,  229,  228,
+
+      227,  226,  225,  224,  223,  222,  221,  220,  219,  218,
+      217,  216,  215,  212,  209,  208,  205,  204,  203,  202,
+      201,  200,  199,  196,  195,  194,  193,  190,  189,  188,
+      185,  184,  177,  176,  175,  174,  173,  168,  167,  166,
+      165,  164,  163,  162,  161,  160,  157,  156,  155,  154,
+      150,  149,  148,  147,  144,  143,  142,  141,  140,  139,
+      138,   44,  133,  132,  131,  130,  120,  101,   84,   81,
+       72,   46,   44,  673,    3,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,
+
+      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  673,  673,  673,  673
     } ;
 
-static yyconst flex_int16_t yy_chk[889] =
+static yyconst flex_int16_t yy_chk[839] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -783,97 +751,92 @@ static yyconst flex_int16_t yy_chk[889] =
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    5,    5,    6,    6,    9,   11,    9,    9,
-        9,    9,    9,    9,   10,   12,   10,   10,   10,   10,
-       10,   10,   13,   14,   23,   17,   17,  121,   13,   21,
-       16,  121,   14,   43,   11,    9,   42,   21,   16,   35,
-
-       23,   11,   43,   27,   42,   11,   16,   27,   21,   12,
-       25,   25,   12,   17,   32,   26,   25,   26,   35,   26,
-        9,   32,   12,   32,   34,   37,   27,   41,   26,   45,
-       32,   50,   34,   26,   47,   37,  690,   41,   25,   50,
-       47,   70,   45,   34,   70,   47,   47,   52,   52,   56,
-       56,   56,   56,   56,   56,   57,   65,   57,   57,   57,
-       57,   57,   57,   79,   79,   65,   68,   68,   68,   81,
-       82,   93,   82,   85,   85,   90,   90,   96,   98,   93,
-      111,  114,  117,  114,  122,   81,  691,  124,  122,   96,
-      124,  168,  130,  139,  139,  111,  243,  168,   98,  216,
-
-      117,  130,  211,  211,  211,  216,  232,  693,  255,  232,
-      232,  232,  232,  232,  232,  243,  255,  139,  139,  261,
-      593,  168,  375,  375,  375,  593,  694,  261,  319,  319,
-      319,  319,  319,  319,  320,  320,  320,  320,  320,  320,
-      333,  333,  379,  379,  379,  320,  380,  380,  380,  381,
-      381,  381,  465,  696,  333,  494,  494,  494,  498,  333,
-      666,  498,  494,  501,  501,  501,  498,  465,  592,  320,
-      501,  697,  592,  698,  699,  666,  701,  702,  703,  704,
-      705,  706,  707,  708,  709,  710,  711,  713,  714,  716,
-      718,  719,  721,  722,  723,  725,  728,  730,  731,  733,
-
-      734,  737,  738,  739,  741,  742,  744,  745,  746,  747,
-      749,  750,  753,  757,  753,  753,  753,  754,  754,  754,
-      755,  689,  755,  755,  755,  756,  756,  688,  687,  686,
-      685,  684,  683,  682,  681,  680,  679,  678,  677,  676,
-      675,  674,  671,  670,  669,  668,  667,  665,  664,  663,
-      660,  659,  658,  657,  656,  655,  651,  650,  648,  646,
-      645,  643,  642,  641,  639,  638,  637,  636,  635,  634,
-      633,  632,  631,  629,  628,  627,  626,  625,  624,  622,
-      620,  618,  617,  616,  615,  614,  613,  612,  611,  610,
-      609,  607,  606,  605,  604,  603,  601,  600,  598,  595,
-
-      594,  590,  589,  587,  585,  584,  583,  579,  578,  574,
-      573,  572,  571,  570,  569,  568,  567,  566,  565,  564,
-      562,  561,  560,  559,  558,  557,  556,  555,  554,  553,
-      552,  551,  550,  549,  548,  547,  546,  545,  544,  543,
-      542,  541,  538,  537,  536,  535,  534,  532,  530,  527,
-      526,  525,  524,  523,  522,  521,  520,  519,  518,  517,
-      516,  515,  514,  512,  511,  509,  508,  506,  505,  504,
-      503,  502,  500,  499,  497,  495,  493,  492,  491,  490,
-      489,  488,  487,  486,  485,  484,  483,  481,  480,  479,
-      478,  477,  476,  475,  473,  472,  471,  470,  469,  468,
-
-      467,  463,  462,  461,  459,  448,  446,  442,  441,  440,
-      438,  437,  435,  434,  433,  431,  430,  428,  427,  426,
-      425,  424,  423,  422,  421,  420,  417,  416,  415,  414,
-      413,  412,  411,  410,  409,  407,  406,  405,  404,  403,
-      402,  401,  400,  399,  397,  396,  395,  392,  391,  390,
-      388,  387,  386,  385,  384,  383,  382,  378,  377,  376,
-      373,  372,  371,  369,  368,  365,  364,  363,  362,  361,
-      360,  359,  358,  357,  356,  355,  354,  353,  352,  350,
-      349,  348,  347,  346,  345,  344,  343,  342,  341,  340,
-      338,  337,  336,  335,  334,  332,  331,  330,  328,  327,
-
-      326,  324,  323,  322,  321,  315,  313,  312,  311,  310,
-      309,  308,  307,  305,  304,  303,  302,  301,  300,  299,
-      298,  296,  295,  294,  293,  291,  290,  289,  288,  287,
-      285,  284,  283,  282,  281,  280,  279,  278,  277,  276,
-      275,  274,  273,  272,  271,  270,  269,  267,  266,  264,
-      263,  262,  260,  259,  258,  257,  256,  254,  252,  251,
-      248,  246,  244,  242,  241,  240,  239,  238,  237,  236,
-      235,  234,  231,  230,  229,  228,  227,  226,  225,  224,
-      223,  222,  221,  220,  219,  217,  214,  209,  208,  207,
-      206,  204,  203,  202,  201,  200,  199,  198,  196,  195,
-
-      194,  193,  191,  190,  189,  188,  187,  186,  185,  184,
-      183,  182,  181,  180,  179,  178,  177,  176,  173,  172,
-      171,  170,  169,  167,  166,  165,  164,  163,  162,  161,
-      160,  158,  157,  156,  155,  154,  153,  152,  151,  150,
-      149,  148,  147,  146,  145,  144,  143,  142,  141,  137,
-      136,  135,  134,  133,  132,  131,  129,  128,  127,  126,
-      125,  123,  120,  119,  118,  116,  115,  112,  109,  108,
-      107,  106,  105,  104,  103,  102,  101,  100,   99,   97,
-       95,   94,   92,   91,   89,   87,   86,   83,   80,   78,
-       77,   76,   74,   73,   72,   71,   69,   67,   66,   63,
-
-       62,   61,   60,   53,   51,   49,   48,   46,   44,   40,
-       39,   38,   36,   33,   31,   30,   29,   24,   22,   20,
-       19,   18,    8,    7,    3,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
-      752,  752,  752,  752,  752,  752,  752,  752
+        1,    1,    1,    5,    5,    6,    6,    8,    8,    8,
+        8,    8,    8,   10,   17,   10,   10,   10,   10,   10,
+       10,   11,   20,   11,   11,   11,   11,   11,   11,   12,
+       70,   13,   12,   70,   14,   23,  678,   15,   27,   25,
+
+       17,   34,   12,   14,   10,   13,   23,   20,   17,   25,
+       34,   15,   27,   23,   14,   26,   17,   15,   12,   18,
+       18,   35,   35,   15,   27,   12,   24,   13,   10,   12,
+       13,   14,   15,   37,   24,   34,  583,   14,   18,   13,
+       27,  583,   26,   37,   29,   29,   42,   42,   29,   18,
+       29,   30,   24,   82,   30,   31,   30,   30,  113,   31,
+       24,   36,   29,   30,   59,   30,  113,   30,   83,   83,
+       36,   24,   82,   59,   29,  670,   30,   31,   65,   65,
+       65,   30,   45,   45,   45,   45,   45,   45,   47,   47,
+       47,   47,   47,   47,   48,   90,   48,   48,   48,   48,
+
+       48,   48,   89,   91,   94,   91,   89,   94,   99,   99,
+       90,  105,  105,  116,  118,  134,  134,  134,  134,  134,
+      134,  136,  136,  156,  186,  116,  249,  183,  202,  290,
+      186,  156,  244,  118,  183,  263,  202,  226,  226,  226,
+      156,  667,  263,  249,  272,  202,  290,  136,  136,  230,
+      230,  244,  272,  230,  230,  230,  230,  230,  230,  183,
+      320,  320,  320,  320,  320,  320,  321,  321,  321,  321,
+      321,  321,  342,  342,  391,  391,  391,  321,  392,  392,
+      392,  393,  393,  393,  394,  394,  394,  664,  342,  506,
+      506,  506,  510,  342,  663,  510,  506,  513,  513,  513,
+
+      510,  582,  661,  321,  513,  582,  674,  660,  674,  674,
+      674,  675,  675,  675,  676,  659,  676,  676,  676,  677,
+      677,  657,  656,  655,  654,  652,  651,  649,  648,  647,
+      646,  645,  644,  643,  642,  641,  640,  637,  636,  633,
+      632,  631,  630,  629,  628,  624,  623,  621,  619,  618,
+      616,  615,  614,  613,  612,  610,  609,  608,  607,  606,
+      605,  603,  601,  599,  598,  597,  596,  595,  594,  593,
+      591,  590,  588,  585,  584,  580,  579,  577,  575,  574,
+      573,  569,  568,  564,  563,  562,  561,  560,  559,  558,
+      557,  556,  555,  554,  553,  552,  551,  550,  549,  548,
+
+      547,  546,  545,  544,  543,  542,  541,  538,  536,  535,
+      534,  533,  531,  529,  526,  525,  524,  523,  522,  521,
+      520,  519,  518,  517,  516,  515,  514,  512,  511,  509,
+      507,  504,  502,  501,  500,  498,  497,  496,  495,  494,
+      493,  492,  490,  487,  486,  485,  484,  483,  482,  478,
+      476,  475,  474,  473,  472,  471,  457,  455,  454,  453,
+      451,  450,  448,  447,  446,  445,  442,  441,  440,  439,
+      438,  436,  434,  433,  432,  429,  428,  427,  426,  424,
+      423,  422,  421,  420,  419,  418,  416,  415,  414,  413,
+      412,  410,  409,  408,  407,  406,  405,  404,  401,  400,
+
+      399,  395,  387,  386,  385,  384,  383,  382,  381,  380,
+      379,  378,  377,  376,  375,  374,  373,  372,  369,  368,
+      366,  365,  364,  363,  362,  361,  360,  359,  358,  357,
+      356,  355,  354,  353,  352,  351,  350,  348,  347,  346,
+      345,  344,  343,  341,  340,  339,  337,  336,  335,  334,
+      331,  330,  329,  327,  326,  325,  324,  323,  322,  319,
+      317,  316,  315,  314,  313,  312,  310,  309,  307,  304,
+      303,  302,  301,  300,  299,  298,  297,  296,  295,  294,
+      293,  292,  291,  288,  287,  284,  283,  282,  280,  279,
+      277,  276,  275,  274,  273,  271,  270,  269,  268,  267,
+
+      266,  265,  262,  261,  259,  258,  254,  252,  251,  250,
+      247,  245,  243,  242,  241,  240,  239,  238,  237,  236,
+      235,  234,  233,  232,  229,  228,  227,  225,  224,  223,
+      222,  221,  220,  219,  218,  217,  216,  215,  214,  213,
+      212,  211,  210,  209,  208,  207,  206,  205,  203,  201,
+      200,  199,  198,  196,  194,  193,  192,  191,  190,  189,
+      187,  184,  182,  181,  180,  179,  176,  174,  173,  172,
+      171,  169,  168,  167,  164,  163,  162,  161,  160,  159,
+      158,  157,  155,  154,  153,  152,  151,  150,  148,  147,
+      146,  145,  144,  143,  142,  141,  140,  138,  133,  132,
+
+      131,  130,  129,  128,  127,  126,  125,  124,  123,  122,
+      121,  120,  119,  117,  115,  114,  112,  111,  110,  109,
+      108,  107,  106,  104,  103,  101,  100,   98,   97,   95,
+       93,   92,   88,   87,   86,   85,   84,   81,   80,   79,
+       78,   76,   75,   74,   73,   71,   69,   68,   67,   66,
+       63,   62,   61,   60,   58,   56,   55,   54,   53,   52,
+       51,   43,   41,   40,   39,   38,   33,   28,   22,   19,
+       16,    9,    7,    3,  673,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,
+
+      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  673,  673,  673,  673
     } ;
 
 /* Table of booleans, true if rule could match eol. */
@@ -903,7 +866,7 @@ static yyconst flex_int32_t yy_rule_can_match_eol[169] =
 #define YY_USER_ACTION yylloc->first_column = yycolumn + 1; yylloc->first_line = yylineno + 1; yycolumn += (int)yyleng;
 #define YY_USER_INIT yylineno = 0; yycolumn = 0;
 #define YY_NO_UNISTD_H 1
-#line 907 "BsLexerFX.c"
+#line 870 "BsLexerFX.c"
 
 #define INITIAL 0
 
@@ -1146,7 +1109,7 @@ YY_DECL
 #line 20 "BsLexerFX.l"
 
 
-#line 1150 "BsLexerFX.c"
+#line 1113 "BsLexerFX.c"
 
     yylval = yylval_param;
 
@@ -1203,13 +1166,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 753 )
+				if ( yy_current_state >= 674 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_current_state != 752 );
+		while ( yy_current_state != 673 );
 		yy_cp = yyg->yy_last_accepting_cpos;
 		yy_current_state = yyg->yy_last_accepting_state;
 
@@ -2092,7 +2055,7 @@ YY_RULE_SETUP
 #line 227 "BsLexerFX.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 2096 "BsLexerFX.c"
+#line 2059 "BsLexerFX.c"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -2387,7 +2350,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 753 )
+			if ( yy_current_state >= 674 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -2416,11 +2379,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 753 )
+		if ( yy_current_state >= 674 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 752);
+	yy_is_jam = (yy_current_state == 673);
 
 	(void)yyg;
 	return yy_is_jam ? 0 : yy_current_state;

+ 57 - 57
BansheeSL/BsLexerFX.l

@@ -9,7 +9,7 @@
 %option outfile="BsLexerFX.c" header-file="BsLexerFX.h"
 %option extra-type="struct tagParseState *"
 
-INTEGER			[0-9][0-9]*
+INTEGER			-?[0-9][0-9]*
 INTEGER_16		0[xX][0-9a-fA-F]+
 FLOAT			[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]?
 STRING			\"[^"\n]*\"
@@ -148,47 +148,47 @@ shared				{ return TOKEN_SHARED; }
 usage				{ return TOKEN_USAGE; }
 
 	/* State values */
-wire			{ yylval->intValue = FMV_Wire; return TOKEN_FILLMODEVALUE; }
-solid			{ yylval->intValue = FMV_Solid; return TOKEN_FILLMODEVALUE; }
-
-nocull			{ yylval->intValue = CMV_None; return TOKEN_CULLMODEVALUE; }
-cw				{ yylval->intValue = CMV_CW; return TOKEN_CULLMODEVALUE; }
-ccw				{ yylval->intValue = CMV_CCW; return TOKEN_CULLMODEVALUE; }
-
-fail			{ yylval->intValue = CFV_Fail; return TOKEN_COMPFUNCVALUE; }
-pass			{ yylval->intValue = CFV_Pass; return TOKEN_COMPFUNCVALUE; }
-lt				{ yylval->intValue = CFV_LT; return TOKEN_COMPFUNCVALUE; }
-lte				{ yylval->intValue = CFV_LTE; return TOKEN_COMPFUNCVALUE; }
-eq				{ yylval->intValue = CFV_EQ; return TOKEN_COMPFUNCVALUE; }
-neq				{ yylval->intValue = CFV_NEQ; return TOKEN_COMPFUNCVALUE; }
-gte				{ yylval->intValue = CFV_GTE; return TOKEN_COMPFUNCVALUE; }
-gt				{ yylval->intValue = CFV_GT; return TOKEN_COMPFUNCVALUE; }
-
-keep					{ yylval->intValue = OV_Keep; return TOKEN_OPVALUE; }
-zero					{ yylval->intValue = OV_Zero; return TOKEN_OPVALUE; }
-replace					{ yylval->intValue = OV_Replace; return TOKEN_OPVALUE; }
-increment				{ yylval->intValue = OV_Incr; return TOKEN_OPVALUE; }
-decrement				{ yylval->intValue = OV_Decr; return TOKEN_OPVALUE; }
-increment_wrap			{ yylval->intValue = OV_IncrWrap; return TOKEN_OPVALUE; }
-decrement_wrap			{ yylval->intValue = OV_DecrWrap; return TOKEN_OPVALUE; }
-invert					{ yylval->intValue = OV_Invert; return TOKEN_OPVALUE; }
-one						{ yylval->intValue = OV_One; return TOKEN_OPVALUE; }
-destinationRGB			{ yylval->intValue = OV_DestColor; return TOKEN_OPVALUE; }
-sourceRGB				{ yylval->intValue = OV_SrcColor; return TOKEN_OPVALUE; }
-destinationRGB_inverse	{ yylval->intValue = OV_InvDestColor; return TOKEN_OPVALUE; }
-sourceRGB_inverse		{ yylval->intValue = OV_InvSrcColor; return TOKEN_OPVALUE; }
-destinationA			{ yylval->intValue = OV_DestAlpha; return TOKEN_OPVALUE; }
-sourceA					{ yylval->intValue = OV_SrcAlpha; return TOKEN_OPVALUE; }
-destinationA_inverse	{ yylval->intValue = OV_InvDestAlpha; return TOKEN_OPVALUE; }
-sourceA_inverse			{ yylval->intValue = OV_InvSrcAlpha; return TOKEN_OPVALUE; }
-
-add					{ yylval->intValue = BOV_Add; return TOKEN_BLENDOPVALUE; }
-subtract			{ yylval->intValue = BOV_Subtract; return TOKEN_BLENDOPVALUE; }
-subtract_reverse	{ yylval->intValue = BOV_RevSubtract; return TOKEN_BLENDOPVALUE; }
-min					{ yylval->intValue = BOV_Min; return TOKEN_BLENDOPVALUE; }
-max					{ yylval->intValue = BOV_Max; return TOKEN_BLENDOPVALUE; }
-
-nocolor			{ yylval->intValue = 0x0; return TOKEN_COLORMASK; }
+WIRE			{ yylval->intValue = FMV_Wire; return TOKEN_FILLMODEVALUE; }
+SOLID			{ yylval->intValue = FMV_Solid; return TOKEN_FILLMODEVALUE; }
+
+NOCULL			{ yylval->intValue = CMV_None; return TOKEN_CULLMODEVALUE; }
+CW				{ yylval->intValue = CMV_CW; return TOKEN_CULLMODEVALUE; }
+CCW				{ yylval->intValue = CMV_CCW; return TOKEN_CULLMODEVALUE; }
+
+FAIL			{ yylval->intValue = CFV_Fail; return TOKEN_COMPFUNCVALUE; }
+PASS			{ yylval->intValue = CFV_Pass; return TOKEN_COMPFUNCVALUE; }
+LT				{ yylval->intValue = CFV_LT; return TOKEN_COMPFUNCVALUE; }
+LTE				{ yylval->intValue = CFV_LTE; return TOKEN_COMPFUNCVALUE; }
+EQ				{ yylval->intValue = CFV_EQ; return TOKEN_COMPFUNCVALUE; }
+NEQ				{ yylval->intValue = CFV_NEQ; return TOKEN_COMPFUNCVALUE; }
+GTE				{ yylval->intValue = CFV_GTE; return TOKEN_COMPFUNCVALUE; }
+GT				{ yylval->intValue = CFV_GT; return TOKEN_COMPFUNCVALUE; }
+
+KEEP				{ yylval->intValue = OV_Keep; return TOKEN_OPVALUE; }
+ZERO				{ yylval->intValue = OV_Zero; return TOKEN_OPVALUE; }
+REPLACE				{ yylval->intValue = OV_Replace; return TOKEN_OPVALUE; }
+INC					{ yylval->intValue = OV_Incr; return TOKEN_OPVALUE; }
+DEC					{ yylval->intValue = OV_Decr; return TOKEN_OPVALUE; }
+INCWRAP				{ yylval->intValue = OV_IncrWrap; return TOKEN_OPVALUE; }
+DECWRAP				{ yylval->intValue = OV_DecrWrap; return TOKEN_OPVALUE; }
+INV					{ yylval->intValue = OV_Invert; return TOKEN_OPVALUE; }
+ONE					{ yylval->intValue = OV_One; return TOKEN_OPVALUE; }
+DSTRGB				{ yylval->intValue = OV_DestColor; return TOKEN_OPVALUE; }
+SRCRGB				{ yylval->intValue = OV_SrcColor; return TOKEN_OPVALUE; }
+DSTIRGB				{ yylval->intValue = OV_InvDestColor; return TOKEN_OPVALUE; }
+SRCIRGB				{ yylval->intValue = OV_InvSrcColor; return TOKEN_OPVALUE; }
+DSTA				{ yylval->intValue = OV_DestAlpha; return TOKEN_OPVALUE; }
+SRCA				{ yylval->intValue = OV_SrcAlpha; return TOKEN_OPVALUE; }
+DSTIA				{ yylval->intValue = OV_InvDestAlpha; return TOKEN_OPVALUE; }
+SRCIA				{ yylval->intValue = OV_InvSrcAlpha; return TOKEN_OPVALUE; }
+
+ADD					{ yylval->intValue = BOV_Add; return TOKEN_BLENDOPVALUE; }
+SUB					{ yylval->intValue = BOV_Subtract; return TOKEN_BLENDOPVALUE; }
+RSUB				{ yylval->intValue = BOV_RevSubtract; return TOKEN_BLENDOPVALUE; }
+MIN					{ yylval->intValue = BOV_Min; return TOKEN_BLENDOPVALUE; }
+MAX					{ yylval->intValue = BOV_Max; return TOKEN_BLENDOPVALUE; }
+
+NOCOLOR			{ yylval->intValue = 0x0; return TOKEN_COLORMASK; }
 R				{ yylval->intValue = 0x1; return TOKEN_COLORMASK; }
 G				{ yylval->intValue = 0x2; return TOKEN_COLORMASK; }
 B				{ yylval->intValue = 0x4; return TOKEN_COLORMASK; }
@@ -205,21 +205,21 @@ RBA				{ yylval->intValue = 0xD; return TOKEN_COLORMASK; }
 GBA				{ yylval->intValue = 0xE; return TOKEN_COLORMASK; }
 RGBA			{ yylval->intValue = 0xF; return TOKEN_COLORMASK; }
 
-wrap			{ yylval->intValue = AMV_Wrap; return TOKEN_ADDRMODEVALUE; }
-mirror			{ yylval->intValue = AMV_Mirror; return TOKEN_ADDRMODEVALUE; }
-clamp			{ yylval->intValue = AMV_Clamp; return TOKEN_ADDRMODEVALUE; }
-border			{ yylval->intValue = AMV_Border; return TOKEN_ADDRMODEVALUE; }
-
-nofilter		{ yylval->intValue = FV_None; return TOKEN_FILTERVALUE; }
-point			{ yylval->intValue = FV_Point; return TOKEN_FILTERVALUE; }
-linear			{ yylval->intValue = FV_Linear; return TOKEN_FILTERVALUE; }
-anisotropic		{ yylval->intValue = FV_Anisotropic; return TOKEN_FILTERVALUE; }
-point_cmp		{ yylval->intValue = FV_PointCmp; return TOKEN_FILTERVALUE; }
-linear_cmp		{ yylval->intValue = FV_LinearCmp; return TOKEN_FILTERVALUE; }
-anisotropic_cmp	{ yylval->intValue = FV_AnisotropicCmp; return TOKEN_FILTERVALUE; }
-
-static			{ yylval->intValue = BUV_Static; return TOKEN_BUFFERUSAGE; }
-dynamic			{ yylval->intValue = BUV_Dynamic; return TOKEN_BUFFERUSAGE; }
+WRAP			{ yylval->intValue = AMV_Wrap; return TOKEN_ADDRMODEVALUE; }
+MIRROR			{ yylval->intValue = AMV_Mirror; return TOKEN_ADDRMODEVALUE; }
+CLAMP			{ yylval->intValue = AMV_Clamp; return TOKEN_ADDRMODEVALUE; }
+BORDER			{ yylval->intValue = AMV_Border; return TOKEN_ADDRMODEVALUE; }
+
+NOFILTER		{ yylval->intValue = FV_None; return TOKEN_FILTERVALUE; }
+POINT			{ yylval->intValue = FV_Point; return TOKEN_FILTERVALUE; }
+LINEAR			{ yylval->intValue = FV_Linear; return TOKEN_FILTERVALUE; }
+ANISO			{ yylval->intValue = FV_Anisotropic; return TOKEN_FILTERVALUE; }
+POINTC			{ yylval->intValue = FV_PointCmp; return TOKEN_FILTERVALUE; }
+LINEARC			{ yylval->intValue = FV_LinearCmp; return TOKEN_FILTERVALUE; }
+ANISOC			{ yylval->intValue = FV_AnisotropicCmp; return TOKEN_FILTERVALUE; }
+
+STATIC			{ yylval->intValue = BUV_Static; return TOKEN_BUFFERUSAGE; }
+DYNAMIC			{ yylval->intValue = BUV_Dynamic; return TOKEN_BUFFERUSAGE; }
 
 {COMMENT}		{ }
 {IDENTIFIER}	{ yylval->strValue = mmalloc_strdup(yyextra->memContext, yytext); return TOKEN_IDENTIFIER; }

Разница между файлами не показана из-за своего большого размера
+ 434 - 394
BansheeSL/BsParserFX.c


+ 67 - 22
BansheeSL/BsParserFX.y

@@ -297,26 +297,28 @@ pass_statement
 	;
 
 pass_option
-	: TOKEN_FILLMODE '=' TOKEN_FILLMODEVALUE ';'			{ $$.type = OT_FillMode; $$.value.intValue = $3; }
-	| TOKEN_CULLMODE '=' TOKEN_CULLMODEVALUE ';'			{ $$.type = OT_CullMode; $$.value.intValue = $3; }
-	| TOKEN_DEPTHBIAS '=' TOKEN_FLOAT ';'					{ $$.type = OT_DepthBias; $$.value.floatValue = $3; }
-	| TOKEN_SDEPTHBIAS '=' TOKEN_FLOAT ';'					{ $$.type = OT_SDepthBias; $$.value.floatValue = $3; }
-	| TOKEN_DEPTHCLIP '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_DepthClip; $$.value.intValue = $3; }
-	| TOKEN_SCISSOR '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_Scissor; $$.value.intValue = $3; }
-	| TOKEN_MULTISAMPLE '=' TOKEN_BOOLEAN ';'				{ $$.type = OT_Multisample; $$.value.intValue = $3; }
-	| TOKEN_AALINE '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_AALine; $$.value.intValue = $3; }
-	| TOKEN_DEPTHREAD '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_DepthRead; $$.value.intValue = $3; }
-	| TOKEN_DEPTHWRITE '=' TOKEN_BOOLEAN ';'				{ $$.type = OT_DepthWrite; $$.value.intValue = $3; }
-	| TOKEN_COMPAREFUNC '=' TOKEN_COMPFUNCVALUE ';'			{ $$.type = OT_CompareFunc; $$.value.intValue = $3; }
-	| TOKEN_STENCIL '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_Stencil; $$.value.intValue = $3; }
-	| TOKEN_STENCILREADMASK '=' TOKEN_INTEGER ';'			{ $$.type = OT_StencilReadMask; $$.value.intValue = $3; }
-	| TOKEN_STENCILWRITEMASK '=' TOKEN_INTEGER ';'			{ $$.type = OT_StencilWriteMask; $$.value.intValue = $3; }
-	| stencil_op_front_header '{' stencil_op_body '}' ';'	{ nodePop(parse_state); $$.type = OT_StencilOpFront; $$.value.nodePtr = $1; }
-	| stencil_op_back_header '{' stencil_op_body '}' ';'	{ nodePop(parse_state); $$.type = OT_StencilOpBack; $$.value.nodePtr = $1; }
-	| TOKEN_ALPHATOCOVERAGE '=' TOKEN_BOOLEAN ';'			{ $$.type = OT_AlphaToCoverage; $$.value.intValue = $3; }
-	| TOKEN_INDEPENDANTBLEND '=' TOKEN_BOOLEAN ';'			{ $$.type = OT_IndependantBlend; $$.value.intValue = $3; }
-	| target												{ $$.type = OT_Target; $$.value.nodePtr = $1; }
-	| TOKEN_STENCILREF '=' TOKEN_INTEGER ';'				{ $$.type = OT_StencilRef; $$.value.intValue = $3; }
+	: TOKEN_FILLMODE '=' TOKEN_FILLMODEVALUE ';'				{ $$.type = OT_FillMode; $$.value.intValue = $3; }
+	| TOKEN_CULLMODE '=' TOKEN_CULLMODEVALUE ';'				{ $$.type = OT_CullMode; $$.value.intValue = $3; }
+	| TOKEN_DEPTHBIAS '=' TOKEN_FLOAT ';'						{ $$.type = OT_DepthBias; $$.value.floatValue = $3; }
+	| TOKEN_SDEPTHBIAS '=' TOKEN_FLOAT ';'						{ $$.type = OT_SDepthBias; $$.value.floatValue = $3; }
+	| TOKEN_DEPTHCLIP '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_DepthClip; $$.value.intValue = $3; }
+	| TOKEN_SCISSOR '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_Scissor; $$.value.intValue = $3; }
+	| TOKEN_MULTISAMPLE '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_Multisample; $$.value.intValue = $3; }
+	| TOKEN_AALINE '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_AALine; $$.value.intValue = $3; }
+	| TOKEN_DEPTHREAD '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_DepthRead; $$.value.intValue = $3; }
+	| TOKEN_DEPTHWRITE '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_DepthWrite; $$.value.intValue = $3; }
+	| TOKEN_COMPAREFUNC '=' TOKEN_COMPFUNCVALUE ';'				{ $$.type = OT_CompareFunc; $$.value.intValue = $3; }
+	| TOKEN_STENCIL '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_Stencil; $$.value.intValue = $3; }
+	| TOKEN_STENCILREADMASK '=' TOKEN_INTEGER ';'				{ $$.type = OT_StencilReadMask; $$.value.intValue = $3; }
+	| TOKEN_STENCILWRITEMASK '=' TOKEN_INTEGER ';'				{ $$.type = OT_StencilWriteMask; $$.value.intValue = $3; }
+	| stencil_op_front_header '{' stencil_op_body '}' ';'		{ nodePop(parse_state); $$.type = OT_StencilOpFront; $$.value.nodePtr = $1; }
+	| stencil_op_back_header '{' stencil_op_body '}' ';'		{ nodePop(parse_state); $$.type = OT_StencilOpBack; $$.value.nodePtr = $1; }
+	| stencil_op_front_header '{' stencil_op_body_init '}' ';'	{ nodePop(parse_state); $$.type = OT_StencilOpFront; $$.value.nodePtr = $1; }
+	| stencil_op_back_header '{' stencil_op_body_init '}' ';'	{ nodePop(parse_state); $$.type = OT_StencilOpBack; $$.value.nodePtr = $1; }
+	| TOKEN_ALPHATOCOVERAGE '=' TOKEN_BOOLEAN ';'				{ $$.type = OT_AlphaToCoverage; $$.value.intValue = $3; }
+	| TOKEN_INDEPENDANTBLEND '=' TOKEN_BOOLEAN ';'				{ $$.type = OT_IndependantBlend; $$.value.intValue = $3; }
+	| target													{ $$.type = OT_Target; $$.value.nodePtr = $1; }
+	| TOKEN_STENCILREF '=' TOKEN_INTEGER ';'					{ $$.type = OT_StencilRef; $$.value.intValue = $3; }
 	;
 
 	/* Code blocks */
@@ -386,6 +388,21 @@ stencil_op_back_header
 		}
 	;
 
+stencil_op_body_init
+	: TOKEN_OPVALUE ',' TOKEN_OPVALUE ',' TOKEN_OPVALUE ',' TOKEN_COMPFUNCVALUE
+		{
+			NodeOption fail; fail.type = OT_Fail; fail.value.intValue = $1;
+			NodeOption zfail; zfail.type = OT_ZFail; zfail.value.intValue = $3;
+			NodeOption pass; pass.type = OT_PassOp; pass.value.intValue = $5;
+			NodeOption cmp; cmp.type = OT_CompareFunc; cmp.value.intValue = $7;
+
+			nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &fail);
+			nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &zfail);
+			nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &pass);
+			nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &cmp);
+		}
+	;
+
 stencil_op_body
 	: /* empty */
 	| stencil_op_option stencil_op_body		{ nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &$1); }
@@ -425,6 +442,8 @@ target_option
 	| TOKEN_BLEND '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_Blend; $$.value.intValue = $3; }
 	| blend_color_header '{' blenddef_body '}' ';'		{ nodePop(parse_state); $$.type = OT_Color; $$.value.nodePtr = $1; }
 	| blend_alpha_header '{' blenddef_body '}' ';'		{ nodePop(parse_state); $$.type = OT_Alpha; $$.value.nodePtr = $1; }
+	| blend_color_header '{' blenddef_body_init '}' ';'		{ nodePop(parse_state); $$.type = OT_Color; $$.value.nodePtr = $1; }
+	| blend_alpha_header '{' blenddef_body_init '}' ';'		{ nodePop(parse_state); $$.type = OT_Alpha; $$.value.nodePtr = $1; }
 	| TOKEN_WRITEMASK '=' TOKEN_COLORMASK ';'			{ $$.type = OT_WriteMask; $$.value.intValue = $3; }
 	;
 
@@ -450,6 +469,19 @@ blenddef_body
 	| blenddef_option blenddef_body		{ nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &$1); }
 	;
 
+blenddef_body_init
+	: TOKEN_OPVALUE ',' TOKEN_OPVALUE ',' TOKEN_BLENDOPVALUE
+		{
+			NodeOption src; src.type = OT_Source; src.value.intValue = $1;
+			NodeOption dst; dst.type = OT_Dest; dst.value.intValue = $3;
+			NodeOption op; op.type = OT_Op; op.value.intValue = $5;
+
+			nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &src);
+			nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &dst);
+			nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &op);
+		}
+	;
+
 blenddef_option
 	: TOKEN_SOURCE '=' TOKEN_OPVALUE ';'					{ $$.type = OT_Source; $$.value.intValue = $3; }
 	| TOKEN_DEST '=' TOKEN_OPVALUE ';'						{ $$.type = OT_Dest; $$.value.intValue = $3; }
@@ -458,7 +490,6 @@ blenddef_option
 
 	/* Sampler state */
 
-
 sampler_state_body
 	: /* empty */
 	| sampler_state_option sampler_state_body		{ nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &$1); }
@@ -479,7 +510,8 @@ sampler_state_option
 
 	/* Addresing mode */
 addr_mode
-	: addr_mode_header '{' addr_mode_body '}' ';' { nodePop(parse_state); $$ = $1; }
+	: addr_mode_header '{' addr_mode_body '}' ';'		{ nodePop(parse_state); $$ = $1; }
+	| addr_mode_header '{' addr_mode_body_init '}' ';'	{ nodePop(parse_state); $$ = $1; }
 	;
 
 addr_mode_header
@@ -490,6 +522,19 @@ addr_mode_header
 		}
 	;
 
+addr_mode_body_init
+	: TOKEN_ADDRMODEVALUE ',' TOKEN_ADDRMODEVALUE ',' TOKEN_ADDRMODEVALUE
+		{
+			NodeOption u; u.type = OT_U; u.value.intValue = $1;
+			NodeOption v; v.type = OT_V; v.value.intValue = $3;
+			NodeOption w; w.type = OT_W; w.value.intValue = $5;
+
+			nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &u);
+			nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &v);
+			nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &w);
+		}
+	;
+
 addr_mode_body
 	: /* empty */
 	| addr_mode_option addr_mode_body		{ nodeOptionsAdd(parse_state->memContext, parse_state->topNode->options, &$1); }

+ 12 - 12
BansheeSL/Include/BsSLFXCompiler.h

@@ -151,28 +151,28 @@ namespace BansheeEngine
 		static void parseRenderTargetBlendState(BLEND_STATE_DESC& desc, ASTFXNode* targetNode);
 
 		/**
-		 * @brief	Parses the blend state AST node and outputs a blend state object, or an invalid
-		 *			handle in case AST node is empty. 
+		 * @brief	Parses the blend state AST node and outputs a blend state object, or a nullptr
+		 *			in case AST node is empty. 
 		 */
-		static HBlendState parseBlendState(ASTFXNode* passNode);
+		static BlendStatePtr parseBlendState(ASTFXNode* passNode);
 
 		/**
-		 * @brief	Parses the rasterizer state AST node and outputs a rasterizer state object, or an invalid
-		 *			handle in case AST node is empty. 
+		 * @brief	Parses the rasterizer state AST node and outputs a rasterizer state object, or a nullptr
+		 *			in case AST node is empty. 
 		 */
-		static HRasterizerState parseRasterizerState(ASTFXNode* passNode);
+		static RasterizerStatePtr parseRasterizerState(ASTFXNode* passNode);
 
 		/**
-		 * @brief	Parses the depth-stencil state AST node and outputs a depth-stencil state object, or an invalid
-		 *			handle in case AST node is empty. 
+		 * @brief	Parses the depth-stencil state AST node and outputs a depth-stencil state object, or a nullptr
+		 *			in case AST node is empty. 
 		 */
-		static HDepthStencilState parseDepthStencilState(ASTFXNode* passNode);
+		static DepthStencilStatePtr parseDepthStencilState(ASTFXNode* passNode);
 
 		/**
-		 * @brief	Parses the sampler state AST node and outputs a sampler state object, or an invalid
-		 *			handle in case AST node is empty. 
+		 * @brief	Parses the sampler state AST node and outputs a sampler state object, or a nullptr
+		 *			in case AST node is empty. 
 		 */
-		static HSamplerState parseSamplerState(ASTFXNode* samplerStateNode);
+		static SamplerStatePtr parseSamplerState(ASTFXNode* samplerStateNode);
 
 		/**
 		 * @brief	Parses the pass AST node and generates a single pass object. Returns null

+ 16 - 16
BansheeSL/Source/BsSLFXCompiler.cpp

@@ -599,10 +599,10 @@ namespace BansheeEngine
 		}
 	}
 
-	HBlendState BSLFXCompiler::parseBlendState(ASTFXNode* passNode)
+	BlendStatePtr BSLFXCompiler::parseBlendState(ASTFXNode* passNode)
 	{
 		if (passNode == nullptr || passNode->type != NT_Pass)
-			return HBlendState();
+			return nullptr;
 
 		BLEND_STATE_DESC desc;
 		bool default = true;
@@ -629,15 +629,15 @@ namespace BansheeEngine
 		}
 
 		if (default)
-			return HBlendState();
+			return nullptr;
 
 		return BlendState::create(desc);
 	}
 
-	HRasterizerState BSLFXCompiler::parseRasterizerState(ASTFXNode* passNode)
+	RasterizerStatePtr BSLFXCompiler::parseRasterizerState(ASTFXNode* passNode)
 	{
 		if (passNode == nullptr || passNode->type != NT_Pass)
-			return HRasterizerState();
+			return nullptr;
 
 		RASTERIZER_STATE_DESC desc;
 		bool default = true;
@@ -684,15 +684,15 @@ namespace BansheeEngine
 		}
 
 		if (default)
-			return HRasterizerState();
+			return nullptr;
 
 		return RasterizerState::create(desc);
 	}
 
-	HDepthStencilState BSLFXCompiler::parseDepthStencilState(ASTFXNode* passNode)
+	DepthStencilStatePtr BSLFXCompiler::parseDepthStencilState(ASTFXNode* passNode)
 	{
 		if (passNode == nullptr || passNode->type != NT_Pass)
-			return HDepthStencilState();
+			return nullptr;
 
 		DEPTH_STENCIL_STATE_DESC desc;
 		bool default = true;
@@ -739,15 +739,15 @@ namespace BansheeEngine
 		}
 
 		if (default)
-			return HDepthStencilState();
+			return nullptr;
 
 		return DepthStencilState::create(desc);
 	}
 
-	HSamplerState BSLFXCompiler::parseSamplerState(ASTFXNode* samplerStateNode)
+	SamplerStatePtr BSLFXCompiler::parseSamplerState(ASTFXNode* samplerStateNode)
 	{
 		if (samplerStateNode == nullptr || samplerStateNode->type != NT_SamplerState)
-			return HSamplerState();
+			return nullptr;
 
 		SAMPLER_STATE_DESC desc;
 		bool default = true;
@@ -803,7 +803,7 @@ namespace BansheeEngine
 		}
 
 		if (default)
-			return HSamplerState();
+			return nullptr;
 
 		return SamplerState::create(desc);
 	}
@@ -948,7 +948,7 @@ namespace BansheeEngine
 			String alias;
 
 			float defaultValue[16];
-			UINT32 typeId;
+			UINT32 typeId = 0;
 			bool isObjType = false;
 			StringID semantic;
 
@@ -974,7 +974,7 @@ namespace BansheeEngine
 					semantic = removeQuotes(paramOption->value.strValue);
 					break;
 				case OT_SamplerState:
-					HSamplerState samplerState = parseSamplerState(paramOption->value.nodePtr);
+					SamplerStatePtr samplerState = parseSamplerState(paramOption->value.nodePtr);
 					// TODO - How to deal with sampler-state default value?
 					break;
 				}
@@ -1013,8 +1013,8 @@ namespace BansheeEngine
 			ASTFXNode* parameter = option->value.nodePtr;
 
 			String name;
-			bool shared;
-			GpuParamBlockUsage usage;
+			bool shared = false;
+			GpuParamBlockUsage usage = GPBU_STATIC;
 			StringID semantic;
 
 			for (int j = 0; j < parameter->options->count; j++)

+ 4 - 0
BansheeUtility/Include/BsPath.h

@@ -294,11 +294,15 @@ namespace BansheeEngine
 
 		/**
 		 * @brief	Change or set the extension of the filename in the path.
+		 *
+		 * @param	extension	Extension with a leading ".".
 		 */
 		void setExtension(const WString& extension);
 
 		/**
 		 * @brief	Change or set the extension of the filename in the path.
+		 *
+		 * @param	extension	Extension with a leading ".".
 		 */
 		void setExtension(const String& extension);
 

+ 11 - 91
ExampleProject/Main/Main.cpp

@@ -46,12 +46,12 @@ namespace BansheeEngine
 	/**
 	 * Import mesh/texture/GPU programs used by the example.
 	 */
-	void importAssets(HMesh& model, HTexture& texture, HGpuProgram& fragmentGPUProg, HGpuProgram& vertexGPUProg);
+	void importAssets(HMesh& model, HTexture& texture, HShader& shader);
 
 	/**
 	 * Create a material used by our example model.
 	 */
-	HMaterial createMaterial(const HTexture& texture, const HGpuProgram& vertexGPUProg, const HGpuProgram& fragmentGPUProg);
+	HMaterial createMaterial(const HTexture& texture, const HShader& shader);
 
 	/**
 	 * Set up example scene objects.
@@ -129,8 +129,7 @@ namespace BansheeEngine
 {
 	Path exampleModelPath = "..\\..\\..\\..\\Data\\Examples\\Dragon.fbx";
 	Path exampleTexturePath = "..\\..\\..\\..\\Data\\Examples\\Dragon.tga";
-	Path exampleFragmentShaderPath = "..\\..\\..\\..\\Data\\Examples\\example_fs.gpuprog";
-	Path exampleVertexShaderPath = "..\\..\\..\\..\\Data\\Examples\\example_vs.gpuprog";
+	Path exampleShaderPath = "..\\..\\..\\..\\Data\\Examples\\Example.bsl";
 
 	GUIButton* toggleFullscreenButton = nullptr;
 	bool fullscreen = false;
@@ -151,18 +150,17 @@ namespace BansheeEngine
 	{
 		HMesh exampleModel;
 		HTexture exampleTexture;
-		HGpuProgram exampleFragmentGPUProg;
-		HGpuProgram exampleVertexGPUProg;
+		HShader exampleShader;
 
-		importAssets(exampleModel, exampleTexture, exampleFragmentGPUProg, exampleVertexGPUProg);
-		HMaterial exampleMaterial = createMaterial(exampleTexture, exampleVertexGPUProg, exampleFragmentGPUProg);
+		importAssets(exampleModel, exampleTexture, exampleShader);
+		HMaterial exampleMaterial = createMaterial(exampleTexture, exampleShader);
 
 		setUp3DScene(exampleModel, exampleMaterial);
 		setUpGUI();
 		setUpInput();
 	}
 
-	void importAssets(HMesh& model, HTexture& texture, HGpuProgram& fragmentGPUProg, HGpuProgram& vertexGPUProg)
+	void importAssets(HMesh& model, HTexture& texture, HShader& shader)
 	{
 		// Import mesh, texture and shader from the disk. In a normal application you would want to save the imported assets
 		// so next time the application is ran you can just load them directly. This can be done with Resources::save/load.
@@ -186,92 +184,14 @@ namespace BansheeEngine
 		// Import texture with specified import options
 		texture = Importer::instance().import<Texture>(exampleTexturePath, textureImportOptions);
 
-		// Create import options for fragment GPU program
-		ImportOptionsPtr gpuProgImportOptions = Importer::instance().createImportOptions(exampleFragmentShaderPath);
-		if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
-		{
-			GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
-
-			// Name of the entry function in the GPU program
-			importOptions->setEntryPoint("ps_main");
-
-			// Language the GPU program is written in. Can only be hlsl for DX11
-			importOptions->setLanguage("hlsl");
-
-			// GPU program profile specifying what feature-set the shader code uses.
-			importOptions->setProfile(GPP_FS_4_0);
-
-			// Type of the shader.
-			importOptions->setType(GPT_FRAGMENT_PROGRAM);
-		}
-
-		// Import fragment GPU program
-		fragmentGPUProg = Importer::instance().import<GpuProgram>(exampleFragmentShaderPath, gpuProgImportOptions);
-
-		// Create import options for vertex GPU program. Similar as above.
-		gpuProgImportOptions = Importer::instance().createImportOptions(exampleVertexShaderPath);
-		if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
-		{
-			GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
-
-			importOptions->setEntryPoint("vs_main");
-			importOptions->setLanguage("hlsl");
-			importOptions->setProfile(GPP_VS_4_0);
-			importOptions->setType(GPT_VERTEX_PROGRAM);
-		}
-
-		// Import vertex GPU program
-		vertexGPUProg = Importer::instance().import<GpuProgram>(exampleVertexShaderPath, gpuProgImportOptions);
+		// Import shader
+		shader = Importer::instance().import<Shader>(exampleShaderPath);
 	}
 
-	HMaterial createMaterial(const HTexture& texture, const HGpuProgram& vertexGPUProg, const HGpuProgram& fragmentGPUProg)
+	HMaterial createMaterial(const HTexture& texture, const HShader& shader)
 	{
-		/************************************************************************/
-		/* 							CREATE SHADER	                      		*/
-		/************************************************************************/
-		// Create a new pass for a shader technique. Each technique can have multiple passes that allow you to render the same
-		// object multiple times using different GPU programs.
-		PASS_DESC passDesc;
-		passDesc.vertexProgram = vertexGPUProg;
-		passDesc.fragmentProgram = fragmentGPUProg;
-
-		PassPtr pass = Pass::create(passDesc);
-
-		// Create a shader technique. Shader can have many different techniques and the renderer will automatically
-		// use the most appropriate technique depending on the active renderer and render system. e.g. you can have different
-		// techniques using HLSL9, HLSL11 and GLSL GPU programs for DirectX 9, DirectX 11 and OpenGL render systems respectively.
-		TechniquePtr technique = Technique::create(RenderAPIDX11, RendererDefault, { pass });
-
-		// Set up shader parameters and renderer semantics.
-		// Renderer semantics allow our renderer to automatically populate certain shader parameters (e.g. a world view projection matrix).
-		// These semantics are purely optional and depend on the renderer used. Certain renderers expect certain semantics to be set up
-		// otherwise they will not render the objects. You always have the option to populate all the parameters manually, but in this example
-		// we go with the semantics route as it allows for a "set up and forget" approach.
-		SHADER_DESC exampleShaderDesc;
-
-		// Add a world view projection matrix parameter, which will be populated by the renderer.
-		// We map our shader parameter name to the actual GPU program variable, both being "matWorldViewProj" in this case.
-		exampleShaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4, RPS_WorldViewProjTfrm);
-
-		// Add a sampler and a texture semantic that we will populate manually.
-		exampleShaderDesc.addParameter("samp", "samp", GPOT_SAMPLER2D);
-		exampleShaderDesc.addParameter("tex", "tex", GPOT_TEXTURE2D);
-
-		// Our GPU programs use parameter blocks (constant buffers in DX11 lingo). Here we notify the renderer
-		// that this particular parameter block contains object-specific data (like the world view projection parameter
-		// we defined above).
-		exampleShaderDesc.setParamBlockAttribs("PerObject", true, GPBU_DYNAMIC, RBS_PerObject);
-
-		// Create a shader that references our vertex and fragment GPU programs, and set
-		// up shader input parameters. 
-		HShader exampleShader = Shader::create("ExampleShader", exampleShaderDesc, { technique });
-
-		/************************************************************************/
-		/* 							CREATE MATERIAL                      		*/
-		/************************************************************************/
-
 		// And finally create a material with the newly created shader
-		HMaterial exampleMaterial = Material::create(exampleShader);
+		HMaterial exampleMaterial = Material::create(shader);
 
 		// And set the texture to be used by the "tex" shader parameter. We leave the "samp"
 		// parameter at its defaults.

+ 0 - 59
MBansheeEditor/ImportOptions.cs

@@ -56,65 +56,6 @@ namespace BansheeEditor
         private static extern void Internal_SetMaxMipmapLevel(IntPtr thisPtr, UInt32 value);
     }
 
-    public class GpuProgramImportOptions : ImportOptions
-    {
-        public GpuProgramImportOptions()
-        {
-            Internal_CreateInstance(this);
-        }
-
-        public string EntryPoint
-        {
-            get { return Internal_GetEntryPoint(mCachedPtr); }
-            set { Internal_SetEntryPoint(mCachedPtr, value); }
-        }
-
-        public GpuLanguage Language
-        {
-            get { return Internal_GetLanguage(mCachedPtr); }
-            set { Internal_SetLanguage(mCachedPtr, value); }
-        }
-
-        public GpuProgramProfile Profile
-        {
-            get { return Internal_GetProfile(mCachedPtr); }
-            set { Internal_SetProfile(mCachedPtr, value); }
-        }
-
-        public GpuProgramType Type
-        {
-            get { return Internal_GetType(mCachedPtr); }
-            set { Internal_SetType(mCachedPtr, value); }
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GpuProgramImportOptions instance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern string Internal_GetEntryPoint(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetEntryPoint(IntPtr thisPtr, string value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern GpuLanguage Internal_GetLanguage(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetLanguage(IntPtr thisPtr, GpuLanguage value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern GpuProgramProfile Internal_GetProfile(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetProfile(IntPtr thisPtr, GpuProgramProfile value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern GpuProgramType Internal_GetType(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetType(IntPtr thisPtr, GpuProgramType value);
-    }
-
     public class FontImportOptions : ImportOptions
     {
         public FontImportOptions()

+ 0 - 24
SBansheeEditor/Include/BsScriptImportOptions.h

@@ -79,30 +79,6 @@ namespace BansheeEngine
 		ScriptFontImportOptions(MonoObject* instance);
 	};
 
-	class BS_SCR_BED_EXPORT ScriptGpuProgramImportOptions : public ScriptObject <ScriptGpuProgramImportOptions, ScriptImportOptionsBase>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GpuProgramImportOptions")
-
-		static MonoObject* create();
-		static MonoObject* create(const SPtr<GpuProgramImportOptions>& options);
-
-	private:
-		SPtr<GpuProgramImportOptions> getGpuProgImportOptions();
-
-		static void internal_CreateInstance(MonoObject* instance);
-		static MonoString* internal_GetEntryPoint(ScriptGpuProgramImportOptions* thisPtr);
-		static void internal_SetEntryPoint(ScriptGpuProgramImportOptions* thisPtr, MonoString* value);
-		static GpuLanguage internal_GetLanguage(ScriptGpuProgramImportOptions* thisPtr);
-		static void internal_SetLanguage(ScriptGpuProgramImportOptions* thisPtr, GpuLanguage value);
-		static GpuProgramProfile internal_GetProfile(ScriptGpuProgramImportOptions* thisPtr);
-		static void internal_SetProfile(ScriptGpuProgramImportOptions* thisPtr, GpuProgramProfile value);
-		static GpuProgramType internal_GetType(ScriptGpuProgramImportOptions* thisPtr);
-		static void internal_SetType(ScriptGpuProgramImportOptions* thisPtr, GpuProgramType value);
-
-		ScriptGpuProgramImportOptions(MonoObject* instance);
-	};
-
 	class BS_SCR_BED_EXPORT ScriptScriptCodeImportOptions : public ScriptObject <ScriptScriptCodeImportOptions, ScriptImportOptionsBase>
 	{
 	public:

+ 0 - 87
SBansheeEditor/Source/BsScriptImportOptions.cpp

@@ -7,7 +7,6 @@
 #include "BsMonoUtil.h"
 #include "BsTextureImportOptions.h"
 #include "BsFontImportOptions.h"
-#include "BsGpuProgramImportOptions.h"
 #include "BsScriptCodeImportOptions.h"
 #include "BsRenderer.h"
 #include "BsScriptFont.h"
@@ -37,9 +36,6 @@ namespace BansheeEngine
 		case TID_FontImportOptions:
 			return ScriptFontImportOptions::create(std::static_pointer_cast<FontImportOptions>(importOptions));
 			break;
-		case TID_GpuProgramImportOptions:
-			return ScriptGpuProgramImportOptions::create(std::static_pointer_cast<GpuProgramImportOptions>(importOptions));
-			break;
 		case TID_ScriptCodeImportOptions:
 			return ScriptScriptCodeImportOptions::create(std::static_pointer_cast<ScriptCodeImportOptions>(importOptions));
 			break;
@@ -242,89 +238,6 @@ namespace BansheeEngine
 		}
 	}
 
-	ScriptGpuProgramImportOptions::ScriptGpuProgramImportOptions(MonoObject* instance)
-		:ScriptObject(instance)
-	{
-		mImportOptions = bs_shared_ptr<GpuProgramImportOptions>();
-	}
-
-	void ScriptGpuProgramImportOptions::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGpuProgramImportOptions::internal_CreateInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetEntryPoint", &ScriptGpuProgramImportOptions::internal_GetEntryPoint);
-		metaData.scriptClass->addInternalCall("Internal_SetEntryPoint", &ScriptGpuProgramImportOptions::internal_SetEntryPoint);
-		metaData.scriptClass->addInternalCall("Internal_GetLanguage", &ScriptGpuProgramImportOptions::internal_GetLanguage);
-		metaData.scriptClass->addInternalCall("Internal_SetLanguage", &ScriptGpuProgramImportOptions::internal_SetLanguage);
-		metaData.scriptClass->addInternalCall("Internal_GetProfile", &ScriptGpuProgramImportOptions::internal_GetProfile);
-		metaData.scriptClass->addInternalCall("Internal_SetProfile", &ScriptGpuProgramImportOptions::internal_SetProfile);
-		metaData.scriptClass->addInternalCall("Internal_GetType", &ScriptGpuProgramImportOptions::internal_GetType);
-		metaData.scriptClass->addInternalCall("Internal_SetType", &ScriptGpuProgramImportOptions::internal_SetType);
-	}
-
-	SPtr<GpuProgramImportOptions> ScriptGpuProgramImportOptions::getGpuProgImportOptions()
-	{
-		return std::static_pointer_cast<GpuProgramImportOptions>(mImportOptions);
-	}
-
-	MonoObject* ScriptGpuProgramImportOptions::create()
-	{
-		return metaData.scriptClass->createInstance();
-	}
-
-	MonoObject* ScriptGpuProgramImportOptions::create(const SPtr<GpuProgramImportOptions>& options)
-	{
-		MonoObject* managedInstance = metaData.scriptClass->createInstance();
-		ScriptGpuProgramImportOptions* scriptObj = ScriptGpuProgramImportOptions::toNative(managedInstance);
-		scriptObj->mImportOptions = options;
-
-		return managedInstance;
-	}
-
-	void ScriptGpuProgramImportOptions::internal_CreateInstance(MonoObject* instance)
-	{
-		ScriptGpuProgramImportOptions* nativeInstance = new (bs_alloc<ScriptGpuProgramImportOptions>()) ScriptGpuProgramImportOptions(instance);
-	}
-
-	MonoString* ScriptGpuProgramImportOptions::internal_GetEntryPoint(ScriptGpuProgramImportOptions* thisPtr)
-	{
-		return MonoUtil::stringToMono(MonoManager::instance().getDomain(), thisPtr->getGpuProgImportOptions()->getEntryPoint());
-	}
-
-	void ScriptGpuProgramImportOptions::internal_SetEntryPoint(ScriptGpuProgramImportOptions* thisPtr, MonoString* value)
-	{
-		thisPtr->getGpuProgImportOptions()->setEntryPoint(MonoUtil::monoToString(value));
-	}
-
-	GpuLanguage ScriptGpuProgramImportOptions::internal_GetLanguage(ScriptGpuProgramImportOptions* thisPtr)
-	{
-		return Renderer::getGpuLanguageType(thisPtr->getGpuProgImportOptions()->getLanguage());
-	}
-
-	void ScriptGpuProgramImportOptions::internal_SetLanguage(ScriptGpuProgramImportOptions* thisPtr, GpuLanguage value)
-	{
-		thisPtr->getGpuProgImportOptions()->setLanguage(Renderer::getGpuLanguageName(value));
-	}
-
-	GpuProgramProfile ScriptGpuProgramImportOptions::internal_GetProfile(ScriptGpuProgramImportOptions* thisPtr)
-	{
-		return thisPtr->getGpuProgImportOptions()->getProfile();
-	}
-
-	void ScriptGpuProgramImportOptions::internal_SetProfile(ScriptGpuProgramImportOptions* thisPtr, GpuProgramProfile value)
-	{
-		thisPtr->getGpuProgImportOptions()->setProfile(value);
-	}
-
-	GpuProgramType ScriptGpuProgramImportOptions::internal_GetType(ScriptGpuProgramImportOptions* thisPtr)
-	{
-		return thisPtr->getGpuProgImportOptions()->getType();
-	}
-
-	void ScriptGpuProgramImportOptions::internal_SetType(ScriptGpuProgramImportOptions* thisPtr, GpuProgramType value)
-	{
-		thisPtr->getGpuProgImportOptions()->setType(value);
-	}
-
 	ScriptScriptCodeImportOptions::ScriptScriptCodeImportOptions(MonoObject* instance)
 		:ScriptObject(instance)
 	{

+ 16 - 0
TODO.txt

@@ -131,6 +131,22 @@ ShaderManager will also be needed when switching render APIs during runtime (if
  - Separate languages for DX9 and DX11
  - If I import a shader that tries to compile for a language different than we have available, create a null GpuProgram
 
+0. Move all shaders to new .shader format, ensure everything works
+0.1. Check in new shaders as dependencies
+
+1. Make render states and GPU program non-resources. Ensure they aren't referenced by handles anymore
+1.1. Get rid of GpuProgram importer and modify how BuiltinResources imports shaders
+2. Make render states and GPU programs be saved with the shader
+
+3. Rename HGpuInc to HShaderInc and make its file format be ".bslinc". Remove includes from GpuProgram creation (GpuProgram has mergeWithIncludes method that needs removing as well)
+4. Add ShaderManager that allows GPU programs to register themselves and to be recompiled once their includes change
+  - TODO - Perhaps use ResourceListener instead?
+5. Add support for includes in BansheeSL (injecting their code into actual shader source) + registering with shader manager
+5.1. Modify existing shaders as I have some that share code but differ in state options only
+
+6. Add support for registering default parameters (add a set of addParameter methods to SHADER_DESC). Keep sampler states and textures in a dynamic array, and all other data in a dynamic byte array.
+7. Make sure initializing the material properly sets up default parameters
+
 -------------------
 
 TODO STAGE 2:

Некоторые файлы не были показаны из-за большого количества измененных файлов