Browse Source

Moved GpuPipelineParamState a core object and moved it to its own file

BearishSun 9 years ago
parent
commit
a12ad99267
23 changed files with 511 additions and 273 deletions
  1. 2 0
      Source/BansheeCore/CMakeSources.cmake
  2. 1 0
      Source/BansheeCore/Include/BsCorePrerequisites.h
  3. 7 5
      Source/BansheeCore/Include/BsGpuParams.h
  4. 116 0
      Source/BansheeCore/Include/BsGpuPipelineParamInfo.h
  5. 8 73
      Source/BansheeCore/Include/BsGpuPipelineState.h
  6. 2 2
      Source/BansheeCore/Include/BsHardwareBufferManager.h
  7. 2 2
      Source/BansheeCore/Include/BsParamBlocks.h
  8. 7 0
      Source/BansheeCore/Include/BsRenderStateManager.h
  9. 8 6
      Source/BansheeCore/Source/BsGpuParams.cpp
  10. 225 0
      Source/BansheeCore/Source/BsGpuPipelineParamInfo.cpp
  11. 3 178
      Source/BansheeCore/Source/BsGpuPipelineState.cpp
  12. 2 2
      Source/BansheeCore/Source/BsHardwareBufferManager.cpp
  13. 21 0
      Source/BansheeCore/Source/BsRenderStateManager.cpp
  14. 1 1
      Source/BansheeVulkanRenderAPI/Include/BsVulkanGpuParams.h
  15. 25 0
      Source/BansheeVulkanRenderAPI/Include/BsVulkanGpuPipelineParamInfo.h
  16. 16 1
      Source/BansheeVulkanRenderAPI/Include/BsVulkanGpuPipelineState.h
  17. 1 1
      Source/BansheeVulkanRenderAPI/Include/BsVulkanHardwareBufferManager.h
  18. 7 0
      Source/BansheeVulkanRenderAPI/Include/BsVulkanRenderStateManager.h
  19. 1 1
      Source/BansheeVulkanRenderAPI/Source/BsVulkanGpuParams.cpp
  20. 17 0
      Source/BansheeVulkanRenderAPI/Source/BsVulkanGpuPipelineParamInfo.cpp
  21. 15 0
      Source/BansheeVulkanRenderAPI/Source/BsVulkanGpuPipelineState.cpp
  22. 1 1
      Source/BansheeVulkanRenderAPI/Source/BsVulkanHardwareBufferManager.cpp
  23. 23 0
      Source/BansheeVulkanRenderAPI/Source/BsVulkanRenderStateManager.cpp

+ 2 - 0
Source/BansheeCore/CMakeSources.cmake

