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

More documentation
Removed redundant "mSyntaxCode" parameter from Gpu programs

Marko Pintera 11 лет назад
Родитель
Сommit
b237180972
39 измененных файлов с 504 добавлено и 254 удалено
  1. 1 0
      BansheeEngine/Include/BsImageSprite.h
  2. 1 0
      BansheeEngine/Include/BsTextSprite.h
  3. 1 0
      BansheeEngine/Source/BsGUIMaterialManager.cpp
  4. 86 10
      CamelotCore/Include/CmGpuParam.h
  5. 36 0
      CamelotCore/Include/CmGpuParamBlock.h
  6. 37 9
      CamelotCore/Include/CmGpuParamBlockBuffer.h
  7. 13 1
      CamelotCore/Include/CmGpuParamDesc.h
  8. 104 0
      CamelotCore/Include/CmGpuParams.h
  9. 77 99
      CamelotCore/Include/CmGpuProgram.h
  10. 2 2
      CamelotCore/Include/CmGpuProgramManager.h
  11. 0 2
      CamelotCore/Include/CmGpuProgramRTTI.h
  12. 1 1
      CamelotCore/Include/CmHighLevelGpuProgram.h
  13. 3 3
      CamelotCore/Source/CmGpuParam.cpp
  14. 9 9
      CamelotCore/Source/CmGpuParams.cpp
  15. 9 41
      CamelotCore/Source/CmGpuProgram.cpp
  16. 2 2
      CamelotCore/Source/CmGpuProgramManager.cpp
  17. 2 2
      CamelotCore/Source/CmHighLevelGpuProgram.cpp
  18. 1 1
      CamelotCore/Source/CmHighLevelGpuProgramManager.cpp
  19. 13 12
      CamelotD3D11RenderSystem/Include/CmD3D11GpuProgram.h
  20. 1 1
      CamelotD3D11RenderSystem/Include/CmD3D11GpuProgramManager.h
  21. 1 1
      CamelotD3D11RenderSystem/Include/CmD3D11HLSLProgram.h
  22. 22 9
      CamelotD3D11RenderSystem/Source/CmD3D11GpuProgram.cpp
  23. 6 6
      CamelotD3D11RenderSystem/Source/CmD3D11GpuProgramManager.cpp
  24. 7 4
      CamelotD3D11RenderSystem/Source/CmD3D11HLSLProgram.cpp
  25. 2 2
      CamelotD3D11RenderSystem/Source/CmD3D11HLSLProgramFactory.cpp
  26. 5 3
      CamelotD3D9Renderer/Include/CmD3D9GpuProgram.h
  27. 1 1
      CamelotD3D9Renderer/Include/CmD3D9GpuProgramManager.h
  28. 1 1
      CamelotD3D9Renderer/Include/CmD3D9HLSLProgram.h
  29. 18 6
      CamelotD3D9Renderer/Source/CmD3D9GpuProgram.cpp
  30. 3 3
      CamelotD3D9Renderer/Source/CmD3D9GpuProgramManager.cpp
  31. 2 5
      CamelotD3D9Renderer/Source/CmD3D9HLSLProgram.cpp
  32. 2 2
      CamelotD3D9Renderer/Source/CmD3D9HLSLProgramFactory.cpp
  33. 1 1
      CamelotGLRenderer/Include/CmGLGpuProgramManager.h
  34. 2 2
      CamelotGLRenderer/Source/CmGLGpuProgramManager.cpp
  35. 3 1
      CamelotGLRenderer/Source/GLSL/include/CmGLSLGpuProgram.h
  36. 3 1
      CamelotGLRenderer/Source/GLSL/include/CmGLSLProgram.h
  37. 12 4
      CamelotGLRenderer/Source/GLSL/src/CmGLSLGpuProgram.cpp
  38. 12 5
      CamelotGLRenderer/Source/GLSL/src/CmGLSLProgram.cpp
  39. 2 2
      CamelotGLRenderer/Source/GLSL/src/CmGLSLProgramFactory.cpp

+ 1 - 0
BansheeEngine/Include/BsImageSprite.h

@@ -3,6 +3,7 @@
 #include "BsPrerequisites.h"
 #include "BsSprite.h"
 #include "CmVector2.h"
