Преглед изворни кода

Added multi-GPU constructors for GpuPipeline, RenderTexture, Mesh and MeshHeap

BearishSun пре 9 година
родитељ
комит
a6abddedc3

+ 3 - 2
Source/BansheeCore/Include/BsGpuPipelineState.h

@@ -160,11 +160,12 @@ namespace BansheeEngine
 	class BS_CORE_EXPORT GpuPipelineStateCore : public CoreObjectCore, public TGpuPipelineState<true>
 	class BS_CORE_EXPORT GpuPipelineStateCore : public CoreObjectCore, public TGpuPipelineState<true>
 	{
 	{
 	public:
 	public:
-		GpuPipelineStateCore(const PIPELINE_STATE_CORE_DESC& desc);
+		GpuPipelineStateCore(const PIPELINE_STATE_CORE_DESC& desc, GpuDeviceFlags deviceMask);
 		virtual ~GpuPipelineStateCore() { }
 		virtual ~GpuPipelineStateCore() { }
 
 
 		/** @copydoc RenderStateManager::createPipelineState */
 		/** @copydoc RenderStateManager::createPipelineState */
-		static SPtr<GpuPipelineStateCore> create(const PIPELINE_STATE_CORE_DESC& desc);
+		static SPtr<GpuPipelineStateCore> create(const PIPELINE_STATE_CORE_DESC& desc, 
+			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 	};
 	};
 
 
 	/** @} */
 	/** @} */

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

@@ -81,46 +81,46 @@ namespace BansheeEngine
 
 
 		/** 
 		/** 
 		 * @copydoc HardwareBufferManager::createVertexBuffer 
 		 * @copydoc HardwareBufferManager::createVertexBuffer 
-		 * @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 object be created on.
 		 */
 		 */
 		SPtr<VertexBufferCore> createVertexBuffer(const VERTEX_BUFFER_DESC& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 		SPtr<VertexBufferCore> createVertexBuffer(const VERTEX_BUFFER_DESC& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/** 
 		/** 
 		 * @copydoc HardwareBufferManager::createIndexBuffer 
 		 * @copydoc HardwareBufferManager::createIndexBuffer 
-		 * @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 object be created on.
 		 */
 		 */
 		SPtr<IndexBufferCore> createIndexBuffer(const INDEX_BUFFER_DESC& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 		SPtr<IndexBufferCore> createIndexBuffer(const INDEX_BUFFER_DESC& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/** 
 		/** 
 		 * @copydoc HardwareBufferManager::createVertexDeclaration 
 		 * @copydoc HardwareBufferManager::createVertexDeclaration 
-		 * @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 object be created on.
 		 */
 		 */
 		SPtr<VertexDeclarationCore> createVertexDeclaration(const SPtr<VertexDataDesc>& desc,
 		SPtr<VertexDeclarationCore> createVertexDeclaration(const SPtr<VertexDataDesc>& desc,
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/** 
 		/** 
 		 * @copydoc HardwareBufferManager::createVertexDeclaration 
 		 * @copydoc HardwareBufferManager::createVertexDeclaration 
-		 * @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 object be created on.
 		 */
 		 */
 		SPtr<VertexDeclarationCore> createVertexDeclaration(const List<VertexElement>& elements, 
 		SPtr<VertexDeclarationCore> createVertexDeclaration(const List<VertexElement>& elements, 
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/** 
 		/** 
 		 * @copydoc HardwareBufferManager::createGpuParamBlockBuffer 
 		 * @copydoc HardwareBufferManager::createGpuParamBlockBuffer 
-		 * @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 object be created on.
 		 */
 		 */
 		SPtr<GpuParamBlockBufferCore> createGpuParamBlockBuffer(UINT32 size, 
 		SPtr<GpuParamBlockBufferCore> createGpuParamBlockBuffer(UINT32 size, 
 			GpuParamBlockUsage usage = GPBU_DYNAMIC, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 			GpuParamBlockUsage usage = GPBU_DYNAMIC, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/** 
 		/** 
 		 * @copydoc HardwareBufferManager::createGpuBuffer
 		 * @copydoc HardwareBufferManager::createGpuBuffer
-		 * @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 object be created on.
 		 */
 		 */
 		SPtr<GpuBufferCore> createGpuBuffer(const GPU_BUFFER_DESC& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 		SPtr<GpuBufferCore> createGpuBuffer(const GPU_BUFFER_DESC& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/** 
 		/** 
 		 * @copydoc HardwareBufferManager::createGpuParams 
 		 * @copydoc HardwareBufferManager::createGpuParams 
-		 * @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 object be created on.
 		 */
 		 */
 		SPtr<GpuParamsCore> createGpuParams(const GPU_PARAMS_DESC& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 		SPtr<GpuParamsCore> createGpuParams(const GPU_PARAMS_DESC& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 

+ 13 - 6
Source/BansheeCore/Include/BsMesh.h

@@ -283,7 +283,7 @@ namespace BansheeEngine
 	class BS_CORE_EXPORT MeshCore : public MeshCoreBase
 	class BS_CORE_EXPORT MeshCore : public MeshCoreBase
 	{
 	{
 	public:
 	public:
-		MeshCore(const SPtr<MeshData>& initialMeshData, const MESH_DESC& desc);
+		MeshCore(const SPtr<MeshData>& initialMeshData, const MESH_DESC& desc, GpuDeviceFlags deviceMask);
 
 
 		~MeshCore();
 		~MeshCore();
 
 
@@ -342,16 +342,19 @@ namespace BansheeEngine
 		 *								option is a triangle list, where three indices represent a single triangle.
 		 *								option is a triangle list, where three indices represent a single triangle.
 		 * @param[in]	indexType		Size of indices, use smaller size for better performance, however be careful not to
 		 * @param[in]	indexType		Size of indices, use smaller size for better performance, however be careful not to
 		 *								go over the number of vertices limited by the size.
 		 *								go over the number of vertices limited by the size.
+		 * @param[in]	deviceMask		Mask that determines on which GPU devices should the object be created on.
 		 */
 		 */
 		static SPtr<MeshCore> create(UINT32 numVertices, UINT32 numIndices, const SPtr<VertexDataDesc>& vertexDesc, 
 		static SPtr<MeshCore> create(UINT32 numVertices, UINT32 numIndices, const SPtr<VertexDataDesc>& vertexDesc, 
-			int usage = MU_STATIC, DrawOperationType drawOp = DOT_TRIANGLE_LIST, IndexType indexType = IT_32BIT);
+			int usage = MU_STATIC, DrawOperationType drawOp = DOT_TRIANGLE_LIST, IndexType indexType = IT_32BIT, 
+			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/**
 		/**
 		 * Creates a new empty mesh. 
 		 * Creates a new empty mesh. 
 		 *
 		 *
-		 * @param[in]	desc	Descriptor containing the properties of the mesh to create.
+		 * @param[in]	desc			Descriptor containing the properties of the mesh to create.
+		 * @param[in]	deviceMask		Mask that determines on which GPU devices should the object be created on.
 		 */
 		 */
-		static SPtr<MeshCore> create(const MESH_DESC& desc);
+		static SPtr<MeshCore> create(const MESH_DESC& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/**
 		/**
 		 * Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described
 		 * Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described
@@ -361,8 +364,10 @@ namespace BansheeEngine
 		 * @param[in]	desc			Descriptor containing the properties of the mesh to create. Vertex and index count,
 		 * @param[in]	desc			Descriptor containing the properties of the mesh to create. Vertex and index count,
 		 *								vertex descriptor and index type properties are ignored and are read from provided
 		 *								vertex descriptor and index type properties are ignored and are read from provided
 		 *								mesh data instead.
 		 *								mesh data instead.
+		 * @param[in]	deviceMask		Mask that determines on which GPU devices should the object be created on.
 		 */
 		 */
-		static SPtr<MeshCore> create(const SPtr<MeshData>& initialData, const MESH_DESC& desc);
+		static SPtr<MeshCore> create(const SPtr<MeshData>& initialData, const MESH_DESC& desc, 
+			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/**
 		/**
 		 * Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described
 		 * Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described
@@ -372,9 +377,10 @@ namespace BansheeEngine
 		 * @param[in]	usage			Optimizes performance depending on planned usage of the mesh.
 		 * @param[in]	usage			Optimizes performance depending on planned usage of the mesh.
 		 * @param[in]	drawOp			Determines how should the provided indices be interpreted by the pipeline. Default 
 		 * @param[in]	drawOp			Determines how should the provided indices be interpreted by the pipeline. Default 
 		 *								option is a triangle strip, where three indices represent a single triangle.
 		 *								option is a triangle strip, where three indices represent a single triangle.
+		 * @param[in]	deviceMask		Mask that determines on which GPU devices should the object be created on.
 		 */
 		 */
 		static SPtr<MeshCore> create(const SPtr<MeshData>& initialData, int usage = MU_STATIC,
 		static SPtr<MeshCore> create(const SPtr<MeshData>& initialData, int usage = MU_STATIC,
-			DrawOperationType drawOp = DOT_TRIANGLE_LIST);
+			DrawOperationType drawOp = DOT_TRIANGLE_LIST, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 	protected:
 	protected:
 		friend class Mesh;
 		friend class Mesh;
@@ -388,6 +394,7 @@ namespace BansheeEngine
 		SPtr<VertexDataDesc> mVertexDesc;
 		SPtr<VertexDataDesc> mVertexDesc;
 		int mUsage;
 		int mUsage;
 		IndexType mIndexType;
 		IndexType mIndexType;
+		GpuDeviceFlags mDeviceMask;
 		SPtr<MeshData> mTempInitialMeshData;
 		SPtr<MeshData> mTempInitialMeshData;
 		SPtr<Skeleton> mSkeleton; // Immutable
 		SPtr<Skeleton> mSkeleton; // Immutable
 		SPtr<MorphShapes> mMorphShapes; // Immutable
 		SPtr<MorphShapes> mMorphShapes; // Immutable

+ 4 - 3
Source/BansheeCore/Include/BsMeshHeap.h

@@ -62,15 +62,15 @@ namespace BansheeEngine
 		friend class TransientMeshCore;
 		friend class TransientMeshCore;
 
 
 		MeshHeapCore(UINT32 numVertices, UINT32 numIndices, 
 		MeshHeapCore(UINT32 numVertices, UINT32 numIndices, 
-			const SPtr<VertexDataDesc>& vertexDesc, IndexType indexType = IT_32BIT);
+			const SPtr<VertexDataDesc>& vertexDesc, IndexType indexType, GpuDeviceFlags deviceMask);
 
 
 		/** @copydoc CoreObjectCore::initialize() */
 		/** @copydoc CoreObjectCore::initialize() */
-		virtual void initialize() override;
+		void initialize() override;
 
 
 		/**
 		/**
 		 * Allocates a new mesh in the heap, expanding the heap if needed. 
 		 * Allocates a new mesh in the heap, expanding the heap if needed. 
 		 *
 		 *
-		 * @param[in]	meshId		Mesh for which we are allocating the data.
+		 * @param[in]	mesh		Mesh for which we are allocating the data.
 		 * @param[in]	meshData	Data to initialize the new mesh with.
 		 * @param[in]	meshData	Data to initialize the new mesh with.
 		 */
 		 */
 		void alloc(SPtr<TransientMeshCore> mesh, const SPtr<MeshData>& meshData);
 		void alloc(SPtr<TransientMeshCore> mesh, const SPtr<MeshData>& meshData);
@@ -143,6 +143,7 @@ namespace BansheeEngine
 
 
 		SPtr<VertexDataDesc> mVertexDesc;
 		SPtr<VertexDataDesc> mVertexDesc;
 		IndexType mIndexType;
 		IndexType mIndexType;
+		GpuDeviceFlags mDeviceMask;
 
 
 		Vector<ChunkData> mVertChunks;
 		Vector<ChunkData> mVertChunks;
 		Vector<ChunkData> mIdxChunks;
 		Vector<ChunkData> mIdxChunks;

+ 4 - 2
Source/BansheeCore/Include/BsRenderStateManager.h

@@ -139,7 +139,8 @@ namespace BansheeEngine
 		SPtr<BlendStateCore> createBlendState(const BLEND_STATE_DESC& desc) const;
 		SPtr<BlendStateCore> createBlendState(const BLEND_STATE_DESC& desc) const;
 
 
 		/** @copydoc RenderStateManager::createPipelineState */
 		/** @copydoc RenderStateManager::createPipelineState */
-		SPtr<GpuPipelineStateCore> createPipelineState(const PIPELINE_STATE_CORE_DESC& desc) const;
+		SPtr<GpuPipelineStateCore> createPipelineState(const PIPELINE_STATE_CORE_DESC& desc, 
+			GpuDeviceFlags deviceMask = GDF_DEFAULT) 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) const;
 		SPtr<SamplerStateCore> _createSamplerState(const SAMPLER_STATE_DESC& desc) const;
@@ -154,7 +155,8 @@ namespace BansheeEngine
 		SPtr<BlendStateCore> _createBlendState(const BLEND_STATE_DESC& desc) const;
 		SPtr<BlendStateCore> _createBlendState(const BLEND_STATE_DESC& desc) const;
 
 
 		/**	Creates an uninitialized GpuPipelineState. Requires manual initialization after creation. */
 		/**	Creates an uninitialized GpuPipelineState. Requires manual initialization after creation. */
-		SPtr<GpuPipelineStateCore> _createPipelineState(const PIPELINE_STATE_CORE_DESC& desc) const;
+		SPtr<GpuPipelineStateCore> _createPipelineState(const PIPELINE_STATE_CORE_DESC& desc, 
+			GpuDeviceFlags deviceMask = GDF_DEFAULT) 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;

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

@@ -133,14 +133,14 @@ namespace BansheeEngine
 	class BS_CORE_EXPORT RenderTextureCore : public RenderTargetCore
 	class BS_CORE_EXPORT RenderTextureCore : public RenderTargetCore
 	{
 	{
 	public:
 	public:
-		RenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc);
+		RenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc, GpuDeviceFlags deviceMask);
 		virtual ~RenderTextureCore();
 		virtual ~RenderTextureCore();
 
 
 		/** @copydoc CoreObjectCore::initialize */
 		/** @copydoc CoreObjectCore::initialize */
 		void initialize() override;
 		void initialize() override;
 
 
 		/** @copydoc TextureCoreManager::createRenderTexture(const RENDER_TEXTURE_DESC_CORE&) */
 		/** @copydoc TextureCoreManager::createRenderTexture(const RENDER_TEXTURE_DESC_CORE&) */
-		static SPtr<RenderTextureCore> create(const RENDER_TEXTURE_DESC_CORE& desc);
+		static SPtr<RenderTextureCore> create(const RENDER_TEXTURE_DESC_CORE& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 		/**
 		/**
 		 * Returns a color surface texture you may bind as an input to an GPU program.
 		 * Returns a color surface texture you may bind as an input to an GPU program.

+ 9 - 4
Source/BansheeCore/Include/BsTextureManager.h

@@ -111,8 +111,12 @@ namespace BansheeEngine
 			int numMips, PixelFormat format, int usage = TU_DEFAULT, bool hwGammaCorrection = false, 
 			int numMips, PixelFormat format, int usage = TU_DEFAULT, bool hwGammaCorrection = false, 
 			UINT32 multisampleCount = 0, UINT32 numArraySlices = 1);
 			UINT32 multisampleCount = 0, UINT32 numArraySlices = 1);
 
 
-		/** @copydoc	TextureManager::createRenderTexture(const RENDER_TEXTURE_DESC&) */
-		SPtr<RenderTextureCore> createRenderTexture(const RENDER_TEXTURE_DESC_CORE& desc);
+		/**
+		 * @copydoc TextureManager::createRenderTexture(const RENDER_TEXTURE_DESC&) 
+		 * @param[in]	deviceMask		Mask that determines on which GPU devices should the object be created on.
+		 */
+		SPtr<RenderTextureCore> createRenderTexture(const RENDER_TEXTURE_DESC_CORE& desc, 
+			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 
 	protected:
 	protected:
 		friend class Texture;
 		friend class Texture;
@@ -127,8 +131,9 @@ namespace BansheeEngine
 			int numMips, PixelFormat format, int usage = TU_DEFAULT, bool hwGammaCorrection = false,
 			int numMips, PixelFormat format, int usage = TU_DEFAULT, bool hwGammaCorrection = false,
 			UINT32 multisampleCount = 0, UINT32 numArraySlices = 1, const SPtr<PixelData>& initialData = nullptr) = 0;
 			UINT32 multisampleCount = 0, UINT32 numArraySlices = 1, const SPtr<PixelData>& initialData = nullptr) = 0;
 
 
-		/** @copydoc TextureManager::createRenderTextureImpl */
-		virtual SPtr<RenderTextureCore> createRenderTextureInternal(const RENDER_TEXTURE_DESC_CORE& desc) = 0;
+		/** @copydoc createRenderTexture */
+		virtual SPtr<RenderTextureCore> createRenderTextureInternal(const RENDER_TEXTURE_DESC_CORE& desc, 
+			GpuDeviceFlags deviceMask = GDF_DEFAULT) = 0;
     };
     };
 
 
 	/** @} */
 	/** @} */

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

@@ -34,13 +34,13 @@ namespace BansheeEngine
 	template class TGpuPipelineState < false > ;
 	template class TGpuPipelineState < false > ;
 	template class TGpuPipelineState < true >;
 	template class TGpuPipelineState < true >;
 
 
-	GpuPipelineStateCore::GpuPipelineStateCore(const PIPELINE_STATE_CORE_DESC& desc)
+	GpuPipelineStateCore::GpuPipelineStateCore(const PIPELINE_STATE_CORE_DESC& desc, GpuDeviceFlags deviceMask)
 		:TGpuPipelineState(desc)
 		:TGpuPipelineState(desc)
 	{ }
 	{ }
 
 
-	SPtr<GpuPipelineStateCore> GpuPipelineStateCore::create(const PIPELINE_STATE_CORE_DESC& desc)
+	SPtr<GpuPipelineStateCore> GpuPipelineStateCore::create(const PIPELINE_STATE_CORE_DESC& desc, GpuDeviceFlags deviceMask)
 	{
 	{
-		return RenderStateCoreManager::instance().createPipelineState(desc);
+		return RenderStateCoreManager::instance().createPipelineState(desc, deviceMask);
 	}
 	}
 
 
 	GpuPipelineState::GpuPipelineState(const PIPELINE_STATE_DESC& desc)
 	GpuPipelineState::GpuPipelineState(const PIPELINE_STATE_DESC& desc)

+ 17 - 14
Source/BansheeCore/Source/BsMesh.cpp

@@ -16,9 +16,9 @@ namespace BansheeEngine
 {
 {
 	MESH_DESC MESH_DESC::DEFAULT = MESH_DESC();
 	MESH_DESC MESH_DESC::DEFAULT = MESH_DESC();
 
 
-	MeshCore::MeshCore(const SPtr<MeshData>& initialMeshData, const MESH_DESC& desc)
+	MeshCore::MeshCore(const SPtr<MeshData>& initialMeshData, const MESH_DESC& desc, GpuDeviceFlags deviceMask)
 		: MeshCoreBase(desc.numVertices, desc.numIndices, desc.subMeshes), mVertexData(nullptr), mIndexBuffer(nullptr)
 		: MeshCoreBase(desc.numVertices, desc.numIndices, desc.subMeshes), mVertexData(nullptr), mIndexBuffer(nullptr)
-		, mVertexDesc(desc.vertexDesc), mUsage(desc.usage), mIndexType(desc.indexType)
+		, mVertexDesc(desc.vertexDesc), mUsage(desc.usage), mIndexType(desc.indexType), mDeviceMask(deviceMask)
 		, mTempInitialMeshData(initialMeshData), mSkeleton(desc.skeleton), mMorphShapes(desc.morphShapes)
 		, mTempInitialMeshData(initialMeshData), mSkeleton(desc.skeleton), mMorphShapes(desc.morphShapes)
 		
 		
 	{ }
 	{ }
@@ -44,12 +44,12 @@ namespace BansheeEngine
 		ibDesc.numIndices = mProperties.mNumIndices;
 		ibDesc.numIndices = mProperties.mNumIndices;
 		ibDesc.usage = isDynamic ? GBU_DYNAMIC : GBU_STATIC;
 		ibDesc.usage = isDynamic ? GBU_DYNAMIC : GBU_STATIC;
 
 
-		mIndexBuffer = IndexBufferCore::create(ibDesc);
+		mIndexBuffer = IndexBufferCore::create(ibDesc, mDeviceMask);
 
 
 		mVertexData = SPtr<VertexData>(bs_new<VertexData>());
 		mVertexData = SPtr<VertexData>(bs_new<VertexData>());
 
 
 		mVertexData->vertexCount = mProperties.mNumVertices;
 		mVertexData->vertexCount = mProperties.mNumVertices;
-		mVertexData->vertexDeclaration = HardwareBufferCoreManager::instance().createVertexDeclaration(mVertexDesc);
+		mVertexData->vertexDeclaration = VertexDeclarationCore::create(mVertexDesc, mDeviceMask);
 
 
 		for (UINT32 i = 0; i <= mVertexDesc->getMaxStreamIdx(); i++)
 		for (UINT32 i = 0; i <= mVertexDesc->getMaxStreamIdx(); i++)
 		{
 		{
@@ -61,7 +61,7 @@ namespace BansheeEngine
 			vbDesc.numVerts = mVertexData->vertexCount;
 			vbDesc.numVerts = mVertexData->vertexCount;
 			vbDesc.usage = isDynamic ? GBU_DYNAMIC : GBU_STATIC;
 			vbDesc.usage = isDynamic ? GBU_DYNAMIC : GBU_STATIC;
 
 
-			SPtr<VertexBufferCore> vertexBuffer = VertexBufferCore::create(vbDesc);
+			SPtr<VertexBufferCore> vertexBuffer = VertexBufferCore::create(vbDesc, mDeviceMask);
 			mVertexData->setBuffer(i, vertexBuffer);
 			mVertexData->setBuffer(i, vertexBuffer);
 		}
 		}
 
 
@@ -303,7 +303,7 @@ namespace BansheeEngine
 	}
 	}
 
 
 	SPtr<MeshCore> MeshCore::create(UINT32 numVertices, UINT32 numIndices, const SPtr<VertexDataDesc>& vertexDesc,
 	SPtr<MeshCore> MeshCore::create(UINT32 numVertices, UINT32 numIndices, const SPtr<VertexDataDesc>& vertexDesc,
-		int usage, DrawOperationType drawOp, IndexType indexType)
+		int usage, DrawOperationType drawOp, IndexType indexType, GpuDeviceFlags deviceMask)
 	{
 	{
 		MESH_DESC desc;
 		MESH_DESC desc;
 		desc.numVertices = numVertices;
 		desc.numVertices = numVertices;
@@ -313,16 +313,16 @@ namespace BansheeEngine
 		desc.usage = usage;
 		desc.usage = usage;
 		desc.indexType = indexType;
 		desc.indexType = indexType;
 
 
-		SPtr<MeshCore> mesh = bs_shared_ptr<MeshCore>(new (bs_alloc<MeshCore>()) MeshCore(nullptr, desc));
+		SPtr<MeshCore> mesh = bs_shared_ptr<MeshCore>(new (bs_alloc<MeshCore>()) MeshCore(nullptr, desc, deviceMask));
 		mesh->_setThisPtr(mesh);
 		mesh->_setThisPtr(mesh);
 		mesh->initialize();
 		mesh->initialize();
 
 
 		return mesh;
 		return mesh;
 	}
 	}
 
 
-	SPtr<MeshCore> MeshCore::create(const MESH_DESC& desc)
+	SPtr<MeshCore> MeshCore::create(const MESH_DESC& desc, GpuDeviceFlags deviceMask)
 	{
 	{
-		SPtr<MeshCore> mesh = bs_shared_ptr<MeshCore>(new (bs_alloc<MeshCore>()) MeshCore(nullptr, desc));
+		SPtr<MeshCore> mesh = bs_shared_ptr<MeshCore>(new (bs_alloc<MeshCore>()) MeshCore(nullptr, desc, deviceMask));
 
 
 		mesh->_setThisPtr(mesh);
 		mesh->_setThisPtr(mesh);
 		mesh->initialize();
 		mesh->initialize();
@@ -330,7 +330,7 @@ namespace BansheeEngine
 		return mesh;
 		return mesh;
 	}
 	}
 
 
-	SPtr<MeshCore> MeshCore::create(const SPtr<MeshData>& initialMeshData, const MESH_DESC& desc)
+	SPtr<MeshCore> MeshCore::create(const SPtr<MeshData>& initialMeshData, const MESH_DESC& desc, GpuDeviceFlags deviceMask)
 	{
 	{
 		MESH_DESC descCopy = desc;
 		MESH_DESC descCopy = desc;
 		descCopy.numVertices = initialMeshData->getNumVertices();
 		descCopy.numVertices = initialMeshData->getNumVertices();
@@ -338,7 +338,8 @@ namespace BansheeEngine
 		descCopy.vertexDesc = initialMeshData->getVertexDesc();
 		descCopy.vertexDesc = initialMeshData->getVertexDesc();
 		descCopy.indexType = initialMeshData->getIndexType();
 		descCopy.indexType = initialMeshData->getIndexType();
 
 
-		SPtr<MeshCore> mesh = bs_shared_ptr<MeshCore>(new (bs_alloc<MeshCore>()) MeshCore(initialMeshData, descCopy));
+		SPtr<MeshCore> mesh = 
+			bs_shared_ptr<MeshCore>(new (bs_alloc<MeshCore>()) MeshCore(initialMeshData, descCopy, deviceMask));
 
 
 		mesh->_setThisPtr(mesh);
 		mesh->_setThisPtr(mesh);
 		mesh->initialize();
 		mesh->initialize();
@@ -346,7 +347,8 @@ namespace BansheeEngine
 		return mesh;
 		return mesh;
 	}
 	}
 
 
-	SPtr<MeshCore> MeshCore::create(const SPtr<MeshData>& initialMeshData, int usage, DrawOperationType drawOp)
+	SPtr<MeshCore> MeshCore::create(const SPtr<MeshData>& initialMeshData, int usage, DrawOperationType drawOp, 
+		GpuDeviceFlags deviceMask)
 	{
 	{
 		MESH_DESC desc;
 		MESH_DESC desc;
 		desc.numVertices = initialMeshData->getNumVertices();
 		desc.numVertices = initialMeshData->getNumVertices();
@@ -356,7 +358,8 @@ namespace BansheeEngine
 		desc.subMeshes.push_back(SubMesh(0, initialMeshData->getNumIndices(), drawOp));
 		desc.subMeshes.push_back(SubMesh(0, initialMeshData->getNumIndices(), drawOp));
 		desc.usage = usage;
 		desc.usage = usage;
 
 
-		SPtr<MeshCore> mesh = bs_shared_ptr<MeshCore>(new (bs_alloc<MeshCore>()) MeshCore(initialMeshData, desc));
+		SPtr<MeshCore> mesh = 
+			bs_shared_ptr<MeshCore>(new (bs_alloc<MeshCore>()) MeshCore(initialMeshData, desc, deviceMask));
 
 
 		mesh->_setThisPtr(mesh);
 		mesh->_setThisPtr(mesh);
 		mesh->initialize();
 		mesh->initialize();
@@ -469,7 +472,7 @@ namespace BansheeEngine
 		desc.skeleton = mSkeleton;
 		desc.skeleton = mSkeleton;
 		desc.morphShapes = mMorphShapes;
 		desc.morphShapes = mMorphShapes;
 
 
-		MeshCore* obj = new (bs_alloc<MeshCore>()) MeshCore(mCPUData, desc);
+		MeshCore* obj = new (bs_alloc<MeshCore>()) MeshCore(mCPUData, desc, GDF_DEFAULT);
 
 
 		SPtr<CoreObjectCore> meshCore = bs_shared_ptr<MeshCore>(obj);
 		SPtr<CoreObjectCore> meshCore = bs_shared_ptr<MeshCore>(obj);
 		meshCore->_setThisPtr(meshCore);
 		meshCore->_setThisPtr(meshCore);

+ 10 - 9
Source/BansheeCore/Source/BsMeshHeap.cpp

@@ -16,9 +16,9 @@ namespace BansheeEngine
 	const float MeshHeapCore::GrowPercent = 1.5f;
 	const float MeshHeapCore::GrowPercent = 1.5f;
 
 
 	MeshHeapCore::MeshHeapCore(UINT32 numVertices, UINT32 numIndices,
 	MeshHeapCore::MeshHeapCore(UINT32 numVertices, UINT32 numIndices,
-		const SPtr<VertexDataDesc>& vertexDesc, IndexType indexType)
+		const SPtr<VertexDataDesc>& vertexDesc, IndexType indexType, GpuDeviceFlags deviceMask)
 		: mNumVertices(numVertices), mNumIndices(numIndices), mCPUIndexData(nullptr), mVertexDesc(vertexDesc)
 		: mNumVertices(numVertices), mNumIndices(numIndices), mCPUIndexData(nullptr), mVertexDesc(vertexDesc)
-		, mIndexType(indexType), mNextQueryId(0)
+		, mIndexType(indexType), mNextQueryId(0), mDeviceMask(deviceMask)
 	{
 	{
 		for (UINT32 i = 0; i <= mVertexDesc->getMaxStreamIdx(); i++)
 		for (UINT32 i = 0; i <= mVertexDesc->getMaxStreamIdx(); i++)
 		{
 		{
@@ -295,7 +295,7 @@ namespace BansheeEngine
 		mVertexData = SPtr<VertexData>(bs_new<VertexData>());
 		mVertexData = SPtr<VertexData>(bs_new<VertexData>());
 
 
 		mVertexData->vertexCount = mNumVertices;
 		mVertexData->vertexCount = mNumVertices;
-		mVertexData->vertexDeclaration = HardwareBufferCoreManager::instance().createVertexDeclaration(mVertexDesc);
+		mVertexData->vertexDeclaration = VertexDeclarationCore::create(mVertexDesc, mDeviceMask);
 
 
 		// Create buffers and copy data
 		// Create buffers and copy data
 		for (UINT32 i = 0; i <= mVertexDesc->getMaxStreamIdx(); i++)
 		for (UINT32 i = 0; i <= mVertexDesc->getMaxStreamIdx(); i++)
@@ -310,7 +310,7 @@ namespace BansheeEngine
 			desc.numVerts = mVertexData->vertexCount;
 			desc.numVerts = mVertexData->vertexCount;
 			desc.usage = GBU_DYNAMIC;
 			desc.usage = GBU_DYNAMIC;
 
 
-			SPtr<VertexBufferCore> vertexBuffer = HardwareBufferCoreManager::instance().createVertexBuffer(desc);
+			SPtr<VertexBufferCore> vertexBuffer = VertexBufferCore::create(desc, mDeviceMask);
 			mVertexData->setBuffer(i, vertexBuffer);
 			mVertexData->setBuffer(i, vertexBuffer);
 
 
 			// Copy all data to the new buffer
 			// Copy all data to the new buffer
@@ -385,7 +385,7 @@ namespace BansheeEngine
 		ibDesc.numIndices = mNumIndices;
 		ibDesc.numIndices = mNumIndices;
 		ibDesc.usage = GBU_DYNAMIC;
 		ibDesc.usage = GBU_DYNAMIC;
 
 
-		mIndexBuffer = IndexBufferCore::create(ibDesc);
+		mIndexBuffer = IndexBufferCore::create(ibDesc, mDeviceMask);
 
 
 		const IndexBufferProperties& ibProps = mIndexBuffer->getProperties();
 		const IndexBufferProperties& ibProps = mIndexBuffer->getProperties();
 
 
@@ -649,8 +649,8 @@ namespace BansheeEngine
 	{
 	{
 	}
 	}
 
 
-	SPtr<MeshHeap> MeshHeap::create(UINT32 numVertices, UINT32 numIndices, 
-		const SPtr<VertexDataDesc>& vertexDesc, IndexType indexType)
+	SPtr<MeshHeap> MeshHeap::create(UINT32 numVertices, UINT32 numIndices, const SPtr<VertexDataDesc>& vertexDesc, 
+		IndexType indexType)
 	{
 	{
 		MeshHeap* meshHeap = new (bs_alloc<MeshHeap>()) MeshHeap(numVertices, numIndices, vertexDesc, indexType); 
 		MeshHeap* meshHeap = new (bs_alloc<MeshHeap>()) MeshHeap(numVertices, numIndices, vertexDesc, indexType); 
 		SPtr<MeshHeap> meshHeapPtr = bs_core_ptr<MeshHeap>(meshHeap);
 		SPtr<MeshHeap> meshHeapPtr = bs_core_ptr<MeshHeap>(meshHeap);
@@ -666,7 +666,8 @@ namespace BansheeEngine
 		UINT32 meshIdx = mNextFreeId++;
 		UINT32 meshIdx = mNextFreeId++;
 
 
 		SPtr<MeshHeap> thisPtr = std::static_pointer_cast<MeshHeap>(getThisPtr());
 		SPtr<MeshHeap> thisPtr = std::static_pointer_cast<MeshHeap>(getThisPtr());
-		TransientMesh* transientMesh = new (bs_alloc<TransientMesh>()) TransientMesh(thisPtr, meshIdx, meshData->getNumVertices(), meshData->getNumIndices(), drawOp); 
+		TransientMesh* transientMesh = new (bs_alloc<TransientMesh>()) TransientMesh(thisPtr, meshIdx, 
+			meshData->getNumVertices(), meshData->getNumIndices(), drawOp); 
 		SPtr<TransientMesh> transientMeshPtr = bs_core_ptr<TransientMesh>(transientMesh);
 		SPtr<TransientMesh> transientMeshPtr = bs_core_ptr<TransientMesh>(transientMesh);
 
 
 		transientMeshPtr->_setThisPtr(transientMeshPtr);
 		transientMeshPtr->_setThisPtr(transientMeshPtr);
@@ -699,7 +700,7 @@ namespace BansheeEngine
 	SPtr<CoreObjectCore> MeshHeap::createCore() const
 	SPtr<CoreObjectCore> MeshHeap::createCore() const
 	{
 	{
 		MeshHeapCore* obj = new (bs_alloc<MeshHeapCore>()) MeshHeapCore(mNumVertices, mNumIndices,
 		MeshHeapCore* obj = new (bs_alloc<MeshHeapCore>()) MeshHeapCore(mNumVertices, mNumIndices,
-			mVertexDesc, mIndexType);
+			mVertexDesc, mIndexType, GDF_DEFAULT);
 
 
 		SPtr<MeshHeapCore> corePtr = bs_shared_ptr<MeshHeapCore>(obj);
 		SPtr<MeshHeapCore> corePtr = bs_shared_ptr<MeshHeapCore>(obj);
 		obj->_setThisPtr(corePtr);
 		obj->_setThisPtr(corePtr);

+ 6 - 4
Source/BansheeCore/Source/BsRenderStateManager.cpp

@@ -195,9 +195,10 @@ namespace BansheeEngine
 		return state;
 		return state;
 	}
 	}
 
 
-	SPtr<GpuPipelineStateCore> RenderStateCoreManager::createPipelineState(const PIPELINE_STATE_CORE_DESC& desc) const
+	SPtr<GpuPipelineStateCore> RenderStateCoreManager::createPipelineState(const PIPELINE_STATE_CORE_DESC& desc, 
+		GpuDeviceFlags deviceMask) const
 	{
 	{
-		SPtr<GpuPipelineStateCore> state = _createPipelineState(desc);
+		SPtr<GpuPipelineStateCore> state = _createPipelineState(desc, deviceMask);
 		state->initialize();
 		state->initialize();
 
 
 		return state;
 		return state;
@@ -267,10 +268,11 @@ namespace BansheeEngine
 		return state;
 		return state;
 	}
 	}
 
 
-	SPtr<GpuPipelineStateCore> RenderStateCoreManager::_createPipelineState(const PIPELINE_STATE_CORE_DESC& desc) const
+	SPtr<GpuPipelineStateCore> RenderStateCoreManager::_createPipelineState(const PIPELINE_STATE_CORE_DESC& desc,
+		GpuDeviceFlags deviceMask) const
 	{
 	{
 		SPtr<GpuPipelineStateCore> pipelineState =
 		SPtr<GpuPipelineStateCore> pipelineState =
-			bs_shared_ptr<GpuPipelineStateCore>(new (bs_alloc<GpuPipelineStateCore>()) GpuPipelineStateCore(desc));
+			bs_shared_ptr<GpuPipelineStateCore>(new (bs_alloc<GpuPipelineStateCore>()) GpuPipelineStateCore(desc, deviceMask));
 		pipelineState->_setThisPtr(pipelineState);
 		pipelineState->_setThisPtr(pipelineState);
 
 
 		return pipelineState;
 		return pipelineState;

+ 3 - 3
Source/BansheeCore/Source/BsRenderTexture.cpp

@@ -58,7 +58,7 @@ namespace BansheeEngine
 		mRequiresTextureFlipping = requiresFlipping;
 		mRequiresTextureFlipping = requiresFlipping;
 	}
 	}
 
 
-	RenderTextureCore::RenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc)
+	RenderTextureCore::RenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc, GpuDeviceFlags deviceMask)
 		:mDesc(desc)
 		:mDesc(desc)
 	{ }
 	{ }
 
 
@@ -106,9 +106,9 @@ namespace BansheeEngine
 		throwIfBuffersDontMatch();
 		throwIfBuffersDontMatch();
 	}
 	}
 
 
-	SPtr<RenderTextureCore> RenderTextureCore::create(const RENDER_TEXTURE_DESC_CORE& desc)
+	SPtr<RenderTextureCore> RenderTextureCore::create(const RENDER_TEXTURE_DESC_CORE& desc, GpuDeviceFlags deviceMask)
 	{
 	{
-		return TextureCoreManager::instance().createRenderTexture(desc);
+		return TextureCoreManager::instance().createRenderTexture(desc, deviceMask);
 	}
 	}
 
 
 	void RenderTextureCore::syncToCore(const CoreSyncData& data)
 	void RenderTextureCore::syncToCore(const CoreSyncData& data)

+ 3 - 2
Source/BansheeCore/Source/BsTextureManager.cpp

@@ -134,9 +134,10 @@ namespace BansheeEngine
 		return newRT;
 		return newRT;
 	}
 	}
 
 
-	SPtr<RenderTextureCore> TextureCoreManager::createRenderTexture(const RENDER_TEXTURE_DESC_CORE& desc)
+	SPtr<RenderTextureCore> TextureCoreManager::createRenderTexture(const RENDER_TEXTURE_DESC_CORE& desc, 
+		GpuDeviceFlags deviceMask)
 	{
 	{
-		SPtr<RenderTextureCore> newRT = createRenderTextureInternal(desc);
+		SPtr<RenderTextureCore> newRT = createRenderTextureInternal(desc, deviceMask);
 		newRT->initialize();
 		newRT->initialize();
 
 
 		return newRT;
 		return newRT;

+ 1 - 1
Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderTexture.h

@@ -22,7 +22,7 @@ namespace BansheeEngine
 	class D3D11RenderTextureCore : public RenderTextureCore
 	class D3D11RenderTextureCore : public RenderTextureCore
 	{
 	{
 	public:
 	public:
-		D3D11RenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc);
+		D3D11RenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc, GpuDeviceFlags deviceMask);
 		virtual ~D3D11RenderTextureCore() { }
 		virtual ~D3D11RenderTextureCore() { }
 
 
 		/** @copydoc RenderTextureCore::getCustomAttribute */
 		/** @copydoc RenderTextureCore::getCustomAttribute */

+ 2 - 1
Source/BansheeD3D11RenderAPI/Include/BsD3D11TextureManager.h

@@ -33,7 +33,8 @@ namespace BansheeEngine
 			UINT32 multisampleCount = 0, UINT32 numArraySlices = 1, const SPtr<PixelData>& initialData = nullptr) override;
 			UINT32 multisampleCount = 0, UINT32 numArraySlices = 1, const SPtr<PixelData>& initialData = nullptr) override;
 
 
 		/** @copydoc TextureCoreManager::createRenderTextureInternal */
 		/** @copydoc TextureCoreManager::createRenderTextureInternal */
-		SPtr<RenderTextureCore> createRenderTextureInternal(const RENDER_TEXTURE_DESC_CORE& desc) override;
+		SPtr<RenderTextureCore> createRenderTextureInternal(const RENDER_TEXTURE_DESC_CORE& desc, 
+			GpuDeviceFlags deviceMask = GDF_DEFAULT) override;
 	};
 	};
 
 
 	/** @} */
 	/** @} */

+ 3 - 3
Source/BansheeD3D11RenderAPI/Source/BsD3D11RenderTexture.cpp

@@ -5,10 +5,10 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	D3D11RenderTextureCore::D3D11RenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc)
-		:RenderTextureCore(desc), mProperties(desc, false)
+	D3D11RenderTextureCore::D3D11RenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc, GpuDeviceFlags deviceMask)
+		:RenderTextureCore(desc, deviceMask), mProperties(desc, false)
 	{ 
 	{ 
-
+		assert((deviceMask == GDF_DEFAULT || deviceMask == GDF_PRIMARY) && "Multiple GPUs not supported natively on DirectX 11.");
 	}
 	}
 
 
 	void D3D11RenderTextureCore::getCustomAttribute(const String& name, void* data) const
 	void D3D11RenderTextureCore::getCustomAttribute(const String& name, void* data) const

+ 3 - 2
Source/BansheeD3D11RenderAPI/Source/BsD3D11TextureManager.cpp

@@ -35,9 +35,10 @@ namespace BansheeEngine
 		return texPtr;
 		return texPtr;
 	}
 	}
 
 
-	SPtr<RenderTextureCore> D3D11TextureCoreManager::createRenderTextureInternal(const RENDER_TEXTURE_DESC_CORE& desc)
+	SPtr<RenderTextureCore> D3D11TextureCoreManager::createRenderTextureInternal(const RENDER_TEXTURE_DESC_CORE& desc,
+		GpuDeviceFlags deviceMask)
 	{
 	{
-		SPtr<D3D11RenderTextureCore> texPtr = bs_shared_ptr_new<D3D11RenderTextureCore>(desc);
+		SPtr<D3D11RenderTextureCore> texPtr = bs_shared_ptr_new<D3D11RenderTextureCore>(desc, deviceMask);
 		texPtr->_setThisPtr(texPtr);
 		texPtr->_setThisPtr(texPtr);
 
 
 		return texPtr;
 		return texPtr;

+ 1 - 1
Source/BansheeGLRenderAPI/Include/BsGLRenderTexture.h

@@ -25,7 +25,7 @@ namespace BansheeEngine
     class BS_RSGL_EXPORT GLRenderTextureCore : public RenderTextureCore
     class BS_RSGL_EXPORT GLRenderTextureCore : public RenderTextureCore
     {
     {
 	public:
 	public:
-		GLRenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc);
+		GLRenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc, GpuDeviceFlags deviceMask);
 		virtual ~GLRenderTextureCore();
 		virtual ~GLRenderTextureCore();
 
 
 		/** @copydoc RenderTextureCore::getCustomAttribute */
 		/** @copydoc RenderTextureCore::getCustomAttribute */

+ 2 - 1
Source/BansheeGLRenderAPI/Include/BsGLTextureManager.h

@@ -45,7 +45,8 @@ namespace BansheeEngine
 			UINT32 multisampleCount = 0, UINT32 numArraySlices = 1, const SPtr<PixelData>& initialData = nullptr) override;
 			UINT32 multisampleCount = 0, UINT32 numArraySlices = 1, const SPtr<PixelData>& initialData = nullptr) override;
 
 
 		/** @copydoc TextureCoreManager::createRenderTextureInternal */
 		/** @copydoc TextureCoreManager::createRenderTextureInternal */
-		SPtr<RenderTextureCore> createRenderTextureInternal(const RENDER_TEXTURE_DESC_CORE& desc) override;
+		SPtr<RenderTextureCore> createRenderTextureInternal(const RENDER_TEXTURE_DESC_CORE& desc, 
+			GpuDeviceFlags deviceMask = GDF_DEFAULT) override;
 
 
 		GLSupport& mGLSupport;
 		GLSupport& mGLSupport;
 	};
 	};

+ 5 - 3
Source/BansheeGLRenderAPI/Source/BsGLRenderTexture.cpp

@@ -20,9 +20,11 @@ namespace BansheeEngine
 
 
 #define DEPTHFORMAT_COUNT (sizeof(depthFormats)/sizeof(GLenum))
 #define DEPTHFORMAT_COUNT (sizeof(depthFormats)/sizeof(GLenum))
 
 
-	GLRenderTextureCore::GLRenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc)
-		:RenderTextureCore(desc), mProperties(desc, true), mFB(nullptr)
-	{ }
+	GLRenderTextureCore::GLRenderTextureCore(const RENDER_TEXTURE_DESC_CORE& desc, GpuDeviceFlags deviceMask)
+		:RenderTextureCore(desc, deviceMask), mProperties(desc, true), mFB(nullptr)
+	{
+		assert((deviceMask == GDF_DEFAULT || deviceMask == GDF_PRIMARY) && "Multiple GPUs not supported natively on OpenGL.");
+	}
 
 
 	GLRenderTextureCore::~GLRenderTextureCore()
 	GLRenderTextureCore::~GLRenderTextureCore()
 	{ 
 	{ 

+ 3 - 2
Source/BansheeGLRenderAPI/Source/BsGLTextureManager.cpp

@@ -70,9 +70,10 @@ namespace BansheeEngine
 		return texPtr;
 		return texPtr;
 	}
 	}
 
 
-	SPtr<RenderTextureCore> GLTextureCoreManager::createRenderTextureInternal(const RENDER_TEXTURE_DESC_CORE& desc)
+	SPtr<RenderTextureCore> GLTextureCoreManager::createRenderTextureInternal(const RENDER_TEXTURE_DESC_CORE& desc, 
+		GpuDeviceFlags deviceMask)
 	{
 	{
-		SPtr<GLRenderTextureCore> texPtr = bs_shared_ptr_new<GLRenderTextureCore>(desc);
+		SPtr<GLRenderTextureCore> texPtr = bs_shared_ptr_new<GLRenderTextureCore>(desc, deviceMask);
 		texPtr->_setThisPtr(texPtr);
 		texPtr->_setThisPtr(texPtr);
 
 
 		return texPtr;
 		return texPtr;