@@ -139,6 +139,7 @@ set(BS_BANSHEECORE_INC_RENDERAPI
 	"Include/BsViewport.h"
 	"Include/BsViewport.h"
 	"Include/BsCommandBuffer.h"
 	"Include/BsCommandBuffer.h"
 	"Include/BsGpuPipelineState.h"
 	"Include/BsGpuPipelineState.h"
+	"Include/BsGpuPipelineParamInfo.h"
 )
 )
 
 
 set(BS_BANSHEECORE_INC_RENDERAPI_MANAGERS
 set(BS_BANSHEECORE_INC_RENDERAPI_MANAGERS
@@ -423,6 +424,7 @@ set(BS_BANSHEECORE_SRC_RENDERAPI
 	"Source/BsViewport.cpp"
 	"Source/BsViewport.cpp"
 	"Source/BsCommandBuffer.cpp"
 	"Source/BsCommandBuffer.cpp"
 	"Source/BsGpuPipelineState.cpp"
 	"Source/BsGpuPipelineState.cpp"
+	"Source/BsGpuPipelineParamInfo.cpp"
 )
 )
 
 
 set(BS_BANSHEECORE_SRC_RENDERAPI_MANAGERS
 set(BS_BANSHEECORE_SRC_RENDERAPI_MANAGERS

+ 1 - 0
Source/BansheeCore/Include/BsCorePrerequisites.h

@@ -373,6 +373,7 @@ namespace BansheeEngine
 	class AnimationClip;
 	class AnimationClip;
 	class CCamera;
 	class CCamera;
 	class GpuPipelineParamInfo;
 	class GpuPipelineParamInfo;
+	class GpuPipelineParamInfoCore;
 	template <class T> class TAnimationCurve;
 	template <class T> class TAnimationCurve;
 	struct AnimationCurves;
 	struct AnimationCurves;
 	class Skeleton;
 	class Skeleton;

+ 7 - 5
Source/BansheeCore/Include/BsGpuParams.h

@@ -36,6 +36,8 @@ namespace BansheeEngine
 	template<> struct TGpuDataParamInfo < Matrix4x3 > { enum { TypeId = GPDT_MATRIX_4X3 }; };
 	template<> struct TGpuDataParamInfo < Matrix4x3 > { enum { TypeId = GPDT_MATRIX_4X3 }; };
 	template<> struct TGpuDataParamInfo < Color > { enum { TypeId = GPDT_COLOR }; };
 	template<> struct TGpuDataParamInfo < Color > { enum { TypeId = GPDT_COLOR }; };
 
 
+	class GpuPipelineParamInfoBase;
+
 	/** Contains functionality common for both sim and core thread version of GpuParams. */
 	/** Contains functionality common for both sim and core thread version of GpuParams. */
 	class BS_CORE_EXPORT GpuParamsBase
 	class BS_CORE_EXPORT GpuParamsBase
 	{
 	{
@@ -83,12 +85,12 @@ namespace BansheeEngine
 		virtual void _markResourcesDirty() { }
 		virtual void _markResourcesDirty() { }
 
 
 	protected:
 	protected:
-		GpuParamsBase(const SPtr<GpuPipelineParamInfo>& paramInfo);
+		GpuParamsBase(const SPtr<GpuPipelineParamInfoBase>& paramInfo);
 
 
 		/**	Gets a descriptor for a data parameter with the specified name. */
 		/**	Gets a descriptor for a data parameter with the specified name. */
 		GpuParamDataDesc* getParamDesc(GpuProgramType type, const String& name) const;
 		GpuParamDataDesc* getParamDesc(GpuProgramType type, const String& name) const;
 
 
-		SPtr<GpuPipelineParamInfo> mParamInfo;
+		SPtr<GpuPipelineParamInfoBase> mParamInfo;
 	};
 	};
 
 
 	template<bool Core> struct TGpuParamsTypes { };
 	template<bool Core> struct TGpuParamsTypes { };
@@ -206,7 +208,7 @@ namespace BansheeEngine
 		virtual void setLoadStoreSurface(UINT32 set, UINT32 slot, const TextureSurface& surface);
 		virtual void setLoadStoreSurface(UINT32 set, UINT32 slot, const TextureSurface& surface);
 
 
 	protected:
 	protected:
-		TGpuParams(const SPtr<GpuPipelineParamInfo>& paramInfo);
+		TGpuParams(const SPtr<GpuPipelineParamInfoBase>& paramInfo);
 
 
 		/** @copydoc CoreObject::getThisPtr */
 		/** @copydoc CoreObject::getThisPtr */
 		virtual SPtr<GpuParamsType> _getThisPtr() const = 0;
 		virtual SPtr<GpuParamsType> _getThisPtr() const = 0;
@@ -239,14 +241,14 @@ namespace BansheeEngine
 		 * @copydoc GpuParams::create 
 		 * @copydoc GpuParams::create 
 		 * @param[in]	deviceMask		Mask that determines on which GPU devices should the buffer be created on.
 		 * @param[in]	deviceMask		Mask that determines on which GPU devices should the buffer be created on.
 		 */
 		 */
-		static SPtr<GpuParamsCore> create(const SPtr<GpuPipelineParamInfo>& paramInfo,
+		static SPtr<GpuParamsCore> create(const SPtr<GpuPipelineParamInfoCore>& paramInfo,
 										  GpuDeviceFlags deviceMask = GDF_DEFAULT);
 										  GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 	protected:
 	protected:
 		friend class GpuParams;
 		friend class GpuParams;
 		friend class HardwareBufferCoreManager;
 		friend class HardwareBufferCoreManager;
 
 
-		GpuParamsCore(const SPtr<GpuPipelineParamInfo>& paramInfo, GpuDeviceFlags deviceMask);
+		GpuParamsCore(const SPtr<GpuPipelineParamInfoCore>& paramInfo, GpuDeviceFlags deviceMask);
 
 
 		/** @copydoc CoreObject::getThisPtr */
 		/** @copydoc CoreObject::getThisPtr */
 		SPtr<GpuParamsCore> _getThisPtr() const override;
 		SPtr<GpuParamsCore> _getThisPtr() const override;

+ 116 - 0
Source/BansheeCore/Include/BsGpuPipelineParamInfo.h

@@ -0,0 +1,116 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsCoreObject.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RenderAPI-Internal
+	 *  @{
+	 */
+
+	/** Helper structure used for initializing GpuPipelineParamInfo. */
+	struct GPU_PIPELINE_PARAMS_DESC
+	{
+		SPtr<GpuParamDesc> fragmentParams;
+		SPtr<GpuParamDesc> vertexParams;
+		SPtr<GpuParamDesc> geometryParams;
+		SPtr<GpuParamDesc> hullParams;
+		SPtr<GpuParamDesc> domainParams;
+		SPtr<GpuParamDesc> computeParams;
+	};
+
+	/** Contains code common to both sim and core thread implementations of GpuPipelineParamInfo. */
+	class BS_CORE_EXPORT GpuPipelineParamInfoBase
+	{
+	public:
+		/** Types of GPU parameters. */
+		enum class ParamType
+		{
+			ParamBlock, Texture, LoadStoreTexture, Buffer, SamplerState, Count
+		};
+
+		/** Constructs the object using the provided GPU parameter descriptors. */
+		GpuPipelineParamInfoBase(const GPU_PIPELINE_PARAMS_DESC& desc);
+		virtual ~GpuPipelineParamInfoBase();
+
+		/** Gets the total number of sets, across all parameter types. */
+		UINT32 getNumSets() const { return mTotalNumSets; }
+
+		/** Returns the number of sets for the specified parameter type. */
+		UINT32 getNumSets(ParamType type) { return mNumSets[(int)type]; }
+
+		/** Returns the number of elements in all sets for the specified parameter type. */
+		UINT32 getNumElements(ParamType type) { return mNumElements[(int)type]; }
+
+		/**
+		* Assuming all elements for a specific parameter type are laid out sequentially and grouped by their sets,
+		* returns the sequential index to the first parameter of the provided set.
+		*/
+		UINT32 getSetOffset(ParamType type, UINT32 set) { return mOffsets[(int)type][set]; }
+
+		/**
+		* Converts a set/slot combination into a sequential index that maps to the parameter in that parameter type's
+		* array.
+		*
+		* If the set or slot is out of valid range, the method logs an error and returns -1. Only performs range checking
+		* in debug mode.
+		*/
+		UINT32 getSequentialSlot(ParamType type, UINT32 set, UINT32 slot) const;
+
+		/** Returns descriptions of individual parameters for the specified GPU program type. */
+		const SPtr<GpuParamDesc>& getParamDesc(GpuProgramType type) const { return mParamDescs[(int)type]; }
+
+	protected:
+		std::array<SPtr<GpuParamDesc>, 6> mParamDescs;
+
+		UINT32 mTotalNumSets;
+		UINT32 mNumSets[(int)ParamType::Count];
+		UINT32 mNumElements[(int)ParamType::Count];
+		UINT32* mOffsets[(int)ParamType::Count];
+
+		UINT8* mData;
+	};
+
+	/** Core thread version of a GpuPipelineParamInfo. */
+	class BS_CORE_EXPORT GpuPipelineParamInfoCore : public CoreObjectCore, public GpuPipelineParamInfoBase
+	{
+	public:
+		virtual ~GpuPipelineParamInfoCore() { }
+
+		/** @copydoc GpuPipelineParamInfo::create */
+		static SPtr<GpuPipelineParamInfoCore> create(const GPU_PIPELINE_PARAMS_DESC& desc);
+
+	protected:
+		friend class RenderStateCoreManager;
+
+		GpuPipelineParamInfoCore(const GPU_PIPELINE_PARAMS_DESC& desc);
+	};
+
+	/** Holds meta-data about a set of GPU parameters used by a single pipeline state. */
+	class BS_CORE_EXPORT GpuPipelineParamInfo : public CoreObject, public GpuPipelineParamInfoBase
+	{
+	public:
+		virtual ~GpuPipelineParamInfo() { }
+
+		/**
+		 * Retrieves a core implementation of this object usable only from the core thread.
+		 *
+		 * @note	Core thread only.
+		 */
+		SPtr<GpuPipelineParamInfoCore> getCore() const;
+
+		/** Constructs the object using the provided GPU parameter descriptors. */
+		static SPtr<GpuPipelineParamInfo> create(const GPU_PIPELINE_PARAMS_DESC& desc);
+
+	private:
+		GpuPipelineParamInfo(const GPU_PIPELINE_PARAMS_DESC& desc);
+
+		/** @copydoc CoreObject::createCore */
+		SPtr<CoreObjectCore> createCore() const override;
+	};
+
+	/** @} */
+}

+ 8 - 73
Source/BansheeCore/Include/BsGpuPipelineState.h

@@ -63,6 +63,7 @@ namespace BansheeEngine
 		typedef SPtr<RasterizerState> RasterizerStateType;
 		typedef SPtr<RasterizerState> RasterizerStateType;
 		typedef SPtr<DepthStencilState> DepthStencilStateType;
 		typedef SPtr<DepthStencilState> DepthStencilStateType;
 		typedef SPtr<GpuProgram> GpuProgramType;
 		typedef SPtr<GpuProgram> GpuProgramType;
+		typedef GpuPipelineParamInfo GpuPipelineParamInfoType;
 		typedef PIPELINE_STATE_DESC StateDescType;
 		typedef PIPELINE_STATE_DESC StateDescType;
 	};
 	};
 
 
@@ -73,6 +74,7 @@ namespace BansheeEngine
 		typedef SPtr<RasterizerStateCore> RasterizerStateType;
 		typedef SPtr<RasterizerStateCore> RasterizerStateType;
 		typedef SPtr<DepthStencilStateCore> DepthStencilStateType;
 		typedef SPtr<DepthStencilStateCore> DepthStencilStateType;
 		typedef SPtr<GpuProgramCore> GpuProgramType;
 		typedef SPtr<GpuProgramCore> GpuProgramType;
+		typedef GpuPipelineParamInfoCore GpuPipelineParamInfoType;
 		typedef PIPELINE_STATE_CORE_DESC StateDescType;
 		typedef PIPELINE_STATE_CORE_DESC StateDescType;
 	};
 	};
 
 
@@ -89,6 +91,7 @@ namespace BansheeEngine
 		typedef typename TGpuPipelineStateTypes<Core>::DepthStencilStateType DepthStencilStateType;
 		typedef typename TGpuPipelineStateTypes<Core>::DepthStencilStateType DepthStencilStateType;
 		typedef typename TGpuPipelineStateTypes<Core>::GpuProgramType GpuProgramType;
 		typedef typename TGpuPipelineStateTypes<Core>::GpuProgramType GpuProgramType;
 		typedef typename TGpuPipelineStateTypes<Core>::StateDescType StateDescType;
 		typedef typename TGpuPipelineStateTypes<Core>::StateDescType StateDescType;
+		typedef typename TGpuPipelineStateTypes<Core>::GpuPipelineParamInfoType GpuPipelineParamInfoType;
 
 
 		virtual ~TGraphicsPipelineState() { }
 		virtual ~TGraphicsPipelineState() { }
 
 
@@ -109,14 +112,14 @@ namespace BansheeEngine
 		const GpuProgramType& getDomainProgram() const { return mData.domainProgram; }
 		const GpuProgramType& getDomainProgram() const { return mData.domainProgram; }
 
 
 		/** Returns an object containing meta-data for parameters of all GPU programs used in this pipeline state. */
 		/** Returns an object containing meta-data for parameters of all GPU programs used in this pipeline state. */