+#include "CmColor.h"
 
 namespace BansheeEngine
 {

+ 1 - 0
BansheeEngine/Include/BsTextSprite.h

@@ -3,6 +3,7 @@
 #include "BsPrerequisites.h"
 #include "BsSprite.h"
 #include "CmTextData.h"
+#include "CmColor.h"
 
 namespace BansheeEngine
 {

+ 1 - 0
BansheeEngine/Source/BsGUIMaterialManager.cpp

@@ -2,6 +2,7 @@
 #include "CmMaterial.h"
 #include "CmDebug.h"
 #include "BsBuiltinMaterialManager.h"
+#include "CmColor.h"
 
 namespace BansheeEngine
 {

+ 86 - 10
CamelotCore/Include/CmGpuParam.h

@@ -11,12 +11,23 @@
 namespace BansheeEngine
 {
 	/**
-	 * @brief	A handle that allows you to set a GpuProgram parameter.
+	 * @brief	A handle that allows you to set a GpuProgram parameter. Internally keeps a reference to the 
+	 *			GPU parameter buffer and the necessary offsets. You should specialize this type for specific 
+	 *			parameter types. 
+	 *
+	 *			Object of this type must be returned by a Material. Setting/Getting parameter values will internally
+	 *			access a GPU parameter buffer attached to the Material this parameter was created from. Anything
+	 *			rendered with that material will then use those set values.
 	 * 			
-	 * @note	This is primarily used an as optimization is performance critical bits of code
-	 * 			where it is important to locate and set parameters quickly without any lookups.
-	 * 			You just retrieve the handle once and then set the parameter value many times 
-	 * 			with minimal performance impact.
+	 * @note	Normally you can set a GpuProgram parameter by calling various set/get methods on a Material.
+	 *			This class primarily used an as optimization in performance critical bits of code
+	 * 			where it is important to locate and set parameters quickly without any lookups
+	 *			(Mentioned set/get methods expect a parameter name). You just retrieve the handle 
+	 *			once and then set the parameter value many times with minimal performance impact.
+	 * 
+	 * @see		Material
+	 *
+	 * @note	Sim thread only.
 	 */
 	template<class T>
 	class CM_EXPORT GpuDataParamBase
@@ -24,6 +35,9 @@ namespace BansheeEngine
 	private:
 		friend class GpuParams;
 
+		/**
+		 * @brief	Internal data that is shared between GpuDataParam instances.
+		 */
 		struct InternalData
 		{
 			InternalData(GpuParamDataDesc* paramDesc, GpuParamBlock** paramBlocks, bool transpose)
@@ -43,6 +57,11 @@ namespace BansheeEngine
 			bool isDestroyed;
 		};
 
+		/**
+		 * @brief	Policy class that allows us to re-use this template class for matrices which might
+		 *			need transposing, and other types which do not. Matrix needs to be transposed for
+		 *			certain render systems depending on how they store them in memory.
+		 */
 		template<class Type>
 		struct TransposePolicy
 		{
@@ -50,6 +69,9 @@ namespace BansheeEngine
 			static bool transposeEnabled(bool enabled) { return false; }
 		};
 
+		/**
+		 * @brief	Transpose policy for 3x3 matrix.
+		 */
 		template<>
 		struct TransposePolicy<Matrix3>
 		{
@@ -57,6 +79,9 @@ namespace BansheeEngine
 			static bool transposeEnabled(bool enabled) { return enabled; }
 		};
 
+		/**
+		* @brief	Transpose policy for 4x4 matrix.
+		*/
 		template<>
 		struct TransposePolicy<Matrix4>
 		{
@@ -69,6 +94,13 @@ namespace BansheeEngine
 			:mData(cm_shared_ptr<InternalData>())
 		{ }
 
+		/**
+		 * @brief	Sets a parameter value at the specified array index. If parameter does not
+		 *			contain an array leave the index at 0.
+		 *
+		 * @note	Like with all GPU parameters, the actual GPU buffer will not be updated until rendering
+		 *			with material this parameter was created from starts on the core thread.
+		 */
 		void set(const T& value, UINT32 arrayIdx = 0)
 		{
 			if(mData->isDestroyed)
@@ -104,6 +136,12 @@ namespace BansheeEngine
 			}
 		}
 
+		/**
+		 * @brief	Returns a value of a parameter at the specified array index. If parameter does not
+		 *			contain an array leave the index at 0.
+		 *
+		 * @note	No GPU reads are done. Data returned was cached when it was written. 
+		 */
 		T get(UINT32 arrayIdx = 0)
 		{
 			if(mData->isDestroyed)
@@ -131,7 +169,11 @@ namespace BansheeEngine
 				return value;
 		}
 
-		void destroy()
+		/**
+		 * @brief	Called by the material when this handle is no longer valid (shader changed or material
+		 *			got destroyed).
+		 */
+		void _destroy()
 		{
 			mData->isDestroyed = true;
 		}
@@ -174,11 +216,25 @@ namespace BansheeEngine
 	public:
 		GpuParamStruct();
 
+		/**
+		 * @copydoc	GpuDataParamBase::set
+		 */
 		void set(const void* value, UINT32 sizeBytes, UINT32 arrayIdx = 0);
+
+		/**
+		 * @copydoc	GpuDataParamBase::get
+		 */
 		void get(void* value, UINT32 sizeBytes, UINT32 arrayIdx = 0);
+
+		/**
+		 * @brief	Returns the size of the struct in bytes.
+		 */
 		UINT32 getElementSize() const;
 
-		void destroy();
+		/**
+		 * @copydoc	GpuDataParamBase::_destroy
+		 */
+		void _destroy();
 	private:
 		GpuParamStruct(GpuParamDataDesc* paramDesc, GpuParamBlock** paramBlocks);
 
@@ -208,10 +264,20 @@ namespace BansheeEngine
 	public:
 		GpuParamTexture();
 
+		/**
+		* @copydoc	GpuDataParamBase::set
+		*/
 		void set(const HTexture& texture);
-		HTexture get();
 
-		void destroy();
+		/**
+		* @copydoc	GpuDataParamBase::get
+		*/
+		HTexture get();
+		
+		/**
+		* @copydoc	GpuDataParamBase::_destroy
+		*/
+		void _destroy();
 	private:
 		GpuParamTexture(GpuParamObjectDesc* paramDesc, HTexture* textures);
 
@@ -241,10 +307,20 @@ namespace BansheeEngine
 	public:
 		GpuParamSampState();
 
+		/**
+		* @copydoc	GpuDataParamBase::set
+		*/
 		void set(const HSamplerState& texture);
+
+		/**
+		* @copydoc	GpuDataParamBase::get
+		*/
 		HSamplerState get();
 
-		void destroy();
+		/**
+		* @copydoc	GpuDataParamBase::_destroy
+		*/
+		void _destroy();
 	private:
 		GpuParamSampState(GpuParamObjectDesc* paramDesc, HSamplerState* samplerStates);
 

+ 36 - 0
CamelotCore/Include/CmGpuParamBlock.h

@@ -6,6 +6,11 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Stores data (e.g. int, float, Vector2) GPU parameters in a raw buffer. 
+	 *			Used primarily for caching GPU parameters on the CPU before they're submitted 
+	 *			to the actual GPU parameter buffer.
+	 */
 	class CM_EXPORT GpuParamBlock
 	{
 	public:
@@ -14,14 +19,45 @@ namespace BansheeEngine
 
 		virtual ~GpuParamBlock();
 
+		/**
+		 * @brief	Write some data to the specified offset in the buffer. 
+		 *			Marks the block as dirty.
+		 *			All values are in bytes.
+		 */
 		void write(UINT32 offset, const void* data, UINT32 size);
+
+		/**
+		 * @brief	Read some data from the specified offset in the buffer.
+		 *			All values are in bytes.
+		 */
 		void read(UINT32 offset, void* data, UINT32 size);
+
+		/**
+		 * @brief	Clear specified section of the buffer to zero.
+		 *			All values are in bytes.
+		 */
 		void zeroOut(UINT32 offset, UINT32 size);
 
+		/**
+		 * @brief	Returns size of the internal buffer in bytes.
+		 */
 		UINT32 getSize() const { return mSize; }
+
+		/**
+		 * @brief	Returns a raw pointer to the internal buffer.
+		 */
 		UINT8* getData() const { return mData; }
+
+		/**
+		 * @brief	Checks if something has been written to the buffer
+		 *			since the last time object was clean.
+		 */
 		bool isDirty() const { return mDirty; }
 
+		/**
+		 * @brief	Marks the object as dirty or clean. Signifies
+		 *			whether or not some new data has been written in the buffer.
+		 */
 		void setDirty() { mDirty = true; }
 	protected:
 		UINT8* mData;

+ 37 - 9
CamelotCore/Include/CmGpuParamBlockBuffer.h

@@ -7,8 +7,13 @@
 namespace BansheeEngine
 {
 	/**
-	 * @brief	Represents an actual GPU buffer. 
-	 * 			Should only be accessed directly from core thread.
+	 * @brief	Represents a GPU parameter block buffer. Parameter block buffers
+	 *			are bound to GPU programs which then fetch parameters from those buffers.
+	 *
+	 *			Writing or reading from this buffer will translate directly to API calls
+	 *			that update the GPU.
+	 * 			
+	 * @note	Core thread only.
 	 */
 	class CM_EXPORT GpuParamBlockBuffer : public CoreObject
 	{
@@ -16,25 +21,45 @@ namespace BansheeEngine
 		GpuParamBlockBuffer();
 		virtual ~GpuParamBlockBuffer();
 
+		/**
+		 * @brief	Initializes a buffer with the specified size in bytes and usage.
+		 *			Specify dynamic usage if you plan on modifying the buffer often,
+		 *			otherwise specify static usage.
+		 *
+		 * @see		CoreObject::initialize
+		 * 
+		 * @note	Must be called right after construction.
+		 */
 		void initialize(UINT32 size, GpuParamBlockUsage usage);
 
 		/**
-		 * @brief	Writes all of the data to the buffer.
+		 * @brief	Writes all of the specified data to the buffer.
 		 * 			Data size must be the same size as the buffer;
 		 */
 		virtual void writeData(const UINT8* data) = 0;
 
 		/**
 		 * @brief	Copies data from the internal buffer to a pre-allocated array. 
-		 * 			Be aware this generally isn't a very fast operation.
+		 * 			Be aware this generally isn't a very fast operation as reading
+		 *			from the GPU will most definitely involve a CPU-GPU sync point.
 		 *
 		 * @param [in,out]	data	Array where the data will be written to. Must be of
 		 * 							"getSize()" bytes.
 		 */
 		virtual void readData(UINT8* data) const = 0;
 
+		/**
+		 * @brief	Returns the size of the buffer in bytes.
+		 */
 		UINT32 getSize() const { return mSize; }
 
+		/**
+		 * @brief	Returns	a parameter block buffer which is used for caching 
+		 *			the parameter information on the CPU. Essentially a CPU
+		 *			copy of the GPU buffer.
+		 *
+		 * @note	Sim thread only.
+		 */
 		GpuParamBlock* getParamBlock() const { return mParamBlock; }
 
 	protected:
@@ -44,17 +69,20 @@ namespace BansheeEngine
 		GpuParamBlock* mParamBlock;
 	};
 
+	/**
+	 * @brief	Implementation of a GpuParamBlock buffer that doesn't use a GPU buffer
+	 *			for storage. Used with APIs that do not support GPU parameter buffers.
+	 */
 	class CM_EXPORT GenericGpuParamBlockBuffer : public GpuParamBlockBuffer
 	{
 	public:
 		/**
-		 * @brief	Writes all of the data to the buffer.
-		 * 			Data size must be the same size as the buffer;
+		 * @copydoc	GpuParamBlockBuffer::writeData
 		 */
 		void writeData(const UINT8* data);
 
 		/**
-		 * @copydoc GpuParamBlockBuffer::readAll.
+		 * @copydoc GpuParamBlockBuffer::readData.
 		 */
 		void readData(UINT8* data) const;
 
@@ -62,12 +90,12 @@ namespace BansheeEngine
 		UINT8* mData;
 
 		/**
-		 * @copydoc CoreGpuObject::initialize_internal.
+		 * @copydoc CoreObject::initialize_internal.
 		 */
 		virtual void initialize_internal();
 
 		/**
-		 * @copydoc CoreGpuObject::destroy_internal.
+		 * @copydoc CoreObject::destroy_internal.
 		 */
 		virtual void destroy_internal();
 	};

+ 13 - 1
CamelotCore/Include/CmGpuParamDesc.h

@@ -2,10 +2,12 @@
 
 #include "CmPrerequisites.h"
 #include "CmCommonEnums.h"
-#include "CmGpuProgramParams.h" // TODO - Only here because I need some type definitions (GpuConstantType) - Remove later
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Describes a single GPU program data (e.g. int, float, Vector2) parameter.
+	 */
 	struct GpuParamDataDesc
 	{
 		String name;
@@ -19,6 +21,9 @@ namespace BansheeEngine
 		UINT32 cpuMemOffset;
 	};
 
+	/**
+	 * @brief	Describes a single GPU program object (e.g. texture, sampler state) parameter.
+	 */
 	struct GpuParamObjectDesc
 	{
 		String name;
@@ -27,6 +32,9 @@ namespace BansheeEngine
 		UINT32 slot;
 	};
 
+	/**
+	 * @brief	Describes a GPU program parameter block (collection of GPU program data parameters).
+	 */
 	struct GpuParamBlockDesc
 	{
 		String name;
@@ -35,6 +43,10 @@ namespace BansheeEngine
 		bool isShareable;
 	};
 
+	/**
+	 * @brief	Contains all parameter information for a GPU program, including data and object parameters,
+	 *			plus parameter blocks.
+	 */
 	struct GpuParamDesc
 	{
 		Map<String, GpuParamBlockDesc>::type paramBlocks;

+ 104 - 0
CamelotCore/Include/CmGpuParams.h

@@ -6,28 +6,103 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Contains descriptions for all parameters in a GPU program and also
+	 *			allows you to write and read those parameters. All parameter values
+	 *			are stored internally on the CPU, and are only submitted to the GPU
+	 *			once the parameters are bound to the pipeline.
+	 *
+	 * @see		CoreThreadAccessor::bindGpuParams
+	 *
+	 * @note	Sim thread only.
+	 */
 	class CM_EXPORT GpuParams
 	{
 	public:
+		/**
+		 * @brief	Creates new GpuParams object using the specified parameter descriptions.
+		 *
+		 * @param	transposeMatrices	If true the stored matrices will be transposed before
+		 *								submitted to the GPU (some APIs require different
+		 *								matrix layout).
+		 *
+		 * @note	You normally do not want to call this manually. Instead use GpuProgram::createParameters.
+		 */
 		GpuParams(GpuParamDesc& paramDesc, bool transposeMatrices);
 		~GpuParams();
 
+		/**
+		 * @brief	Binds a new parameter buffer to the specified slot. Any following parameter reads or
+		 *			writes that are referencing that buffer slot will use the new buffer.
+		 *
+		 * @note	This is useful if you want to share a parameter buffer among multiple GPU programs. 
+		 *			You would only set the values once and then share the buffer among all other GpuParams.
+		 *
+		 *			It is up to the caller to guarantee the provided buffer matches parameter block
+		 *			descriptor for this slot.
+		 */
 		void setParamBlockBuffer(UINT32 slot, const GpuParamBlockBufferPtr& paramBlockBuffer);
+
+		/**
+		* @brief	Replaces the parameter buffer with the specified name. Any following parameter reads or
+		*			writes that are referencing that buffer will use the new buffer.
+		*
+		* @note		This is useful if you want to share a parameter buffer among multiple GPU programs.
+		*			You would only set the values once and then share the buffer among all other GpuParams.
+		*
+		*			It is up to the caller to guarantee the provided buffer matches parameter block
+		*			descriptor for this slot.
+		*/
 		void setParamBlockBuffer(const String& name, const GpuParamBlockBufferPtr& paramBlockBuffer);
 
+		/**
+		 * @brief	Returns a description of all stored parameters.
+		 */
 		const GpuParamDesc& getParamDesc() const { return mParamDesc; }
+
+		/**
+		 * @brief	Returns the size of a data parameter with the specified name, in bytes.
+		 *			Returns 0 if such parameter doesn't exist.
+		 */
 		UINT32 getDataParamSize(const String& name) const;
 
+		/**
+		 * @brief	Checks if parameter with the specified name exists.
+		 */
 		bool hasParam(const String& name) const;
+
+		/**
+		* @brief	Checks if texture parameter with the specified name exists.
+		*/
 		bool hasTexture(const String& name) const;
+
+		/**
+		* @brief	Checks if sampler state parameter with the specified name exists.
+		*/
 		bool hasSamplerState(const String& name) const;
+
+		/**
+		 * @brief	Checks if a parameter block with the specified name exists.
+		 */
 		bool hasParamBlock(const String& name) const;
 
+		/**
+		 * @brief	Returns a handle for the parameter with the specified name. 
+		 *			Handle may then be stored and used for quickly setting or retrieving
+		 *			values to/from that parameter.
+		 *
+		 *			Throws exception if parameter with that name and type doesn't exist.
+		 *
+		 *			Parameter handles will be invalidated when their parent GpuParams object changes.
+		 */
 		template<class T> void getParam(const String& name, GpuDataParamBase<T>& output) const
 		{
 			CM_EXCEPT(InvalidParametersException, "Unsupported parameter type");
 		}
 
+		/**
+		 * @copydoc	getParam(const String&, GpuDataParamBase<T>&)
+		 */
 		template<>
 		void getParam<float>(const String& name, GpuDataParamBase<float>& output) const
 		{
@@ -39,6 +114,9 @@ namespace BansheeEngine
 			output = iterFind->second;
 		}
 
+		/**
+		* @copydoc	getParam(const String&, GpuDataParamBase<T>&)
+		*/
 		template<>
 		void getParam<Vector2>(const String& name, GpuDataParamBase<Vector2>& output) const
 		{
@@ -50,6 +128,9 @@ namespace BansheeEngine
 			output = iterFind->second;
 		}
 
+		/**
+		* @copydoc	getParam(const String&, GpuDataParamBase<T>&)
+		*/
 		template<>
 		void getParam<Vector3>(const String& name, GpuDataParamBase<Vector3>& output) const
 		{
@@ -61,6 +142,9 @@ namespace BansheeEngine
 			output = iterFind->second;
 		}
 
+		/**
+		* @copydoc	getParam(const String&, GpuDataParamBase<T>&)
+		*/
 		template<>
 		void getParam<Vector4>(const String& name, GpuDataParamBase<Vector4>& output) const
 		{
@@ -72,6 +156,9 @@ namespace BansheeEngine
 			output = iterFind->second;
 		}
 
+		/**
+		* @copydoc	getParam(const String&, GpuDataParamBase<T>&)
+		*/
 		template<>
 		void getParam<Matrix3>(const String& name, GpuDataParamBase<Matrix3>& output) const
 		{
@@ -83,6 +170,9 @@ namespace BansheeEngine
 			output = iterFind->second;
 		}
 
+		/**
+		* @copydoc	getParam(const String&, GpuDataParamBase<T>&)
+		*/
 		template<>
 		void getParam<Matrix4>(const String& name, GpuDataParamBase<Matrix4>& output) const
 		{
@@ -94,8 +184,19 @@ namespace BansheeEngine
 			output = iterFind->second;
 		}
 
+		/**
+		* @copydoc	getParam(const String&, GpuDataParamBase<T>&)
+		*/
 		void getStructParam(const String& name, GpuParamStruct& output) const;
+
+		/**
+		* @copydoc	getParam(const String&, GpuDataParamBase<T>&)
+		*/
 		void getTextureParam(const String& name, GpuParamTexture& output) const;
+
+		/**
+		* @copydoc	getParam(const String&, GpuDataParamBase<T>&)
+		*/
 		void getSamplerStateParam(const String& name, GpuParamSampState& output) const;
 
 	private:
@@ -104,6 +205,9 @@ namespace BansheeEngine
 		GpuParamDesc& mParamDesc;
 		bool mTransposeMatrices;
 
+		/**
+		 * @brief	Gets a descriptor for a data parameter with the specified name.
+		 */
 		GpuParamDataDesc* getParamDesc(const String& name) const;
 
 		UINT8* mData;

+ 77 - 99
CamelotCore/Include/CmGpuProgram.h

@@ -1,49 +1,16 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __GpuProgram_H_
-#define __GpuProgram_H_
-
-// Precompiler options
+#pragma once
+
 #include "CmPrerequisites.h"
 #include "CmDrawOps.h"
 #include "CmGpuProgramParams.h"
 #include "CmResource.h"
 #include "CmGpuParamDesc.h"
 
-namespace BansheeEngine {
-
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Resources
-	*  @{
-	*/
-	/** Enumerates the types of programs which can run on the GPU. */
+namespace BansheeEngine 
+{
+	/**
+	 * @brief	Types of programs that may run on GPU.
+	 */
 	enum GpuProgramType
 	{
 		GPT_VERTEX_PROGRAM,
@@ -54,6 +21,10 @@ namespace BansheeEngine {
 		GPT_COMPUTE_PROGRAM
 	};
 
+	/**
+	 * @brief	GPU program profiles representing supported
+	 *			feature sets.
+	 */
 	enum GpuProgramProfile
 	{
 		GPP_NONE,
@@ -86,95 +57,106 @@ namespace BansheeEngine {
 		GPP_CS_5_0
 	};
 
-	/** Defines a program which runs on the GPU such as a vertex or fragment program. 
-	@remarks
-		This class defines the low-level program in assembler code, the sort used to
-		directly assemble into machine instructions for the GPU to execute. By nature,
-		this means that the assembler source is rendersystem specific, which is why this
-		is an abstract class - real instances are created through the RenderSystem. 
-		If you wish to use higher level shading languages like HLSL and Cg, you need to 
-		use the HighLevelGpuProgram class instead.
-	*/
+	/**
+	 * @brief	Contains a low level GPU program such as vertex or fragment program.
+	 *			Internal implementation of this class is render system specific,
+	 *			but will normally store a compiled program.
+	 *
+	 * @note	For higher level programs see HighLevelGpuProgram.
+	 *			Core thread only.
+	 */
 	class CM_EXPORT GpuProgram : public Resource
 	{
 	public:
 		virtual ~GpuProgram();
 
-        /** Gets the syntax code for this program e.g. arbvp1, fp20, vs_1_1 etc */
-        virtual const String& getSyntaxCode(void) const { return mSyntaxCode; }
+        /**
+         * @brief	Source used for creating this program.
+         */
+        virtual const String& getSource() const { return mSource; }
+        
+		/**
+		 * @brief	Type of GPU program (e.g. fragment, vertex)
+		 */
+        virtual GpuProgramType getType() const { return mType; }
 
-        /** Gets the assembler source for this program. */
-        virtual const String& getSource(void) const { return mSource; }
-        /// Get the program type
-        virtual GpuProgramType getType(void) const { return mType; }
+		/**
+		 * @brief	Profile of the GPU program (e.g. VS_4_0, VS_5_0)
+		 */
 		virtual GpuProgramProfile getProfile() const { return mProfile; }
+
+		/**
+		 * @brief	Name of the program entry method (e.g. "main")
+		 */
 		virtual const String& getEntryPoint() const { return mEntryPoint; }
 
-        /** Returns the GpuProgram which should be bound to the pipeline.
-        @remarks
-            This method is simply to allow some subclasses of GpuProgram to delegate
-            the program which is bound to the pipeline to a delegate, if required. */
-        virtual GpuProgramPtr getBindingDelegate(void) { return std::static_pointer_cast<GpuProgram>(getThisPtr()); }
+		/**
+		 * @brief	Returns a delegate that will be used for actually binding the program to the pipeline.
+		 */
+        virtual GpuProgramPtr getBindingDelegate() { return std::static_pointer_cast<GpuProgram>(getThisPtr()); }
 
-        /** Returns whether this program can be supported on the current renderer and hardware. */
-        virtual bool isSupported(void) const;
+		/**
+		 * @brief	Returns whether this program can be supported on the current renderer and hardware.
+		 */
+        virtual bool isSupported() const;
 
-		/** Sets whether this geometry program requires adjacency information
-			from the input primitives.
-		*/
-		virtual void setAdjacencyInfoRequired(bool r) { mNeedsAdjacencyInfo = r; }
-		/** Returns whether this geometry program requires adjacency information 
-			from the input primitives.
-		*/
+		/**
+		 * @brief	Sets whether this geometry program requires adjacency information
+		 *			from the input primitives.
+		 *
+		 * @note	Only relevant for geometry programs.
+		 */
+		virtual void setAdjacencyInfoRequired(bool required) { mNeedsAdjacencyInfo = required; }
+
+		/**
+		 * @brief	Returns whether this geometry program requires adjacency information
+		 *			from the input primitives.
+		 *
+		 * @note	Only relevant for geometry programs.
+		 */
 		virtual bool isAdjacencyInfoRequired(void) const { return mNeedsAdjacencyInfo; }
 
-        /** Creates a new parameters object compatible with this program definition. 
-        @remarks
-            It is recommended that you use this method of creating parameters objects
-            rather than going direct to GpuProgramManager, because this method will
-            populate any implementation-specific extras (like named parameters) where
-            they are appropriate.
-        */
+		/**
+		 * @brief	Creates a new parameters object compatible with this program definition. You
+		 *			may populate the returned object with actual parameter values and bind it
+		 *			to the pipeline to render an object using those values and this program.
+		 */
 		virtual GpuParamsPtr createParameters();
 
+		/**
+		 * @brief	Returns description of all parameters in this GPU program.
+		 */
 		const GpuParamDesc& getParamDesc() const { return mParametersDesc; }
 
-		/** Returns a string that specifies the language of the gpu programs as specified
-        in a material script. ie: asm, cg, hlsl, glsl
-        */
-        virtual const String& getLanguage(void) const;
+		/**
+		* @brief	Language this shader was created from (e.g. HLSL, GLSL).
+		*/
+        virtual const String& getLanguage() const;
 
 	protected:
 		friend class GpuProgramManager;
 
-		GpuProgram(const String& source, const String& entryPoint, const String& language, 
+		GpuProgram(const String& source, const String& entryPoint, 
 			GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, 
 			bool isAdjacencyInfoRequired = false);
 
-        /** Internal method returns whether required capabilities for this program is supported.
-        */
+		/**
+		 * @brief	Returns whether required capabilities for this program is supported.
+		 */
         bool isRequiredCapabilitiesSupported(void) const;
 
-		/// @copydoc Resource::calculateSize
+		/**
+		 * @copydoc Resource::calculateSize
+		 */
 		size_t calculateSize(void) const { return 0; } // TODO 
 
 	protected:
-		/// The type of the program
 		GpuProgramType mType;
-		/// Does this (geometry) program require adjacency information?
 		bool mNeedsAdjacencyInfo;
-		/// Name of the shader entry method
 		String mEntryPoint;
-		/// Shader profiler that we are targeting (e.g. vs_1_1, etc.). Make sure profile matches the type.
 		GpuProgramProfile mProfile;
-        /// The assembler source of the program (may be blank until file loaded)
         String mSource;
-        /// Syntax code e.g. arbvp1, vs_2_0 etc
-        String mSyntaxCode;
 
-		/**
-		 * @brief	Contains information about all parameters in a shader.
-		 */
 		GpuParamDesc mParametersDesc;
 
 		/************************************************************************/
@@ -185,8 +167,4 @@ namespace BansheeEngine {
 		static RTTITypeBase* getRTTIStatic();
 		virtual RTTITypeBase* getRTTI() const;
 	};
-
-	/** @} */
-}
-
-#endif
+}

+ 2 - 2
CamelotCore/Include/CmGpuProgramManager.h

@@ -51,7 +51,7 @@ namespace BansheeEngine {
 	protected:
 		/** General create method
         */
-        virtual GpuProgramPtr create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile) = 0;
+        virtual GpuProgramPtr create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile) = 0;
 
 	public:
 		GpuProgramManager();
@@ -85,7 +85,7 @@ namespace BansheeEngine {
 		@param gptype The type of program to create.
         @param syntaxCode The name of the syntax to be used for this program e.g. arbvp1, vs_1_1
 		*/
-		GpuProgramPtr createProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
+		GpuProgramPtr createProgram(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile);
 	};
 
 	/** @} */

+ 0 - 2
CamelotCore/Include/CmGpuProgramRTTI.h

@@ -16,7 +16,6 @@ namespace BansheeEngine
 		CM_SETGET_MEMBER(mEntryPoint, String, GpuProgram);
 		CM_SETGET_MEMBER(mProfile, GpuProgramProfile, GpuProgram);
 		CM_SETGET_MEMBER(mSource, String, GpuProgram);
-		CM_SETGET_MEMBER(mSyntaxCode, String, GpuProgram);
 
 	public:
 		GpuProgramRTTI()
@@ -28,7 +27,6 @@ namespace BansheeEngine
 			CM_ADD_PLAINFIELD(mEntryPoint, 4, GpuProgramRTTI)
 			CM_ADD_PLAINFIELD(mProfile, 5, GpuProgramRTTI)
 			CM_ADD_PLAINFIELD(mSource, 6, GpuProgramRTTI)
-			CM_ADD_PLAINFIELD(mSyntaxCode, 7, GpuProgramRTTI)
 		}
 
 		virtual void onDeserializationEnded(IReflectable* obj)

+ 1 - 1
CamelotCore/Include/CmHighLevelGpuProgram.h

@@ -72,7 +72,7 @@ namespace BansheeEngine {
 		friend class HighLevelGpuProgramManager;
 
 		/** Constructor, should be used only by factory classes. */
-		HighLevelGpuProgram(const String& source, const String& entryPoint, const String& language, 
+		HighLevelGpuProgram(const String& source, const String& entryPoint,
 			GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes,
 			bool isAdjacencyInfoRequired = false);
 

+ 3 - 3
CamelotCore/Source/CmGpuParam.cpp

@@ -94,7 +94,7 @@ namespace BansheeEngine
 		return paramDesc->elementSize * sizeof(UINT32);
 	}
 
-	void GpuParamStruct::destroy()
+	void GpuParamStruct::_destroy()
 	{
 		mData->isDestroyed = true;
 	}
@@ -138,7 +138,7 @@ namespace BansheeEngine
 		return mData->textures[mData->paramDesc->slot];
 	}
 
-	void GpuParamTexture::destroy()
+	void GpuParamTexture::_destroy()
 	{
 		mData->isDestroyed = true;
 	}
@@ -182,7 +182,7 @@ namespace BansheeEngine
 		return mData->samplerStates[mData->paramDesc->slot];
 	}
 
-	void GpuParamSampState::destroy()
+	void GpuParamSampState::_destroy()
 	{
 		mData->isDestroyed = true;
 	}

+ 9 - 9
CamelotCore/Source/CmGpuParams.cpp

@@ -114,31 +114,31 @@ namespace BansheeEngine
 	{
 		// Free params
 		for(auto& param : mFloatParams)
-			param.second.destroy();
+			param.second._destroy();
 
 		for(auto& param : mVec2Params)
-			param.second.destroy();
+			param.second._destroy();
 
 		for(auto& param : mVec3Params)
-			param.second.destroy();
+			param.second._destroy();
 
 		for(auto& param : mVec4Params)
-			param.second.destroy();
+			param.second._destroy();
 
 		for(auto& param : mMat3Params)
-			param.second.destroy();
+			param.second._destroy();
 
 		for(auto& param : mMat4Params)
-			param.second.destroy();
+			param.second._destroy();
 
 		for(auto& param : mStructParams)
-			param.second.destroy();
+			param.second._destroy();
 
 		for(auto& param : mTextureParams)
-			param.second.destroy();
+			param.second._destroy();
 
 		for(auto& param : mSampStateParams)
-			param.second.destroy();
+			param.second._destroy();
 
 		// Ensure everything is destructed
 		for(UINT32 i = 0; i < mNumParamBlocks; i++)

+ 9 - 41
CamelotCore/Source/CmGpuProgram.cpp

@@ -1,30 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-(Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "CmGpuProgram.h"
 #include "CmHighLevelGpuProgram.h"
 #include "CmVector3.h"
@@ -39,10 +12,9 @@ THE SOFTWARE.
 
 namespace BansheeEngine
 {
-    //-----------------------------------------------------------------------------
-    GpuProgram::GpuProgram(const String& source, const String& entryPoint, const String& language, 
+    GpuProgram::GpuProgram(const String& source, const String& entryPoint, 
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, bool isAdjacencyInfoRequired) 
-        :mEntryPoint(entryPoint), mSyntaxCode(language), mType(gptype),
+        :mEntryPoint(entryPoint), mType(gptype),
 		mProfile(profile), mNeedsAdjacencyInfo(isAdjacencyInfoRequired)
     {
 		if(includes != nullptr)
@@ -65,30 +37,26 @@ namespace BansheeEngine
 			mSource = source;
 		}
     }
-	//----------------------------------------------------------------------------
+
 	GpuProgram::~GpuProgram()
 	{
 	}
-    //-----------------------------------------------------------------------------
-    bool GpuProgram::isSupported(void) const
-    {
-        if (!isRequiredCapabilitiesSupported())
-            return false;
 
-		RenderSystem* rs = BansheeEngine::RenderSystem::instancePtr();
-		return rs->getCapabilities()->isShaderProfileSupported(mSyntaxCode);
+    bool GpuProgram::isSupported() const
+    {
+		return false;
     }
-	//-----------------------------------------------------------------------------
+
 	bool GpuProgram::isRequiredCapabilitiesSupported(void) const
 	{
 		return true;
 	}
-	//---------------------------------------------------------------------
+
 	GpuParamsPtr GpuProgram::createParameters(void)
 	{
 		return cm_shared_ptr<GpuParams, PoolAlloc>(std::ref(mParametersDesc), false);
 	}
-    //-----------------------------------------------------------------------
+
     const String& GpuProgram::getLanguage(void) const
     {
         static const String language = "asm";

+ 2 - 2
CamelotCore/Source/CmGpuProgramManager.cpp

@@ -41,9 +41,9 @@ namespace BansheeEngine {
 		// subclasses should unregister with resource group manager
 	}
     //---------------------------------------------------------------------------
-	GpuProgramPtr GpuProgramManager::createProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile)
+	GpuProgramPtr GpuProgramManager::createProgram(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile)
     {
-		GpuProgramPtr prg = create(source, entryPoint, language, gptype, profile);
+		GpuProgramPtr prg = create(source, entryPoint, gptype, profile);
 		prg->_setThisPtr(prg);
 
 		// TODO: Gpu programs get initialized by their parent HighLevelGpuProgram. I might handle that more intuitively later but

+ 2 - 2
CamelotCore/Source/CmHighLevelGpuProgram.cpp

@@ -34,9 +34,9 @@ THE SOFTWARE.
 
 namespace BansheeEngine
 {
-	HighLevelGpuProgram::HighLevelGpuProgram(const String& source, const String& entryPoint, const String& language, 
+	HighLevelGpuProgram::HighLevelGpuProgram(const String& source, const String& entryPoint, 
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, bool isAdjacencyInfoRequired)
-        : GpuProgram(source, entryPoint, language, gptype, profile, includes, isAdjacencyInfoRequired), 
+        : GpuProgram(source, entryPoint, gptype, profile, includes, isAdjacencyInfoRequired), 
         mAssemblerProgram(nullptr)
     {
     }

+ 1 - 1
CamelotCore/Source/CmHighLevelGpuProgramManager.cpp

@@ -51,7 +51,7 @@ namespace BansheeEngine {
 		}
 	public:
 		NullProgram()
-			: HighLevelGpuProgram("", "", "", GPT_VERTEX_PROGRAM, GPP_NONE, nullptr){}
+			: HighLevelGpuProgram("", "", GPT_VERTEX_PROGRAM, GPP_NONE, nullptr){}
 		~NullProgram() {}
 		/// Overridden from GpuProgram - never supported
 		bool isSupported(void) const { return false; }

+ 13 - 12
CamelotD3D11RenderSystem/Include/CmD3D11GpuProgram.h

@@ -10,8 +10,9 @@ namespace BansheeEngine
 	public:
 		virtual ~D3D11GpuProgram();
 
+		bool isSupported() const;
 	protected:
-		D3D11GpuProgram(GpuProgramType type, const String& profile);
+		D3D11GpuProgram(GpuProgramType type, GpuProgramProfile profile);
 
 		/**
 		 * @brief	Loads shader from microcode.
@@ -24,12 +25,12 @@ namespace BansheeEngine
 	public:
 		~D3D11GpuVertexProgram();
 
-		ID3D11VertexShader* getVertexShader(void) const;
+		ID3D11VertexShader* getVertexShader() const;
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	protected:
 		friend class D3D11GpuProgramManager;
 
-		D3D11GpuVertexProgram(const String& profile);
+		D3D11GpuVertexProgram(GpuProgramProfile profile);
 
 		/**
 		 * @copydoc GpuProgram::destroy_internal().
@@ -45,12 +46,12 @@ namespace BansheeEngine
 	public:
 		~D3D11GpuFragmentProgram();
 
-		ID3D11PixelShader* getPixelShader(void) const;
+		ID3D11PixelShader* getPixelShader() const;
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	protected:
 		friend class D3D11GpuProgramManager;
 
-		D3D11GpuFragmentProgram(const String& profile);
+		D3D11GpuFragmentProgram(GpuProgramProfile profile);
 
 		/**
 		 * @copydoc GpuProgram::destroy_internal().
@@ -65,12 +66,12 @@ namespace BansheeEngine
 	public:
 		~D3D11GpuDomainProgram();
 
-		ID3D11DomainShader* getDomainShader(void) const;
+		ID3D11DomainShader* getDomainShader() const;
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	protected:
 		friend class D3D11GpuProgramManager;
 
-		D3D11GpuDomainProgram(const String& profile);
+		D3D11GpuDomainProgram(GpuProgramProfile profile);
 
 		/**
 		 * @copydoc GpuProgram::destroy_internal().
@@ -91,7 +92,7 @@ namespace BansheeEngine
 	protected:
 		friend class D3D11GpuProgramManager;
 
-		D3D11GpuHullProgram(const String& profile);
+		D3D11GpuHullProgram(GpuProgramProfile profile);
 
 		/**
 		 * @copydoc GpuProgram::destroy_internal().
@@ -107,13 +108,13 @@ namespace BansheeEngine
 	public:
 		~D3D11GpuGeometryProgram();
 
-		ID3D11GeometryShader* getGeometryShader(void) const;
+		ID3D11GeometryShader* getGeometryShader() const;
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 
 	protected:
 		friend class D3D11GpuProgramManager;
 
-		D3D11GpuGeometryProgram(const String& profile);
+		D3D11GpuGeometryProgram(GpuProgramProfile profile);
 
 		/**
 		 * @copydoc GpuProgram::destroy_internal().
@@ -129,13 +130,13 @@ namespace BansheeEngine
 	public:
 		~D3D11GpuComputeProgram();
 
-		ID3D11ComputeShader* getComputeShader(void) const;
+		ID3D11ComputeShader* getComputeShader() const;
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 
 	protected:
 		friend class D3D11GpuProgramManager;
 
-		D3D11GpuComputeProgram(const String& profile);
+		D3D11GpuComputeProgram(GpuProgramProfile profile);
 
 		/**
 		 * @copydoc GpuProgram::destroy_internal().

+ 1 - 1
CamelotD3D11RenderSystem/Include/CmD3D11GpuProgramManager.h

@@ -14,6 +14,6 @@ namespace BansheeEngine
 	protected:
 		D3D11Device& mDevice;
 		
-		GpuProgramPtr create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
+		GpuProgramPtr create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile);
 	};
 }

+ 1 - 1
CamelotD3D11RenderSystem/Include/CmD3D11HLSLProgram.h

@@ -34,7 +34,7 @@ namespace BansheeEngine
 	protected:
 		friend class D3D11HLSLProgramFactory;
 
-		D3D11HLSLProgram(const String& source, const String& entryPoint, const String& language, 
+		D3D11HLSLProgram(const String& source, const String& entryPoint,
 			GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, 
 			bool isAdjacencyInfoRequired = false);
 

+ 22 - 9
CamelotD3D11RenderSystem/Source/CmD3D11GpuProgram.cpp

@@ -2,11 +2,13 @@
 #include "CmD3D11Device.h"
 #include "CmException.h"
 #include "CmDebug.h"
+#include "CmRenderSystem.h"
+#include "CmGpuProgramManager.h"
 
 namespace BansheeEngine
 {
-	D3D11GpuProgram::D3D11GpuProgram(GpuProgramType type, const String& profile) 
-		: GpuProgram("", "", profile, type, GPP_NONE, nullptr)
+	D3D11GpuProgram::D3D11GpuProgram(GpuProgramType type, GpuProgramProfile profile)
+		: GpuProgram("", "", type, profile, nullptr)
 	{
 
 	}
@@ -16,7 +18,18 @@ namespace BansheeEngine
 
 	}
 
-	D3D11GpuVertexProgram::D3D11GpuVertexProgram(const String& profile) 
+	bool D3D11GpuProgram::isSupported() const
+	{
+		if (!isRequiredCapabilitiesSupported())
+			return false;
+
+		RenderSystem* rs = BansheeEngine::RenderSystem::instancePtr();
+		String hlslProfile = GpuProgramManager::instance().gpuProgProfileToRSSpecificProfile(mProfile);
+
+		return rs->getCapabilities()->isShaderProfileSupported(hlslProfile);
+	}
+
+	D3D11GpuVertexProgram::D3D11GpuVertexProgram(GpuProgramProfile profile)
 		: D3D11GpuProgram(GPT_VERTEX_PROGRAM, profile)
 		, mVertexShader(nullptr)
 	{ }
@@ -61,7 +74,7 @@ namespace BansheeEngine
 		return mVertexShader;
 	}
 
-	D3D11GpuFragmentProgram::D3D11GpuFragmentProgram(const String& profile) 
+	D3D11GpuFragmentProgram::D3D11GpuFragmentProgram(GpuProgramProfile profile)
 		: D3D11GpuProgram(GPT_FRAGMENT_PROGRAM, profile)
 		, mPixelShader(nullptr)
 	{ }
@@ -105,7 +118,7 @@ namespace BansheeEngine
 		return mPixelShader;
 	}
 
-	D3D11GpuGeometryProgram::D3D11GpuGeometryProgram(const String& profile) 
+	D3D11GpuGeometryProgram::D3D11GpuGeometryProgram(GpuProgramProfile profile)
 		: D3D11GpuProgram(GPT_GEOMETRY_PROGRAM, profile)
 		, mGeometryShader(nullptr)
 	{ }
@@ -149,7 +162,7 @@ namespace BansheeEngine
 		return mGeometryShader;
 	}
 
-	D3D11GpuDomainProgram::D3D11GpuDomainProgram(const String& profile) 
+	D3D11GpuDomainProgram::D3D11GpuDomainProgram(GpuProgramProfile profile)
 		: D3D11GpuProgram(GPT_DOMAIN_PROGRAM, profile)
 		, mDomainShader(nullptr)
 	{ }
@@ -188,12 +201,12 @@ namespace BansheeEngine
 		D3D11GpuProgram::destroy_internal();
 	}
 
-	ID3D11DomainShader * D3D11GpuDomainProgram::getDomainShader(void) const
+	ID3D11DomainShader * D3D11GpuDomainProgram::getDomainShader() const
 	{
 		return mDomainShader;
 	}
 
-	D3D11GpuHullProgram::D3D11GpuHullProgram(const String& profile) 
+	D3D11GpuHullProgram::D3D11GpuHullProgram(GpuProgramProfile profile)
 		: D3D11GpuProgram(GPT_HULL_PROGRAM, profile)
 		, mHullShader(nullptr)
 	{ }
@@ -237,7 +250,7 @@ namespace BansheeEngine
 		return mHullShader;
 	}
 
-	D3D11GpuComputeProgram::D3D11GpuComputeProgram(const String& profile) 
+	D3D11GpuComputeProgram::D3D11GpuComputeProgram(GpuProgramProfile profile)
 		: D3D11GpuProgram(GPT_COMPUTE_PROGRAM, profile)
 		, mComputeShader(nullptr)
 	{ }

+ 6 - 6
CamelotD3D11RenderSystem/Source/CmD3D11GpuProgramManager.cpp

@@ -11,20 +11,20 @@ namespace BansheeEngine
 	{ }
 
 	GpuProgramPtr D3D11GpuProgramManager::create(const String& source, const String& entryPoint, 
-		const String& language, GpuProgramType gptype, GpuProgramProfile profile)
+		GpuProgramType gptype, GpuProgramProfile profile)
 	{
 		switch(gptype)
 		{
 		case GPT_VERTEX_PROGRAM:
-			return cm_core_ptr<D3D11GpuVertexProgram, PoolAlloc>(new (cm_alloc<D3D11GpuVertexProgram, PoolAlloc>()) D3D11GpuVertexProgram(language));
+			return cm_core_ptr<D3D11GpuVertexProgram, PoolAlloc>(new (cm_alloc<D3D11GpuVertexProgram, PoolAlloc>()) D3D11GpuVertexProgram(profile));
 		case GPT_FRAGMENT_PROGRAM:
-			return cm_core_ptr<D3D11GpuFragmentProgram, PoolAlloc>(new (cm_alloc<D3D11GpuFragmentProgram, PoolAlloc>()) D3D11GpuFragmentProgram(language));
+			return cm_core_ptr<D3D11GpuFragmentProgram, PoolAlloc>(new (cm_alloc<D3D11GpuFragmentProgram, PoolAlloc>()) D3D11GpuFragmentProgram(profile));
 		case GPT_HULL_PROGRAM:
-			return cm_core_ptr<D3D11GpuHullProgram, PoolAlloc>(new (cm_alloc<D3D11GpuHullProgram, PoolAlloc>()) D3D11GpuHullProgram(language));
+			return cm_core_ptr<D3D11GpuHullProgram, PoolAlloc>(new (cm_alloc<D3D11GpuHullProgram, PoolAlloc>()) D3D11GpuHullProgram(profile));
 		case GPT_DOMAIN_PROGRAM:
-			return cm_core_ptr<D3D11GpuDomainProgram, PoolAlloc>(new (cm_alloc<D3D11GpuDomainProgram, PoolAlloc>()) D3D11GpuDomainProgram(language));
+			return cm_core_ptr<D3D11GpuDomainProgram, PoolAlloc>(new (cm_alloc<D3D11GpuDomainProgram, PoolAlloc>()) D3D11GpuDomainProgram(profile));
 		case GPT_GEOMETRY_PROGRAM:
-			return cm_core_ptr<D3D11GpuGeometryProgram, PoolAlloc>(new (cm_alloc<D3D11GpuGeometryProgram, PoolAlloc>()) D3D11GpuGeometryProgram(language));
+			return cm_core_ptr<D3D11GpuGeometryProgram, PoolAlloc>(new (cm_alloc<D3D11GpuGeometryProgram, PoolAlloc>()) D3D11GpuGeometryProgram(profile));
 		}
 		
 		return nullptr;

+ 7 - 4
CamelotD3D11RenderSystem/Source/CmD3D11HLSLProgram.cpp

@@ -15,9 +15,9 @@ namespace BansheeEngine
 {
 	UINT32 D3D11HLSLProgram::globalProgramId = 0;
 
-	D3D11HLSLProgram::D3D11HLSLProgram(const String& source, const String& entryPoint, const String& language, 
+	D3D11HLSLProgram::D3D11HLSLProgram(const String& source, const String& entryPoint, 
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, bool isAdjacencyInfoRequired)
-		: HighLevelGpuProgram(source, entryPoint, language, gptype, profile, includes, isAdjacencyInfoRequired),
+		: HighLevelGpuProgram(source, entryPoint, gptype, profile, includes, isAdjacencyInfoRequired),
 		mColumnMajorMatrices(true), mEnableBackwardsCompatibility(false), mProgramId(0)
 	{
 	}
@@ -38,7 +38,7 @@ namespace BansheeEngine
 
 		populateParametersAndConstants(microcode);
 
-		mAssemblerProgram = GpuProgramManager::instance().createProgram("", "", hlslProfile, mType, GPP_NONE); // We load it from microcode, so none of this matters
+		mAssemblerProgram = GpuProgramManager::instance().createProgram("", "", mType, mProfile); // We load it from microcode, so none of this matters
 		D3D11RenderSystem* rs = static_cast<D3D11RenderSystem*>(RenderSystem::instancePtr());
 
 		switch(mType)
@@ -103,7 +103,10 @@ namespace BansheeEngine
 	{
 		RenderSystem* rs = RenderSystem::instancePtr();
 
-		return rs->getCapabilities()->isShaderProfileSupported(getSyntaxCode()) && HighLevelGpuProgram::isSupported();
+		String hlslProfile = GpuProgramManager::instance().gpuProgProfileToRSSpecificProfile(mProfile);
+
+		return rs->getCapabilities()->isShaderProfileSupported(hlslProfile) && 
+			rs->getCapabilities()->isShaderProfileSupported(getLanguage()) && HighLevelGpuProgram::isSupported();
 	}
 
 	ID3DBlob* D3D11HLSLProgram::compileMicrocode(const String& profile)

+ 2 - 2
CamelotD3D11RenderSystem/Source/CmD3D11HLSLProgramFactory.cpp

@@ -21,14 +21,14 @@ namespace BansheeEngine
 	HighLevelGpuProgramPtr D3D11HLSLProgramFactory::create(const String& source, const String& entryPoint, 
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes)
     {
-		D3D11HLSLProgram* prog = new (cm_alloc<D3D11HLSLProgram, PoolAlloc>()) D3D11HLSLProgram(source, entryPoint, sLanguageName, gptype, profile, includes);
+		D3D11HLSLProgram* prog = new (cm_alloc<D3D11HLSLProgram, PoolAlloc>()) D3D11HLSLProgram(source, entryPoint, gptype, profile, includes);
 
         return cm_core_ptr<D3D11HLSLProgram, PoolAlloc>(prog);
     }
 
 	HighLevelGpuProgramPtr D3D11HLSLProgramFactory::create()
 	{
-		D3D11HLSLProgram* prog = new (cm_alloc<D3D11HLSLProgram, PoolAlloc>()) D3D11HLSLProgram("", "", sLanguageName, GPT_VERTEX_PROGRAM, GPP_NONE, nullptr);
+		D3D11HLSLProgram* prog = new (cm_alloc<D3D11HLSLProgram, PoolAlloc>()) D3D11HLSLProgram("", "", GPT_VERTEX_PROGRAM, GPP_NONE, nullptr);
 
 		return cm_core_ptr<D3D11HLSLProgram, PoolAlloc>(prog);
 	}

+ 5 - 3
CamelotD3D9Renderer/Include/CmD3D9GpuProgram.h

@@ -56,10 +56,12 @@ namespace BansheeEngine {
         void setExternalMicrocode(ID3DXBuffer* pMicrocode);
         /** Gets the external microcode buffer, if any. */
         LPD3DXBUFFER getExternalMicrocode(void);
+
+		bool isSupported() const;
     protected:
 		friend class D3D9GpuProgramManager;
 
-		D3D9GpuProgram(const String& source, const String& entryPoint, const String& language, 
+		D3D9GpuProgram(const String& source, const String& entryPoint, 
 			GpuProgramType gptype, GpuProgramProfile profile);
 
 		void createInternalResources(IDirect3DDevice9* d3d9Device);
@@ -109,7 +111,7 @@ namespace BansheeEngine {
     protected:
 		friend class D3D9GpuProgramManager;
 
-		D3D9GpuVertexProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
+		D3D9GpuVertexProgram(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile);
 
 		/**
 		 * @copydoc D3D9GpuProgram::destroy_internal.
@@ -143,7 +145,7 @@ namespace BansheeEngine {
     protected:
 		friend class D3D9GpuProgramManager;
 
-		D3D9GpuFragmentProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
+		D3D9GpuFragmentProgram(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile);
 
 		/**
 		 * @copydoc D3D9GpuProgram::destroy_internal.

+ 1 - 1
CamelotD3D9Renderer/Include/CmD3D9GpuProgramManager.h

@@ -41,7 +41,7 @@ namespace BansheeEngine {
 		~D3D9GpuProgramManager();
 
 	protected:
-		GpuProgramPtr create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
+		GpuProgramPtr create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile);
     };
 
 }

+ 1 - 1
CamelotD3D9Renderer/Include/CmD3D9HLSLProgram.h

@@ -88,7 +88,7 @@ namespace BansheeEngine {
     protected:
 		friend class D3D9HLSLProgramFactory;
 
-		D3D9HLSLProgram(const String& source, const String& entryPoint, const String& language, 
+		D3D9HLSLProgram(const String& source, const String& entryPoint, 
 			GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, 
 			bool isAdjacencyInfoRequired = false);
  

+ 18 - 6
CamelotD3D9Renderer/Source/CmD3D9GpuProgram.cpp

@@ -33,12 +33,13 @@ THE SOFTWARE.
 #include "CmD3D9ResourceManager.h"
 #include "CmGpuParams.h"
 #include "CmAsyncOp.h"
+#include "CmGpuProgramManager.h"
 
 namespace BansheeEngine {
     //-----------------------------------------------------------------------------
-    D3D9GpuProgram::D3D9GpuProgram(const String& source, const String& entryPoint, const String& language, 
+    D3D9GpuProgram::D3D9GpuProgram(const String& source, const String& entryPoint, 
 		GpuProgramType gptype, GpuProgramProfile profile) 
-        : GpuProgram(source, entryPoint, language, gptype, profile, nullptr), mpExternalMicrocode(NULL), mColumnMajorMatrices(false)
+        : GpuProgram(source, entryPoint, gptype, profile, nullptr), mpExternalMicrocode(NULL), mColumnMajorMatrices(false)
     {
     }
 
@@ -140,9 +141,20 @@ namespace BansheeEngine {
 
 		return params;
 	}
+
+	bool D3D9GpuProgram::isSupported() const
+	{
+		if (!isRequiredCapabilitiesSupported())
+			return false;
+
+		RenderSystem* rs = BansheeEngine::RenderSystem::instancePtr();
+		String hlslProfile = GpuProgramManager::instance().gpuProgProfileToRSSpecificProfile(mProfile);
+
+		return rs->getCapabilities()->isShaderProfileSupported(hlslProfile);
+	}
 	//-----------------------------------------------------------------------------
-	D3D9GpuVertexProgram::D3D9GpuVertexProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile) 
-        : D3D9GpuProgram(source, entryPoint, language, gptype, profile)       
+	D3D9GpuVertexProgram::D3D9GpuVertexProgram(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile) 
+        : D3D9GpuProgram(source, entryPoint, gptype, profile)       
     {
         mType = GPT_VERTEX_PROGRAM;		
     }
@@ -236,8 +248,8 @@ namespace BansheeEngine {
 		return it->second;
 	}
 	//-----------------------------------------------------------------------------
-    D3D9GpuFragmentProgram::D3D9GpuFragmentProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile) 
-		: D3D9GpuProgram(source, entryPoint, language, gptype, profile)       
+    D3D9GpuFragmentProgram::D3D9GpuFragmentProgram(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile) 
+		: D3D9GpuProgram(source, entryPoint, gptype, profile)       
     {
         mType = GPT_FRAGMENT_PROGRAM;
     }

+ 3 - 3
CamelotD3D9Renderer/Source/CmD3D9GpuProgramManager.cpp

@@ -42,17 +42,17 @@ namespace BansheeEngine {
 
     }
     //-----------------------------------------------------------------------------
-    GpuProgramPtr D3D9GpuProgramManager::create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile)
+    GpuProgramPtr D3D9GpuProgramManager::create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile)
     {
         if (gptype == GPT_VERTEX_PROGRAM)
         {
-            D3D9GpuVertexProgram* prog = new (cm_alloc<D3D9GpuVertexProgram, PoolAlloc>()) D3D9GpuVertexProgram(source, entryPoint, language, gptype, profile);
+            D3D9GpuVertexProgram* prog = new (cm_alloc<D3D9GpuVertexProgram, PoolAlloc>()) D3D9GpuVertexProgram(source, entryPoint, gptype, profile);
 
 			return cm_core_ptr<D3D9GpuVertexProgram, PoolAlloc>(prog);
         }
         else
         {
-            D3D9GpuFragmentProgram* prog = new (cm_alloc<D3D9GpuFragmentProgram, PoolAlloc>()) D3D9GpuFragmentProgram(source, entryPoint, language, gptype, profile);
+            D3D9GpuFragmentProgram* prog = new (cm_alloc<D3D9GpuFragmentProgram, PoolAlloc>()) D3D9GpuFragmentProgram(source, entryPoint, gptype, profile);
 
 			return cm_core_ptr<D3D9GpuFragmentProgram, PoolAlloc>(prog);
         }

+ 2 - 5
CamelotD3D9Renderer/Source/CmD3D9HLSLProgram.cpp

@@ -37,9 +37,9 @@ THE SOFTWARE.
 
 namespace BansheeEngine {
 	//-----------------------------------------------------------------------
-	D3D9HLSLProgram::D3D9HLSLProgram(const String& source, const String& entryPoint, const String& language, 
+	D3D9HLSLProgram::D3D9HLSLProgram(const String& source, const String& entryPoint,
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, bool isAdjacencyInfoRequired)
-		: HighLevelGpuProgram(source, entryPoint, language, gptype, profile, includes, isAdjacencyInfoRequired)
+		: HighLevelGpuProgram(source, entryPoint, gptype, profile, includes, isAdjacencyInfoRequired)
 		, mPreprocessorDefines()
 		, mColumnMajorMatrices(true)
 		, mpMicroCode(NULL)
@@ -197,14 +197,11 @@ namespace BansheeEngine {
 				CM_EXCEPT(RenderingAPIException, message);
 			}
 
-			hlslProfile = GpuProgramManager::instance().gpuProgProfileToRSSpecificProfile(mProfile);
-
 			// Create a low-level program, give it the same name as us
 			mAssemblerProgram = 
 				GpuProgramManager::instance().createProgram(
 				"",// dummy source, since we'll be using microcode
 				"",
-				hlslProfile,
 				mType, 
 				GPP_NONE);
 			static_cast<D3D9GpuProgram*>(mAssemblerProgram.get())->setExternalMicrocode(mpMicroCode);

+ 2 - 2
CamelotD3D9Renderer/Source/CmD3D9HLSLProgramFactory.cpp

@@ -50,14 +50,14 @@ namespace BansheeEngine {
 	HighLevelGpuProgramPtr D3D9HLSLProgramFactory::create(const String& source, const String& entryPoint, 
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes)
     {
-		D3D9HLSLProgram* prog = new (cm_alloc<D3D9HLSLProgram, PoolAlloc>()) D3D9HLSLProgram(source, entryPoint, sLanguageName, gptype, profile, includes);
+		D3D9HLSLProgram* prog = new (cm_alloc<D3D9HLSLProgram, PoolAlloc>()) D3D9HLSLProgram(source, entryPoint, gptype, profile, includes);
 
         return cm_core_ptr<D3D9HLSLProgram, PoolAlloc>(prog);
     }
 	//-----------------------------------------------------------------------
 	HighLevelGpuProgramPtr D3D9HLSLProgramFactory::create()
 	{
-		D3D9HLSLProgram* prog = new (cm_alloc<D3D9HLSLProgram, PoolAlloc>()) D3D9HLSLProgram("", "", sLanguageName, GPT_VERTEX_PROGRAM, GPP_NONE, nullptr);
+		D3D9HLSLProgram* prog = new (cm_alloc<D3D9HLSLProgram, PoolAlloc>()) D3D9HLSLProgram("", "", GPT_VERTEX_PROGRAM, GPP_NONE, nullptr);
 
 		return cm_core_ptr<D3D9HLSLProgram, PoolAlloc>(prog);
 	}

+ 1 - 1
CamelotGLRenderer/Include/CmGLGpuProgramManager.h

@@ -42,7 +42,7 @@ namespace BansheeEngine
 
 		protected:
 			/// Specialised create method with specific parameters
-			GpuProgramPtr create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
+			GpuProgramPtr create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile);
 	};
 
 };

+ 2 - 2
CamelotGLRenderer/Source/CmGLGpuProgramManager.cpp

@@ -41,9 +41,9 @@ namespace BansheeEngine
 	{
 	}
 
-	GpuProgramPtr GLGpuProgramManager::create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile)
+	GpuProgramPtr GLGpuProgramManager::create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile)
 	{
-		GLSLGpuProgram* prog = new (cm_alloc<GLSLGpuProgram, PoolAlloc>()) GLSLGpuProgram(source, entryPoint, language, gptype, profile, nullptr);
+		GLSLGpuProgram* prog = new (cm_alloc<GLSLGpuProgram, PoolAlloc>()) GLSLGpuProgram(source, entryPoint, gptype, profile, nullptr);
 
 		return cm_core_ptr<GLSLGpuProgram, PoolAlloc>(prog);
 	}

+ 3 - 1
CamelotGLRenderer/Source/GLSL/include/CmGLSLGpuProgram.h

@@ -57,10 +57,12 @@ namespace BansheeEngine {
 		/// Get the assigned GL program id
 		const UINT32 getProgramID(void) const { return mProgramID; }
 
+		bool isSupported() const;
+
 	private:
 		friend class GLGpuProgramManager;
 
-		GLSLGpuProgram(const String& source, const String& entryPoint, const String& language, 
+		GLSLGpuProgram(const String& source, const String& entryPoint, 
 			GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes);
 
 		/// GL Handle for the shader object

+ 3 - 1
CamelotGLRenderer/Source/GLSL/include/CmGLSLProgram.h

@@ -98,10 +98,12 @@ namespace BansheeEngine {
 
 		const VertexDeclaration& getInputAttributes() const { return *mVertexDeclaration; }
 
+		bool isSupported() const;
+
 	protected:
 		friend class GLSLProgramFactory;
 
-		GLSLProgram(const String& source, const String& entryPoint, const String& language, 
+		GLSLProgram(const String& source, const String& entryPoint, 
 			GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, 
 			bool isAdjacencyInfoRequired = false);
 

+ 12 - 4
CamelotGLRenderer/Source/GLSL/src/CmGLSLGpuProgram.cpp

@@ -30,6 +30,7 @@ THE SOFTWARE.
 #include "CmGLSLExtSupport.h"
 #include "CmGLSLGpuProgram.h"
 #include "CmGLSLProgram.h"
+#include "CmRenderSystem.h"
 
 namespace BansheeEngine {
 
@@ -39,12 +40,10 @@ namespace BansheeEngine {
 	UINT32 GLSLGpuProgram::mDomainShaderCount = 0;
 	UINT32 GLSLGpuProgram::mHullShaderCount = 0;
     //-----------------------------------------------------------------------------
-	GLSLGpuProgram::GLSLGpuProgram(const String& source, const String& entryPoint, const String& language, 
+	GLSLGpuProgram::GLSLGpuProgram(const String& source, const String& entryPoint,
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes) 
-		:GpuProgram(source, entryPoint, language, gptype, profile, includes)
+		:GpuProgram(source, entryPoint, gptype, profile, includes)
     {
-        mSyntaxCode = "glsl";
-
 		switch(mType)
 		{
 		case GPT_VERTEX_PROGRAM:
@@ -70,5 +69,14 @@ namespace BansheeEngine {
     GLSLGpuProgram::~GLSLGpuProgram()
     {
     }
+
+	bool GLSLGpuProgram::isSupported() const
+	{
+		if (!isRequiredCapabilitiesSupported())
+			return false;
+
+		RenderSystem* rs = BansheeEngine::RenderSystem::instancePtr();
+		return rs->getCapabilities()->isShaderProfileSupported("glsl");
+	}
 }
 

+ 12 - 5
CamelotGLRenderer/Source/GLSL/src/CmGLSLProgram.cpp

@@ -46,14 +46,12 @@ THE SOFTWARE.
 namespace BansheeEngine 
 {
 	//-----------------------------------------------------------------------
-	GLSLProgram::GLSLProgram(const String& source, const String& entryPoint, const String& language, 
+	GLSLProgram::GLSLProgram(const String& source, const String& entryPoint,
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, bool isAdjacencyInfoRequired)
-		: HighLevelGpuProgram(source, entryPoint, language, gptype, profile, includes, isAdjacencyInfoRequired),
+		: HighLevelGpuProgram(source, entryPoint, gptype, profile, includes, isAdjacencyInfoRequired),
 		mInputOperationType(DOT_TRIANGLE_LIST),
 		mOutputOperationType(DOT_TRIANGLE_LIST), mMaxOutputVertices(3)
 	{
-		// Manually assign language now since we use it immediately
-		mSyntaxCode = "glsl";
 
 	}
 	//---------------------------------------------------------------------------
@@ -168,7 +166,7 @@ namespace BansheeEngine
 			checkForGLSLError( "GLSLProgram::loadFromSource", "Cannot load GLSL high-level shader source : ", mGLHandle, GLSLOT_PROGRAM, true);
 		}
 
-		mAssemblerProgram = GpuProgramManager::instance().createProgram(mSource, mEntryPoint, mSyntaxCode, mType, mProfile);
+		mAssemblerProgram = GpuProgramManager::instance().createProgram(mSource, mEntryPoint, mType, mProfile);
 		
 		std::shared_ptr<GLSLGpuProgram> glslGpuProgram = std::static_pointer_cast<GLSLGpuProgram>(mAssemblerProgram);
 		glslGpuProgram->setGLSLProgram(this);
@@ -197,6 +195,15 @@ namespace BansheeEngine
         return language;
     }
 
+	bool GLSLProgram::isSupported() const
+	{
+		if (!isRequiredCapabilitiesSupported())
+			return false;
+
+		RenderSystem* rs = BansheeEngine::RenderSystem::instancePtr();
+		return rs->getCapabilities()->isShaderProfileSupported("glsl");
+	}
+
 	/************************************************************************/
 	/* 								SERIALIZATION                      		*/
 	/************************************************************************/

+ 2 - 2
CamelotGLRenderer/Source/GLSL/src/CmGLSLProgramFactory.cpp

@@ -41,14 +41,14 @@ namespace BansheeEngine {
     HighLevelGpuProgramPtr GLSLProgramFactory::create(const String& source, const String& entryPoint, 
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes)
     {
-		GLSLProgram* prog = new (cm_alloc<GLSLProgram, PoolAlloc>()) GLSLProgram(source, entryPoint, sLanguageName, gptype, profile, includes);
+		GLSLProgram* prog = new (cm_alloc<GLSLProgram, PoolAlloc>()) GLSLProgram(source, entryPoint, gptype, profile, includes);
 
 		return cm_core_ptr<GLSLProgram, PoolAlloc>(prog);
     }
 	//-----------------------------------------------------------------------
 	HighLevelGpuProgramPtr GLSLProgramFactory::create()
 	{
-		GLSLProgram* prog = new (cm_alloc<GLSLProgram, PoolAlloc>()) GLSLProgram("", "", sLanguageName, GPT_VERTEX_PROGRAM, GPP_NONE, nullptr);
+		GLSLProgram* prog = new (cm_alloc<GLSLProgram, PoolAlloc>()) GLSLProgram("", "", GPT_VERTEX_PROGRAM, GPP_NONE, nullptr);
 
 		return cm_core_ptr<GLSLProgram, PoolAlloc>(prog);
 	}