-		const SPtr<GpuPipelineParamInfo>& getParamInfo() const { return mParamInfo; }
+		const SPtr<GpuPipelineParamInfoType>& getParamInfo() const { return mParamInfo; }
 
 
 	protected:
 	protected:
 		TGraphicsPipelineState();
 		TGraphicsPipelineState();
 		TGraphicsPipelineState(const StateDescType& desc);
 		TGraphicsPipelineState(const StateDescType& desc);
 
 
 		StateDescType mData;
 		StateDescType mData;
-		SPtr<GpuPipelineParamInfo> mParamInfo;
+		SPtr<GpuPipelineParamInfoType> mParamInfo;
     };
     };
 
 
 	/** 
 	/** 
@@ -128,20 +131,21 @@ namespace BansheeEngine
     {
     {
     public:
     public:
 		typedef typename TGpuPipelineStateTypes<Core>::GpuProgramType GpuProgramType;
 		typedef typename TGpuPipelineStateTypes<Core>::GpuProgramType GpuProgramType;
+		typedef typename TGpuPipelineStateTypes<Core>::GpuPipelineParamInfoType GpuPipelineParamInfoType;
 
 
 		virtual ~TComputePipelineState() { }
 		virtual ~TComputePipelineState() { }
 
 
 		const GpuProgramType& getProgram() const { return mProgram; }
 		const GpuProgramType& getProgram() const { return mProgram; }
 
 
 		/** Returns an object containing meta-data for parameters of the GPU program used in this pipeline state. */
 		/** Returns an object containing meta-data for parameters of the GPU program used in this pipeline state. */
-		const SPtr<GpuPipelineParamInfo>& getParamInfo() const { return mParamInfo; }
+		const SPtr<GpuPipelineParamInfoType>& getParamInfo() const { return mParamInfo; }
 
 
 	protected:
 	protected:
 		TComputePipelineState();
 		TComputePipelineState();
 		TComputePipelineState(const GpuProgramType& program);
 		TComputePipelineState(const GpuProgramType& program);
 
 
 		GpuProgramType mProgram;
 		GpuProgramType mProgram;
-		SPtr<GpuPipelineParamInfo> mParamInfo;
+		SPtr<GpuPipelineParamInfoType> mParamInfo;
     };
     };
 
 
 	/** @} */
 	/** @} */
@@ -240,74 +244,5 @@ namespace BansheeEngine
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 	};
 	};
 
 
-	/** Helper structure used for initializing GpuPipelineParamInfo. */
-	struct GPU_PIPELINE_PARAMS_DESC
-	{
-		SPtr<GpuParamDesc> fragmentParams;
-		SPtr<GpuParamDesc> vertexParams;
-		SPtr<GpuParamDesc> geometryParams;
-		SPtr<GpuParamDesc> hullParams;
-		SPtr<GpuParamDesc> domainParams;
-		SPtr<GpuParamDesc> computeParams;
-	};
-
-	/** Holds meta-data about a set of GPU parameters used by a single pipeline state. */
-	class BS_CORE_EXPORT GpuPipelineParamInfo
-	{
-	public:
-		/** Types of GPU parameters. */
-		enum class ParamType
-		{
-			ParamBlock, Texture, LoadStoreTexture, Buffer, SamplerState, Count
-		};
-
-		/** Constructs the object using the provided GPU parameter descriptors. */
-		GpuPipelineParamInfo(const GPU_PIPELINE_PARAMS_DESC& desc);
-		~GpuPipelineParamInfo();
-
-		/** Gets the total number of sets, across all parameter types. */
-		UINT32 getNumSets() const { return mTotalNumSets; }
-
-		/** Returns the number of sets for the specified parameter type. */
-		UINT32 getNumSets(ParamType type) { return mNumSets[(int)type]; }
-
-		/** Returns the number of elements in all sets for the specified parameter type. */
-		UINT32 getNumElements(ParamType type) { return mNumElements[(int)type]; }
-
-		/** 
-		 * Assuming all elements for a specific parameter type are laid out sequentially and grouped by their sets, 
-		 * returns the sequential index to the first parameter of the provided set.
-		 */
-		UINT32 getSetOffset(ParamType type, UINT32 set) { return mOffsets[(int)type][set]; }
-
-		/** 
-		 * Converts a set/slot combination into a sequential index that maps to the parameter in that parameter type's 
-		 * array. 
-		 * 
-		 * If the set or slot is out of valid range, the method logs an error and returns -1. Only performs range checking
-		 * in debug mode.
-		 */
-		UINT32 getSequentialSlot(ParamType type, UINT32 set, UINT32 slot) const;
-
-		/** Returns descriptions of individual parameters for the specified GPU program type. */
-		const SPtr<GpuParamDesc>& getParamDesc(GpuProgramType type) const { return mParamDescs[(int)type]; }
-
-		/** Constructs the object using the provided GPU parameter descriptors. */
-		static SPtr<GpuPipelineParamInfo> create(const GPU_PIPELINE_PARAMS_DESC& desc)
-		{
-			return bs_shared_ptr_new<GpuPipelineParamInfo>(desc);
-		}
-
-	private:
-		std::array<SPtr<GpuParamDesc>, 6> mParamDescs;
-
-		UINT32 mTotalNumSets;
-		UINT32 mNumSets[(int)ParamType::Count];
-		UINT32 mNumElements[(int)ParamType::Count];
-		UINT32* mOffsets[(int)ParamType::Count];
-
-		UINT8* mData;
-	};
-
 	/** @} */
 	/** @} */
 }
 }

+ 2 - 2
Source/BansheeCore/Include/BsHardwareBufferManager.h

@@ -132,7 +132,7 @@ namespace BansheeEngine
 		 * @copydoc HardwareBufferManager::createGpuParams 
 		 * @copydoc HardwareBufferManager::createGpuParams 
 		 * @param[in]	deviceMask		Mask that determines on which GPU devices should the object be created on.
 		 * @param[in]	deviceMask		Mask that determines on which GPU devices should the object be created on.
 		 */
 		 */
-		SPtr<GpuParamsCore> createGpuParams(const SPtr<GpuPipelineParamInfo>& paramInfo,
+		SPtr<GpuParamsCore> createGpuParams(const SPtr<GpuPipelineParamInfoCore>& paramInfo,
 											GpuDeviceFlags deviceMask = GDF_DEFAULT);
 											GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 	protected:
 	protected:
@@ -166,7 +166,7 @@ namespace BansheeEngine
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/** @copydoc createGpuParams */
 		/** @copydoc createGpuParams */
-		virtual SPtr<GpuParamsCore> createGpuParamsInternal(const SPtr<GpuPipelineParamInfo>& paramInfo,
+		virtual SPtr<GpuParamsCore> createGpuParamsInternal(const SPtr<GpuPipelineParamInfoCore>& paramInfo,
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 	};
 	};
 
 

+ 2 - 2
Source/BansheeCore/Include/BsParamBlocks.h

@@ -5,7 +5,7 @@
 #include "BsCorePrerequisites.h"
 #include "BsCorePrerequisites.h"
 #include "BsGpuParamDesc.h"
 #include "BsGpuParamDesc.h"
 #include "BsGpuParams.h"
 #include "BsGpuParams.h"
-#include "BsGpuPipelineState.h"
+#include "BsGpuPipelineParamInfo.h"
 #include "BsRenderAPI.h"
 #include "BsRenderAPI.h"
 #include "BsGpuParamBlockBuffer.h"
 #include "BsGpuParamBlockBuffer.h"
 
 
@@ -37,7 +37,7 @@ namespace BansheeEngine
 																															\
 																															\
 			GPU_PIPELINE_PARAMS_DESC pipelineParamDesc;																		\
 			GPU_PIPELINE_PARAMS_DESC pipelineParamDesc;																		\
 			pipelineParamDesc.vertexParams = paramsDesc;																	\
 			pipelineParamDesc.vertexParams = paramsDesc;																	\
-			SPtr<GpuPipelineParamInfo> paramInfo = GpuPipelineParamInfo::create(pipelineParamDesc);							\
+			SPtr<GpuPipelineParamInfoCore> paramInfo = GpuPipelineParamInfoCore::create(pipelineParamDesc);					\
 			mParams = GpuParamsCore::create(paramInfo);																		\
 			mParams = GpuParamsCore::create(paramInfo);																		\
 																															\
 																															\
 			mBuffer = GpuParamBlockBufferCore::create(mBlockDesc.blockSize * sizeof(UINT32));								\
 			mBuffer = GpuParamBlockBufferCore::create(mBlockDesc.blockSize * sizeof(UINT32));								\

+ 7 - 0
Source/BansheeCore/Include/BsRenderStateManager.h

@@ -9,6 +9,7 @@
 #include "BsDepthStencilState.h"
 #include "BsDepthStencilState.h"
 #include "BsSamplerState.h"
 #include "BsSamplerState.h"
 #include "BsGpuPipelineState.h"
 #include "BsGpuPipelineState.h"
+#include "BsGpuPipelineParamInfo.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -162,6 +163,9 @@ namespace BansheeEngine
 		SPtr<ComputePipelineStateCore> createComputePipelineState(const SPtr<GpuProgramCore>& program,
 		SPtr<ComputePipelineStateCore> createComputePipelineState(const SPtr<GpuProgramCore>& program,
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) const;
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) const;
 
 
+		/**	Creates and initializes a new GpuPipelineParamInfoCore. */
+		SPtr<GpuPipelineParamInfoCore> createPipelineParamInfo(const GPU_PIPELINE_PARAMS_DESC& desc) const;
+
 		/** Creates an uninitialized sampler state. Requires manual initialization after creation. */
 		/** Creates an uninitialized sampler state. Requires manual initialization after creation. */
 		SPtr<SamplerStateCore> _createSamplerState(const SAMPLER_STATE_DESC& desc, 
 		SPtr<SamplerStateCore> _createSamplerState(const SAMPLER_STATE_DESC& desc, 
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) const;
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) const;
@@ -183,6 +187,9 @@ namespace BansheeEngine
 		virtual SPtr<ComputePipelineStateCore> _createComputePipelineState(const SPtr<GpuProgramCore>& program,
 		virtual SPtr<ComputePipelineStateCore> _createComputePipelineState(const SPtr<GpuProgramCore>& program,
 																		   GpuDeviceFlags deviceMask = GDF_DEFAULT) const;
 																		   GpuDeviceFlags deviceMask = GDF_DEFAULT) const;
 
 
+		/**	Creates an uninitialized GpuPipelineParamInfoCore. Requires manual initialization after creation. */
+		virtual SPtr<GpuPipelineParamInfoCore> _createPipelineParamInfo(const GPU_PIPELINE_PARAMS_DESC& desc) const;
+
 		/** Gets a sampler state initialized with default options. */
 		/** Gets a sampler state initialized with default options. */
 		const SPtr<SamplerStateCore>& getDefaultSamplerState() const;
 		const SPtr<SamplerStateCore>& getDefaultSamplerState() const;
 
 

+ 8 - 6
Source/BansheeCore/Source/BsGpuParams.cpp

@@ -3,7 +3,7 @@
 #include "BsGpuParams.h"
 #include "BsGpuParams.h"
 #include "BsGpuParamDesc.h"
 #include "BsGpuParamDesc.h"
 #include "BsGpuParamBlockBuffer.h"
 #include "BsGpuParamBlockBuffer.h"
-#include "BsGpuPipelineState.h"
+#include "BsGpuPipelineParamInfo.h"
 #include "BsVector2.h"
 #include "BsVector2.h"
 #include "BsTexture.h"
 #include "BsTexture.h"
 #include "BsGpuBuffer.h"
 #include "BsGpuBuffer.h"
@@ -17,7 +17,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	GpuParamsBase::GpuParamsBase(const SPtr<GpuPipelineParamInfo>& paramInfo)
+	GpuParamsBase::GpuParamsBase(const SPtr<GpuPipelineParamInfoBase>& paramInfo)
 		:mParamInfo(paramInfo)
 		:mParamInfo(paramInfo)
 	{ }
 	{ }
 
 
@@ -135,7 +135,7 @@ namespace BansheeEngine
 	}
 	}
 
 
 	template<bool Core>
 	template<bool Core>
-	TGpuParams<Core>::TGpuParams(const SPtr<GpuPipelineParamInfo>& paramInfo)
+	TGpuParams<Core>::TGpuParams(const SPtr<GpuPipelineParamInfoBase>& paramInfo)
 		: GpuParamsBase(paramInfo)
 		: GpuParamsBase(paramInfo)
 	{
 	{
 		UINT32 numParamBlocks = mParamInfo->getNumElements(GpuPipelineParamInfo::ParamType::ParamBlock);
 		UINT32 numParamBlocks = mParamInfo->getNumElements(GpuPipelineParamInfo::ParamType::ParamBlock);
@@ -543,7 +543,7 @@ namespace BansheeEngine
 	template BS_CORE_EXPORT void TGpuParams<true>::getParam<Matrix4x2>(GpuProgramType type, const String&, TGpuDataParam<Matrix4x2, true>&) const;
 	template BS_CORE_EXPORT void TGpuParams<true>::getParam<Matrix4x2>(GpuProgramType type, const String&, TGpuDataParam<Matrix4x2, true>&) const;
 	template BS_CORE_EXPORT void TGpuParams<true>::getParam<Matrix4x3>(GpuProgramType type, const String&, TGpuDataParam<Matrix4x3, true>&) const;
 	template BS_CORE_EXPORT void TGpuParams<true>::getParam<Matrix4x3>(GpuProgramType type, const String&, TGpuDataParam<Matrix4x3, true>&) const;
 
 
-	GpuParamsCore::GpuParamsCore(const SPtr<GpuPipelineParamInfo>& paramInfo, GpuDeviceFlags deviceMask)
+	GpuParamsCore::GpuParamsCore(const SPtr<GpuPipelineParamInfoCore>& paramInfo, GpuDeviceFlags deviceMask)
 		: TGpuParams(paramInfo)
 		: TGpuParams(paramInfo)
 	{
 	{
 
 
@@ -625,7 +625,7 @@ namespace BansheeEngine
 		}
 		}
 	}
 	}
 
 
-	SPtr<GpuParamsCore> GpuParamsCore::create(const SPtr<GpuPipelineParamInfo>& paramInfo, GpuDeviceFlags deviceMask)
+	SPtr<GpuParamsCore> GpuParamsCore::create(const SPtr<GpuPipelineParamInfoCore>& paramInfo, GpuDeviceFlags deviceMask)
 	{
 	{
 		return HardwareBufferCoreManager::instance().createGpuParams(paramInfo, deviceMask);
 		return HardwareBufferCoreManager::instance().createGpuParams(paramInfo, deviceMask);
 	}
 	}
@@ -650,7 +650,9 @@ namespace BansheeEngine
 
 
 	SPtr<CoreObjectCore> GpuParams::createCore() const
 	SPtr<CoreObjectCore> GpuParams::createCore() const
 	{
 	{
-		return HardwareBufferCoreManager::instance().createGpuParams(mParamInfo);
+		SPtr<GpuPipelineParamInfo> paramInfo = std::static_pointer_cast<GpuPipelineParamInfo>(mParamInfo);
+
+		return HardwareBufferCoreManager::instance().createGpuParams(paramInfo->getCore());
 	}
 	}
 
 
 	void GpuParams::_markCoreDirty()
 	void GpuParams::_markCoreDirty()

+ 225 - 0
Source/BansheeCore/Source/BsGpuPipelineParamInfo.cpp

@@ -0,0 +1,225 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsGpuPipelineParamInfo.h"
+#include "BsGpuParamDesc.h"
+#include "BsRenderStateManager.h"
+
+namespace BansheeEngine
+{
+	GpuPipelineParamInfoBase::GpuPipelineParamInfoBase(const GPU_PIPELINE_PARAMS_DESC& desc)
+		:mTotalNumSets(0)
+	{
+		mParamDescs[GPT_FRAGMENT_PROGRAM] = desc.fragmentParams;
+		mParamDescs[GPT_VERTEX_PROGRAM] = desc.vertexParams;
+		mParamDescs[GPT_GEOMETRY_PROGRAM] = desc.geometryParams;
+		mParamDescs[GPT_HULL_PROGRAM] = desc.hullParams;
+		mParamDescs[GPT_DOMAIN_PROGRAM] = desc.domainParams;
+		mParamDescs[GPT_COMPUTE_PROGRAM] = desc.computeParams;
+
+		for (UINT32 i = 0; i < (UINT32)ParamType::Count; i++)
+		{
+			mNumSets[i] = 0;
+			mNumElements[i] = 0;
+			mOffsets[i] = nullptr;
+		}
+
+		UINT32 numParamDescs = sizeof(mParamDescs) / sizeof(mParamDescs[0]);
+		for (UINT32 i = 0; i < numParamDescs; i++)
+		{
+			const SPtr<GpuParamDesc>& paramDesc = mParamDescs[i];
+			if (paramDesc == nullptr)
+				continue;
+
+			for (auto& paramBlock : paramDesc->paramBlocks)
+			{
+				if ((paramBlock.second.set + 1) > mNumSets[(int)ParamType::ParamBlock])
+					mNumSets[(int)ParamType::ParamBlock] = paramBlock.second.set + 1;
+			}
+
+			for (auto& texture : paramDesc->textures)
+			{
+				if ((texture.second.set + 1) > mNumSets[(int)ParamType::Texture])
+					mNumSets[(int)ParamType::Texture] = texture.second.set + 1;
+			}
+
+			for (auto& texture : paramDesc->loadStoreTextures)
+			{
+				if ((texture.second.set + 1) > mNumSets[(int)ParamType::LoadStoreTexture])
+					mNumSets[(int)ParamType::LoadStoreTexture] = texture.second.set + 1;
+			}
+
+			for (auto& buffer : paramDesc->buffers)
+			{
+				if ((buffer.second.set + 1) > mNumSets[(int)ParamType::Buffer])
+					mNumSets[(int)ParamType::Buffer] = buffer.second.set + 1;
+			}
+
+			for (auto& sampler : paramDesc->samplers)
+			{
+				if ((sampler.second.set + 1) > mNumSets[(int)ParamType::SamplerState])
+					mNumSets[(int)ParamType::SamplerState] = sampler.second.set + 1;
+			}
+		}
+
+		UINT32 totalNumSets = 0;
+		for (UINT32 i = 0; i < (UINT32)ParamType::Count; i++)
+		{
+			totalNumSets += mNumSets[i];
+			mTotalNumSets = std::max(mTotalNumSets, mNumSets[i]);
+		}
+
+		UINT32* slotsPerSetData = bs_stack_alloc<UINT32>(totalNumSets);
+		memset(slotsPerSetData, 0, sizeof(UINT32) * totalNumSets);
+
+		UINT32* slotsPerSet[(UINT32)ParamType::Count];
+		for (UINT32 i = 0; i < (UINT32)ParamType::Count; i++)
+		{
+			if (i == 0)
+				slotsPerSet[i] = slotsPerSetData;
+			else
+				slotsPerSet[i] = slotsPerSet[i - 1] + mNumSets[i - 1];
+		}
+
+		for (UINT32 i = 0; i < numParamDescs; i++)
+		{
+			const SPtr<GpuParamDesc>& paramDesc = mParamDescs[i];
+			if (paramDesc == nullptr)
+				continue;
+
+			for (auto& paramBlock : paramDesc->paramBlocks)
+			{
+				UINT32* slots = slotsPerSet[(int)ParamType::ParamBlock];
+				slots[paramBlock.second.set] = std::max(slots[paramBlock.second.set], paramBlock.second.slot + 1);
+			}
+
+			for (auto& texture : paramDesc->textures)
+			{
+				UINT32* slots = slotsPerSet[(int)ParamType::Texture];
+				slots[texture.second.set] = std::max(slots[texture.second.set], texture.second.slot + 1);
+			}
+
+			for (auto& texture : paramDesc->loadStoreTextures)
+			{
+				UINT32* slots = slotsPerSet[(int)ParamType::LoadStoreTexture];
+				slots[texture.second.set] = std::max(slots[texture.second.set], texture.second.slot + 1);
+			}
+
+			for (auto& buffer : paramDesc->buffers)
+			{
+				UINT32* slots = slotsPerSet[(int)ParamType::Buffer];
+				slots[buffer.second.set] = std::max(slots[buffer.second.set], buffer.second.slot + 1);
+			}
+
+			for (auto& sampler : paramDesc->samplers)
+			{
+				UINT32* slots = slotsPerSet[(int)ParamType::SamplerState];
+				slots[sampler.second.set] = std::max(slots[sampler.second.set], sampler.second.slot + 1);
+			}
+		}
+
+		for (UINT32 i = 0; i < (UINT32)ParamType::Count; i++)
+		{
+			for (UINT32 j = 0; j < mNumSets[i]; j++)
+				mNumElements[i] += slotsPerSet[i][j];
+		}
+
+		UINT32 setOffsetsSize = sizeof(UINT32) * totalNumSets;
+		mData = (UINT8*)bs_alloc(setOffsetsSize);
+
+		UINT8* dataPtr = mData;
+		for (UINT32 i = 0; i < (UINT32)ParamType::Count; i++)
+		{
+			mOffsets[i] = (UINT32*)dataPtr;
+			dataPtr += sizeof(UINT32) * mNumSets[i];
+
+			if (mNumSets[i] == 0)
+				continue;
+
+			mOffsets[i][0] = 0;
+
+			for (UINT32 j = 0; j < mNumSets[i] - 1; j++)
+				mOffsets[i][j + 1] = mOffsets[i][j] + slotsPerSet[i][j];
+		}
+
+		bs_stack_free(slotsPerSetData);
+	}
+
+	GpuPipelineParamInfoBase::~GpuPipelineParamInfoBase()
+	{
+		bs_free(mData);
+	}
+
+	UINT32 GpuPipelineParamInfoBase::getSequentialSlot(ParamType type, UINT32 set, UINT32 slot) const
+	{
+#if BS_DEBUG_MODE
+		if (set >= mNumSets[(int)type])
+		{
+			LOGERR("Set index out of range: Valid range: 0 .. " +
+				   toString(mNumSets[(int)type] - 1) + ". Requested: " + toString(set));
+			return (UINT32)-1;
+		}
+#endif
+
+		UINT32 globalSlot = mOffsets[(int)type][set] + slot;
+
+#if BS_DEBUG_MODE
+		if (globalSlot >= mNumElements[(int)type])
+		{
+			UINT32 maxSlot;
+			if (set < (mNumSets[(int)type] - 1))
+				maxSlot = mOffsets[(int)type][set + 1];
+			else
+				maxSlot = mNumElements[(int)type];
+
+			maxSlot -= mOffsets[(int)type][set];
+
+			LOGERR("Slot index out of range: Valid range: 0 .. " +
+				   toString(maxSlot - 1) + ". Requested: " + toString(slot));
+			return (UINT32)-1;
+		}
+#endif
+
+		return globalSlot;
+	}
+
+	GpuPipelineParamInfoCore::GpuPipelineParamInfoCore(const GPU_PIPELINE_PARAMS_DESC& desc)
+		:GpuPipelineParamInfoBase(desc)
+	{ }
+
+	SPtr<GpuPipelineParamInfoCore> GpuPipelineParamInfoCore::create(const GPU_PIPELINE_PARAMS_DESC& desc)
+	{
+		return RenderStateCoreManager::instance().createPipelineParamInfo(desc);
+	}
+
+	GpuPipelineParamInfo::GpuPipelineParamInfo(const GPU_PIPELINE_PARAMS_DESC& desc)
+		:GpuPipelineParamInfoBase(desc)
+	{ }
+
+	SPtr<GpuPipelineParamInfo> GpuPipelineParamInfo::create(const GPU_PIPELINE_PARAMS_DESC& desc)
+	{
+		SPtr<GpuPipelineParamInfo> paramInfo = 
+			bs_core_ptr<GpuPipelineParamInfo>(new (bs_alloc<GpuPipelineParamInfo>()) GpuPipelineParamInfo(desc));
+		paramInfo->_setThisPtr(paramInfo);
+		paramInfo->initialize();
+
+		return paramInfo;
+	}
+
+	SPtr<GpuPipelineParamInfoCore> GpuPipelineParamInfo::getCore() const
+	{
+		return std::static_pointer_cast<GpuPipelineParamInfoCore>(mCoreSpecific);
+	}
+
+	SPtr<CoreObjectCore> GpuPipelineParamInfo::createCore() const
+	{
+		GPU_PIPELINE_PARAMS_DESC desc;
+		desc.fragmentParams = mParamDescs[GPT_FRAGMENT_PROGRAM];
+		desc.vertexParams = mParamDescs[GPT_VERTEX_PROGRAM];
+		desc.geometryParams = mParamDescs[GPT_GEOMETRY_PROGRAM];
+		desc.hullParams = mParamDescs[GPT_HULL_PROGRAM];
+		desc.domainParams = mParamDescs[GPT_DOMAIN_PROGRAM];
+		desc.computeParams = mParamDescs[GPT_COMPUTE_PROGRAM];
+
+		return RenderStateCoreManager::instance()._createPipelineParamInfo(desc);
+	}
+}

+ 3 - 178
Source/BansheeCore/Source/BsGpuPipelineState.cpp

@@ -6,6 +6,7 @@
 #include "BsDepthStencilState.h"
 #include "BsDepthStencilState.h"
 #include "BsGpuProgram.h"
 #include "BsGpuProgram.h"
 #include "BsGpuParamDesc.h"
 #include "BsGpuParamDesc.h"
+#include "BsGpuPipelineParamInfo.h"
 #include "BsRenderStateManager.h"
 #include "BsRenderStateManager.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
@@ -58,7 +59,7 @@ namespace BansheeEngine
 		if (data.domainProgram != nullptr)
 		if (data.domainProgram != nullptr)
 			paramsDesc.domainParams = getParamDesc(data.domainProgram);
 			paramsDesc.domainParams = getParamDesc(data.domainProgram);
 
 
-		mParamInfo = GpuPipelineParamInfo::create(paramsDesc);
+		mParamInfo = GpuPipelineParamInfoType::create(paramsDesc);
 	}
 	}
 
 
 	template class TGraphicsPipelineState < false > ;
 	template class TGraphicsPipelineState < false > ;
@@ -106,7 +107,7 @@ namespace BansheeEngine
 		GPU_PIPELINE_PARAMS_DESC paramsDesc;
 		GPU_PIPELINE_PARAMS_DESC paramsDesc;
 		paramsDesc.computeParams = getParamDesc(program);
 		paramsDesc.computeParams = getParamDesc(program);
 
 
-		mParamInfo = GpuPipelineParamInfo::create(paramsDesc);
+		mParamInfo = GpuPipelineParamInfoType::create(paramsDesc);
 	}
 	}
 
 
 	template class TComputePipelineState < false >;
 	template class TComputePipelineState < false >;
@@ -140,180 +141,4 @@ namespace BansheeEngine
 	{
 	{
 		return RenderStateManager::instance().createComputePipelineState(program);
 		return RenderStateManager::instance().createComputePipelineState(program);
 	}
 	}
-
-	GpuPipelineParamInfo::GpuPipelineParamInfo(const GPU_PIPELINE_PARAMS_DESC& desc)
-		:mTotalNumSets(0)
-	{
-		mParamDescs[GPT_FRAGMENT_PROGRAM] = desc.fragmentParams;
-		mParamDescs[GPT_VERTEX_PROGRAM] = desc.vertexParams;
-		mParamDescs[GPT_GEOMETRY_PROGRAM] = desc.geometryParams;
-		mParamDescs[GPT_HULL_PROGRAM] = desc.hullParams;
-		mParamDescs[GPT_DOMAIN_PROGRAM] = desc.domainParams;
-		mParamDescs[GPT_COMPUTE_PROGRAM] = desc.computeParams;
-
-		for (UINT32 i = 0; i < (UINT32)ParamType::Count; i++)
-		{
-			mNumSets[i] = 0;
-			mNumElements[i] = 0;
-			mOffsets[i] = nullptr;
-		}
-
-		UINT32 numParamDescs = sizeof(mParamDescs) / sizeof(mParamDescs[0]);
-		for (UINT32 i = 0; i < numParamDescs; i++)
-		{
-			const SPtr<GpuParamDesc>& paramDesc = mParamDescs[i];
-			if (paramDesc == nullptr)
-				continue;
-
-			for (auto& paramBlock : paramDesc->paramBlocks)
-			{
-				if ((paramBlock.second.set + 1) > mNumSets[(int)ParamType::ParamBlock])
-					mNumSets[(int)ParamType::ParamBlock] = paramBlock.second.set + 1;
-			}
-
-			for (auto& texture : paramDesc->textures)
-			{
-				if ((texture.second.set + 1) > mNumSets[(int)ParamType::Texture])
-					mNumSets[(int)ParamType::Texture] = texture.second.set + 1;
-			}
-
-			for (auto& texture : paramDesc->loadStoreTextures)
-			{
-				if ((texture.second.set + 1) > mNumSets[(int)ParamType::LoadStoreTexture])
-					mNumSets[(int)ParamType::LoadStoreTexture] = texture.second.set + 1;
-			}
-
-			for (auto& buffer : paramDesc->buffers)
-			{
-				if ((buffer.second.set + 1) > mNumSets[(int)ParamType::Buffer])
-					mNumSets[(int)ParamType::Buffer] = buffer.second.set + 1;
-			}
-
-			for (auto& sampler : paramDesc->samplers)
-			{
-				if ((sampler.second.set + 1) > mNumSets[(int)ParamType::SamplerState])
-					mNumSets[(int)ParamType::SamplerState] = sampler.second.set + 1;
-			}
-		}
-
-		UINT32 totalNumSets = 0;
-		for (UINT32 i = 0; i < (UINT32)ParamType::Count; i++)
-		{
-			totalNumSets += mNumSets[i];
-			mTotalNumSets = std::max(mTotalNumSets, mNumSets[i]);
-		}
-
-		UINT32* slotsPerSetData = bs_stack_alloc<UINT32>(totalNumSets);
-		memset(slotsPerSetData, 0, sizeof(UINT32) * totalNumSets);
-
-		UINT32* slotsPerSet[(UINT32)ParamType::Count];
-		for (UINT32 i = 0; i < (UINT32)ParamType::Count; i++)
-		{
-			if (i == 0)
-				slotsPerSet[i] = slotsPerSetData;
-			else
-				slotsPerSet[i] = slotsPerSet[i - 1] + mNumSets[i - 1];
-		}
-
-		for (UINT32 i = 0; i < numParamDescs; i++)
-		{
-			const SPtr<GpuParamDesc>& paramDesc = mParamDescs[i];
-			if (paramDesc == nullptr)
-				continue;
-
-			for (auto& paramBlock : paramDesc->paramBlocks)
-			{
-				UINT32* slots = slotsPerSet[(int)ParamType::ParamBlock];
-				slots[paramBlock.second.set] = std::max(slots[paramBlock.second.set], paramBlock.second.slot + 1);
-			}
-
-			for (auto& texture : paramDesc->textures)
-			{
-				UINT32* slots = slotsPerSet[(int)ParamType::Texture];
-				slots[texture.second.set] = std::max(slots[texture.second.set], texture.second.slot + 1);
-			}
-
-			for (auto& texture : paramDesc->loadStoreTextures)
-			{
-				UINT32* slots = slotsPerSet[(int)ParamType::LoadStoreTexture];
-				slots[texture.second.set] = std::max(slots[texture.second.set], texture.second.slot + 1);
-			}
-
-			for (auto& buffer : paramDesc->buffers)
-			{
-				UINT32* slots = slotsPerSet[(int)ParamType::Buffer];
-				slots[buffer.second.set] = std::max(slots[buffer.second.set], buffer.second.slot + 1);
-			}
-
-			for (auto& sampler : paramDesc->samplers)
-			{
-				UINT32* slots = slotsPerSet[(int)ParamType::SamplerState];
-				slots[sampler.second.set] = std::max(slots[sampler.second.set], sampler.second.slot + 1);
-			}
-		}
-
-		for (UINT32 i = 0; i < (UINT32)ParamType::Count; i++)
-		{
-			for (UINT32 j = 0; j < mNumSets[i]; j++)
-				mNumElements[i] += slotsPerSet[i][j];
-		}
-
-		UINT32 setOffsetsSize = sizeof(UINT32) * totalNumSets;
-		mData = (UINT8*)bs_alloc(setOffsetsSize);
-
-		UINT8* dataPtr = mData;
-		for (UINT32 i = 0; i < (UINT32)ParamType::Count; i++)
-		{
-			mOffsets[i] = (UINT32*)dataPtr;
-			dataPtr += sizeof(UINT32) * mNumSets[i];
-
-			if (mNumSets[i] == 0)
-				continue;
-
-			mOffsets[i][0] = 0;
-
-			for (UINT32 j = 0; j < mNumSets[i] - 1; j++)
-				mOffsets[i][j + 1] = mOffsets[i][j] + slotsPerSet[i][j];
-		}
-
-		bs_stack_free(slotsPerSetData);
-	}
-
-	GpuPipelineParamInfo::~GpuPipelineParamInfo()
-	{
-		bs_free(mData);
-	}
-
-	UINT32 GpuPipelineParamInfo::getSequentialSlot(ParamType type, UINT32 set, UINT32 slot) const
-	{
-#if BS_DEBUG_MODE
-		if (set >= mNumSets[(int)type])
-		{
-			LOGERR("Set index out of range: Valid range: 0 .. " +
-				   toString(mNumSets[(int)type] - 1) + ". Requested: " + toString(set));
-			return (UINT32)-1;
-		}
-#endif
-
-		UINT32 globalSlot = mOffsets[(int)type][set] + slot;
-
-#if BS_DEBUG_MODE
-		if (globalSlot >= mNumElements[(int)type])
-		{
-			UINT32 maxSlot;
-			if (set < (mNumSets[(int)type] - 1))
-				maxSlot = mOffsets[(int)type][set + 1];
-			else
-				maxSlot = mNumElements[(int)type];
-
-			maxSlot -= mOffsets[(int)type][set];
-
-			LOGERR("Slot index out of range: Valid range: 0 .. " +
-				   toString(maxSlot - 1) + ". Requested: " + toString(slot));
-			return (UINT32)-1;
-		}
-#endif
-
-		return globalSlot;
-	}
 }
 }

+ 2 - 2
Source/BansheeCore/Source/BsHardwareBufferManager.cpp

@@ -99,7 +99,7 @@ namespace BansheeEngine
 		return declPtr;
 		return declPtr;
 	}
 	}
 
 
-	SPtr<GpuParamsCore> HardwareBufferCoreManager::createGpuParams(const SPtr<GpuPipelineParamInfo>& paramInfo,
+	SPtr<GpuParamsCore> HardwareBufferCoreManager::createGpuParams(const SPtr<GpuPipelineParamInfoCore>& paramInfo,
 		GpuDeviceFlags deviceMask)
 		GpuDeviceFlags deviceMask)
     {
     {
 		SPtr<GpuParamsCore> params = createGpuParamsInternal(paramInfo, deviceMask);
 		SPtr<GpuParamsCore> params = createGpuParamsInternal(paramInfo, deviceMask);
@@ -146,7 +146,7 @@ namespace BansheeEngine
 		return ret;
 		return ret;
 	}
 	}
 
 
-	SPtr<GpuParamsCore> HardwareBufferCoreManager::createGpuParamsInternal(const SPtr<GpuPipelineParamInfo>& paramInfo,
+	SPtr<GpuParamsCore> HardwareBufferCoreManager::createGpuParamsInternal(const SPtr<GpuPipelineParamInfoCore>& paramInfo,
 		GpuDeviceFlags deviceMask)
 		GpuDeviceFlags deviceMask)
     {
     {
 		GpuParamsCore* params = new (bs_alloc<GpuParamsCore>()) GpuParamsCore(paramInfo, deviceMask);
 		GpuParamsCore* params = new (bs_alloc<GpuParamsCore>()) GpuParamsCore(paramInfo, deviceMask);

+ 21 - 0
Source/BansheeCore/Source/BsRenderStateManager.cpp

@@ -231,6 +231,15 @@ namespace BansheeEngine
 		return state;
 		return state;
 	}
 	}
 
 
+	SPtr<GpuPipelineParamInfoCore> RenderStateCoreManager::createPipelineParamInfo(
+		const GPU_PIPELINE_PARAMS_DESC& desc) const
+	{
+		SPtr<GpuPipelineParamInfoCore> paramInfo = _createPipelineParamInfo(desc);
+		paramInfo->initialize();
+
+		return paramInfo;
+	}
+
 	SPtr<SamplerStateCore> RenderStateCoreManager::_createSamplerState(const SAMPLER_STATE_DESC& desc, 
 	SPtr<SamplerStateCore> RenderStateCoreManager::_createSamplerState(const SAMPLER_STATE_DESC& desc, 
 		GpuDeviceFlags deviceMask) const
 		GpuDeviceFlags deviceMask) const
 	{
 	{
@@ -320,6 +329,18 @@ namespace BansheeEngine
 		return pipelineState;
 		return pipelineState;
 	}
 	}
 
 
+	SPtr<GpuPipelineParamInfoCore> RenderStateCoreManager::_createPipelineParamInfo(
+		const GPU_PIPELINE_PARAMS_DESC& desc) const
+	{
+		SPtr<GpuPipelineParamInfoCore> paramInfo =
+			bs_shared_ptr<GpuPipelineParamInfoCore>(new (bs_alloc<GpuPipelineParamInfoCore>())
+													GpuPipelineParamInfoCore(desc));
+
+		paramInfo->_setThisPtr(paramInfo);
+
+		return paramInfo;
+	}
+
 	void RenderStateCoreManager::onShutDown()
 	void RenderStateCoreManager::onShutDown()
 	{
 	{
 		mDefaultBlendState = nullptr;
 		mDefaultBlendState = nullptr;

+ 1 - 1
Source/BansheeVulkanRenderAPI/Include/BsVulkanGpuParams.h

@@ -76,7 +76,7 @@ namespace BansheeEngine
 
 
 		friend class VulkanHardwareBufferCoreManager;
 		friend class VulkanHardwareBufferCoreManager;
 
 
-		VulkanGpuParams(const SPtr<GpuPipelineParamInfo>& paramInfo, GpuDeviceFlags deviceMask);
+		VulkanGpuParams(const SPtr<GpuPipelineParamInfoCore>& paramInfo, GpuDeviceFlags deviceMask);
 
 
 		PerDeviceData mPerDeviceData[BS_MAX_DEVICES];
 		PerDeviceData mPerDeviceData[BS_MAX_DEVICES];
 		GpuDeviceFlags mDeviceMask;
 		GpuDeviceFlags mDeviceMask;

+ 25 - 0
Source/BansheeVulkanRenderAPI/Include/BsVulkanGpuPipelineParamInfo.h

@@ -0,0 +1,25 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsVulkanPrerequisites.h"
+#include "BsGpuPipelineParamInfo.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Vulkan
+	 *  @{
+	 */
+
+	/** Holds meta-data about a set of GPU parameters used by a single pipeline state. */
+	class VulkanGpuPipelineParamInfo : public GpuPipelineParamInfoCore
+	{
+	public:
+		VulkanGpuPipelineParamInfo(const GPU_PIPELINE_PARAMS_DESC& desc);
+		~VulkanGpuPipelineParamInfo();
+
+	private:
+	};
+
+	/** @} */
+}

+ 16 - 1
Source/BansheeVulkanRenderAPI/Include/BsVulkanGpuPipelineState.h

@@ -26,7 +26,7 @@ namespace BansheeEngine
 		VkPipeline mPipeline;
 		VkPipeline mPipeline;
 	};
 	};
 
 
-	/**	Vulkan implementation of a GPU pipeline state. */
+	/**	Vulkan implementation of a graphics pipeline state. */
 	class VulkanGraphicsPipelineStateCore : public GraphicsPipelineStateCore
 	class VulkanGraphicsPipelineStateCore : public GraphicsPipelineStateCore
 	{
 	{
 	public:
 	public:
@@ -69,5 +69,20 @@ namespace BansheeEngine
 		VkGraphicsPipelineCreateInfo mPipelineInfo;
 		VkGraphicsPipelineCreateInfo mPipelineInfo;
 	};
 	};
 
 
+	/**	Vulkan implementation of a compute pipeline state. */
+	class VulkanComputePipelineStateCore : public ComputePipelineStateCore
+	{
+	public:
+		~VulkanComputePipelineStateCore();
+
+	protected:
+		friend class VulkanRenderStateCoreManager;
+
+		VulkanComputePipelineStateCore(const SPtr<GpuProgramCore>& program, GpuDeviceFlags deviceMask);
+
+		/**	@copydoc ComputePipelineStateCore::initialize */
+		void initialize() override;
+	};
+
 	/** @} */
 	/** @} */
 }
 }

+ 1 - 1
Source/BansheeVulkanRenderAPI/Include/BsVulkanHardwareBufferManager.h

@@ -35,7 +35,7 @@ namespace BansheeEngine
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) override;
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) override;
 
 
 		/** @copydoc HardwareBufferCoreManager::createGpuParamsInternal */
 		/** @copydoc HardwareBufferCoreManager::createGpuParamsInternal */
-		SPtr<GpuParamsCore> createGpuParamsInternal(const SPtr<GpuPipelineParamInfo>& paramInfo,
+		SPtr<GpuParamsCore> createGpuParamsInternal(const SPtr<GpuPipelineParamInfoCore>& paramInfo,
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) override;
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) override;
 	};
 	};
 
 

+ 7 - 0
Source/BansheeVulkanRenderAPI/Include/BsVulkanRenderStateManager.h

@@ -22,6 +22,13 @@ namespace BansheeEngine
 		/** @copydoc RenderStateCoreManager::_createGraphicsPipelineState */
 		/** @copydoc RenderStateCoreManager::_createGraphicsPipelineState */
 		SPtr<GraphicsPipelineStateCore> _createGraphicsPipelineState(const PIPELINE_STATE_CORE_DESC& desc,
 		SPtr<GraphicsPipelineStateCore> _createGraphicsPipelineState(const PIPELINE_STATE_CORE_DESC& desc,
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) const override;
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) const override;
+
+		/** @copydoc RenderStateCoreManager::_createComputePipelineState */
+		SPtr<ComputePipelineStateCore> _createComputePipelineState(const SPtr<GpuProgramCore>& program,
+			GpuDeviceFlags deviceMask = GDF_DEFAULT) const override;
+
+		/** @copydoc RenderStateCoreManager::_createPipelineParamInfo */
+		SPtr<GpuPipelineParamInfoCore> _createPipelineParamInfo(const GPU_PIPELINE_PARAMS_DESC& desc) const override;
 	};
 	};
 
 
 	/** @} */
 	/** @} */

+ 1 - 1
Source/BansheeVulkanRenderAPI/Source/BsVulkanGpuParams.cpp

@@ -17,7 +17,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	VulkanGpuParams::VulkanGpuParams(const SPtr<GpuPipelineParamInfo>& paramInfo, GpuDeviceFlags deviceMask)
+	VulkanGpuParams::VulkanGpuParams(const SPtr<GpuPipelineParamInfoCore>& paramInfo, GpuDeviceFlags deviceMask)
 		: GpuParamsCore(paramInfo, deviceMask), mPerDeviceData(), mDeviceMask(deviceMask), mData(nullptr), mSetsDirty(nullptr)
 		: GpuParamsCore(paramInfo, deviceMask), mPerDeviceData(), mDeviceMask(deviceMask), mData(nullptr), mSetsDirty(nullptr)
 	{
 	{
 		// Generate all required bindings
 		// Generate all required bindings

+ 17 - 0
Source/BansheeVulkanRenderAPI/Source/BsVulkanGpuPipelineParamInfo.cpp

@@ -0,0 +1,17 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsVulkanGpuPipelineParamInfo.h"
+
+namespace BansheeEngine
+{
+	VulkanGpuPipelineParamInfo::VulkanGpuPipelineParamInfo(const GPU_PIPELINE_PARAMS_DESC& desc)
+		:GpuPipelineParamInfoCore(desc)
+	{
+		// TODO - Will get called from main thread!
+	}
+
+	VulkanGpuPipelineParamInfo::~VulkanGpuPipelineParamInfo()
+	{
+		
+	}
+}

+ 15 - 0
Source/BansheeVulkanRenderAPI/Source/BsVulkanGpuPipelineState.cpp

@@ -274,4 +274,19 @@ namespace BansheeEngine
 
 
 		return pipeline;
 		return pipeline;
 	}
 	}
+
+	VulkanComputePipelineStateCore::VulkanComputePipelineStateCore(const SPtr<GpuProgramCore>& program, 
+		GpuDeviceFlags deviceMask)
+		:ComputePipelineStateCore(program, deviceMask)
+	{ }
+
+	VulkanComputePipelineStateCore::~VulkanComputePipelineStateCore()
+	{
+
+	}
+
+	void VulkanComputePipelineStateCore::initialize()
+	{
+		// TODO
+	}
 }
 }

+ 1 - 1
Source/BansheeVulkanRenderAPI/Source/BsVulkanHardwareBufferManager.cpp

@@ -55,7 +55,7 @@ namespace BansheeEngine
 	}
 	}
 
 
 	SPtr<GpuParamsCore> VulkanHardwareBufferCoreManager::createGpuParamsInternal(
 	SPtr<GpuParamsCore> VulkanHardwareBufferCoreManager::createGpuParamsInternal(
-		const SPtr<GpuPipelineParamInfo>& paramInfo, GpuDeviceFlags deviceMask)
+		const SPtr<GpuPipelineParamInfoCore>& paramInfo, GpuDeviceFlags deviceMask)
 	{
 	{
 		VulkanGpuParams* params = new (bs_alloc<VulkanGpuParams>()) VulkanGpuParams(paramInfo, deviceMask);
 		VulkanGpuParams* params = new (bs_alloc<VulkanGpuParams>()) VulkanGpuParams(paramInfo, deviceMask);
 		SPtr<GpuParamsCore> paramsPtr = bs_shared_ptr<GpuParamsCore>(params);
 		SPtr<GpuParamsCore> paramsPtr = bs_shared_ptr<GpuParamsCore>(params);

+ 23 - 0
Source/BansheeVulkanRenderAPI/Source/BsVulkanRenderStateManager.cpp

@@ -2,6 +2,7 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsVulkanRenderStateManager.h"
 #include "BsVulkanRenderStateManager.h"
 #include "BsVulkanGpuPipelineState.h"
 #include "BsVulkanGpuPipelineState.h"
+#include "BsVulkanGpuPipelineParamInfo.h"
 #include "BsVulkanSamplerState.h"
 #include "BsVulkanSamplerState.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
@@ -26,4 +27,26 @@ namespace BansheeEngine
 
 
 		return pipelineState;
 		return pipelineState;
 	}
 	}
+
+	SPtr<ComputePipelineStateCore> VulkanRenderStateCoreManager::_createComputePipelineState(
+		const SPtr<GpuProgramCore>& program, GpuDeviceFlags deviceMask) const
+	{
+		SPtr<VulkanComputePipelineStateCore> pipelineState =
+			bs_shared_ptr<VulkanComputePipelineStateCore>(new (bs_alloc<VulkanComputePipelineStateCore>())
+														  VulkanComputePipelineStateCore(program, deviceMask));
+		pipelineState->_setThisPtr(pipelineState);
+
+		return pipelineState;
+	}
+
+	SPtr<GpuPipelineParamInfoCore> VulkanRenderStateCoreManager::_createPipelineParamInfo(
+		const GPU_PIPELINE_PARAMS_DESC& desc) const
+	{
+		SPtr<VulkanGpuPipelineParamInfo> paramInfo =
+			bs_shared_ptr<VulkanGpuPipelineParamInfo>(new (bs_alloc<VulkanGpuPipelineParamInfo>())
+													  VulkanGpuPipelineParamInfo(desc));
+		paramInfo->_setThisPtr(paramInfo);
+
+		return paramInfo;
+	}
 }
 }