瀏覽代碼

WIP Vulkan buffers

BearishSun 9 年之前
父節點
當前提交
f2cf9d3387
共有 32 個文件被更改,包括 253 次插入129 次删除
  1. 2 3
      Source/BansheeCore/Include/BsCommandBuffer.h
  2. 4 4
      Source/BansheeCore/Include/BsCommonTypes.h
  3. 1 1
      Source/BansheeCore/Include/BsGpuBuffer.h
  4. 75 24
      Source/BansheeCore/Include/BsHardwareBuffer.h
  5. 3 3
      Source/BansheeCore/Source/BsMesh.cpp
  6. 4 4
      Source/BansheeCore/Source/BsMeshHeap.cpp
  7. 1 1
      Source/BansheeD3D11RenderAPI/Include/BsD3D11GpuBuffer.h
  8. 4 4
      Source/BansheeD3D11RenderAPI/Include/BsD3D11HardwareBuffer.h
  9. 4 4
      Source/BansheeD3D11RenderAPI/Include/BsD3D11IndexBuffer.h
  10. 4 4
      Source/BansheeD3D11RenderAPI/Include/BsD3D11VertexBuffer.h
  11. 1 1
      Source/BansheeD3D11RenderAPI/Source/BsD3D11GpuParamBlockBuffer.cpp
  12. 7 6
      Source/BansheeD3D11RenderAPI/Source/BsD3D11HardwareBuffer.cpp
  13. 4 4
      Source/BansheeD3D11RenderAPI/Source/BsD3D11IndexBuffer.cpp
  14. 5 4
      Source/BansheeD3D11RenderAPI/Source/BsD3D11VertexBuffer.cpp
  15. 1 1
      Source/BansheeEngine/Source/BsRenderable.cpp
  16. 1 1
      Source/BansheeGLRenderAPI/Include/BsGLBuffer.h
  17. 1 1
      Source/BansheeGLRenderAPI/Include/BsGLGpuBuffer.h
  18. 3 3
      Source/BansheeGLRenderAPI/Include/BsGLIndexBuffer.h
  19. 3 3
      Source/BansheeGLRenderAPI/Include/BsGLVertexBuffer.h
  20. 2 2
      Source/BansheeGLRenderAPI/Source/BsGLBuffer.cpp
  21. 3 3
      Source/BansheeGLRenderAPI/Source/BsGLIndexBuffer.cpp
  22. 3 3
      Source/BansheeGLRenderAPI/Source/BsGLVertexBuffer.cpp
  23. 12 3
      Source/BansheeVulkanRenderAPI/Include/BsVulkanDevice.h
  24. 1 1
      Source/BansheeVulkanRenderAPI/Include/BsVulkanGpuBuffer.h
  25. 14 10
      Source/BansheeVulkanRenderAPI/Include/BsVulkanHardwareBuffer.h
  26. 4 4
      Source/BansheeVulkanRenderAPI/Include/BsVulkanIndexBuffer.h
  27. 6 3
      Source/BansheeVulkanRenderAPI/Include/BsVulkanPrerequisites.h
  28. 4 4
      Source/BansheeVulkanRenderAPI/Include/BsVulkanVertexBuffer.h
  29. 3 0
      Source/BansheeVulkanRenderAPI/Source/BsVulkanDevice.cpp
  30. 64 12
      Source/BansheeVulkanRenderAPI/Source/BsVulkanHardwareBuffer.cpp
  31. 4 4
      Source/BansheeVulkanRenderAPI/Source/BsVulkanIndexBuffer.cpp
  32. 5 4
      Source/BansheeVulkanRenderAPI/Source/BsVulkanVertexBuffer.cpp

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

@@ -30,14 +30,13 @@ namespace BansheeEngine
 		 * @param[in]	syncMask	Determines how is concurrency handled between multiple command buffers on the same 
 		 * @param[in]	syncMask	Determines how is concurrency handled between multiple command buffers on the same 
 		 *							device. If buffers don't share the same bits in the sync mask they are allowed to
 		 *							device. If buffers don't share the same bits in the sync mask they are allowed to
 		 *							execute concurrently on the GPU, however it is up to the user to ensure that they
 		 *							execute concurrently on the GPU, however it is up to the user to ensure that they
-		 *							do not contain any resources depended on each other. Leave on default to ensure
-		 *							no concurrency is possible (safest).
+		 *							do not contain any resources depended on each other. 
 		 * @param[in]	secondary	If true the command buffer will not be allowed to execute on its own, but it can
 		 * @param[in]	secondary	If true the command buffer will not be allowed to execute on its own, but it can
 		 *							be appended to a primary command buffer. 
 		 *							be appended to a primary command buffer. 
 		 * @return					New CommandBuffer instance.
 		 * @return					New CommandBuffer instance.
 		 * 
 		 * 
 		 */
 		 */
-		static SPtr<CommandBuffer> create(CommandBufferType type, UINT32 deviceIdx = 0, UINT32 syncMask = 0xFFFFFFFF, 
+		static SPtr<CommandBuffer> create(CommandBufferType type, UINT32 deviceIdx = 0, UINT32 syncMask = 0x00000001, 
 			bool secondary = false);
 			bool secondary = false);
 
 
 	protected:
 	protected:

+ 4 - 4
Source/BansheeCore/Include/BsCommonTypes.h

@@ -406,25 +406,25 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** These values represent a hint to the driver when writing to a GPU buffer. */
 	/** These values represent a hint to the driver when writing to a GPU buffer. */
-	enum class BufferWriteType
+	enum BufferWriteType
 	{
 	{
 		/**
 		/**
 		 * Default flag with least restrictions. Can cause a CPU-GPU sync point so avoid using it often (every frame)
 		 * Default flag with least restrictions. Can cause a CPU-GPU sync point so avoid using it often (every frame)
 		 * as that might limit your performance significantly.
 		 * as that might limit your performance significantly.
 		 */
 		 */
-		Normal,
+		BWT_NORMAL,
 		/**
 		/**
 		 * Tells the driver to completely discard the contents of the buffer you are writing to. The driver will (most
 		 * Tells the driver to completely discard the contents of the buffer you are writing to. The driver will (most
 		 * likely) internally allocate another buffer with same specifications (which is fairly fast) and you will avoid 
 		 * likely) internally allocate another buffer with same specifications (which is fairly fast) and you will avoid 
 		 * CPU-GPU stalls. 
 		 * CPU-GPU stalls. 
 		 */
 		 */
-		Discard,
+		BWT_DISCARD,
 		/**
 		/**
 		 * Guarantees the driver that you will not be updating any part of the buffer that is currently used. This will 
 		 * Guarantees the driver that you will not be updating any part of the buffer that is currently used. This will 
 		 * also avoid CPU-GPU stalls, without requiring you to discard the entire buffer. However it is hard to guarantee 
 		 * also avoid CPU-GPU stalls, without requiring you to discard the entire buffer. However it is hard to guarantee 
 		 * when GPU has finished using a buffer.
 		 * when GPU has finished using a buffer.
 		 */
 		 */
-		NoOverwrite
+		BTW_NO_OVERWRITE
 	};
 	};
 
 
 	/**
 	/**

+ 1 - 1
Source/BansheeCore/Include/BsGpuBuffer.h

@@ -177,7 +177,7 @@ namespace BansheeEngine
 		 * @param[in]	writeFlags  Flags that may be used to improve performance for specific use cases.
 		 * @param[in]	writeFlags  Flags that may be used to improve performance for specific use cases.
 		 */
 		 */
         virtual void writeData(UINT32 offset, UINT32 length, const void* pSource, 
         virtual void writeData(UINT32 offset, UINT32 length, const void* pSource, 
-			BufferWriteType writeFlags = BufferWriteType::Normal) = 0;
+			BufferWriteType writeFlags = BWT_NORMAL) = 0;
 
 
 		/**
 		/**
 		 * Copies data from another buffer into this buffer.
 		 * Copies data from another buffer into this buffer.

+ 75 - 24
Source/BansheeCore/Include/BsHardwareBuffer.h

@@ -25,16 +25,25 @@ namespace BansheeEngine
 		/**
 		/**
 		 * Locks a portion of the buffer and returns pointer to the locked area. You must call unlock() when done.
 		 * Locks a portion of the buffer and returns pointer to the locked area. You must call unlock() when done.
 		 *
 		 *
-		 * @param[in]	offset	Offset in bytes from which to lock the buffer.
-		 * @param[in]	length	Length of the area you want to lock, in bytes.
-		 * @param[in]	options	Signifies what you want to do with the returned pointer. Caller must ensure not to do 
-		 *						anything he hasn't requested (for example don't try to read from the buffer unless you
-		 *						requested it here).
+		 * @param[in]	offset		Offset in bytes from which to lock the buffer.
+		 * @param[in]	length		Length of the area you want to lock, in bytes.
+		 * @param[in]	options		Signifies what you want to do with the returned pointer. Caller must ensure not to do
+		 *							anything he hasn't requested (for example don't try to read from the buffer unless you
+		 *							requested it here).
+		 * @param[in]	syncMask	Mask that determines how are read or write operations synchronized with other operations
+		 *							on this resource. This corresponds to the sync mask property on a CommandBuffer object.
+		 *							If reading, the system will wait on all commands buffers with the shared mask bits
+		 *							before continuing.
+		 *							If writing, Setting a mask that's different from used command buffers allows the writes
+		 *							to be queued independantly from normal rendering commands, allowing for async execution.
+		 *
+		 *							It's up to the caller to ensure the usage is valid (e.g. not reading something that is
+		 *							currently being written to with a different sync mask). If not sure leave at default.
 		 */
 		 */
-		virtual void* lock(UINT32 offset, UINT32 length, GpuLockOptions options)
+		virtual void* lock(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask = 0x00000001)
         {
         {
             assert(!isLocked() && "Cannot lock this buffer, it is already locked!");
             assert(!isLocked() && "Cannot lock this buffer, it is already locked!");
-            void* ret = map(offset, length, options);
+            void* ret = map(offset, length, options, syncMask);
             mIsLocked = true;
             mIsLocked = true;
 
 
 			mLockStart = offset;
 			mLockStart = offset;
@@ -45,13 +54,22 @@ namespace BansheeEngine
 		/**
 		/**
 		 * Locks the entire buffer and returns pointer to the locked area. You must call unlock() when done.
 		 * Locks the entire buffer and returns pointer to the locked area. You must call unlock() when done.
 		 *
 		 *
-		 * @param[in]	options	Signifies what you want to do with the returned pointer. Caller must ensure not to do 
-		 *						anything he hasn't requested (for example don't try to read from the buffer unless you
-		 *						requested it here).
+		 * @param[in]	options		Signifies what you want to do with the returned pointer. Caller must ensure not to do 
+		 *							anything he hasn't requested (for example don't try to read from the buffer unless you
+		 *							requested it here).
+		 * @param[in]	syncMask	Mask that determines how are read or write operations synchronized with other operations
+		 *							on this resource. This corresponds to the sync mask property on a CommandBuffer object.
+		 *							If reading, the system will wait on all commands buffers with the shared mask bits
+		 *							before continuing. 
+		 *							If writing, Setting a mask that's different from used command buffers allows the writes
+		 *							to be queued independantly from normal rendering commands, allowing for async execution.
+		 *							
+		 *							It's up to the caller to ensure the usage is valid (e.g. not reading something that is
+		 *							currently being written to with a different sync mask). If not sure leave at default.
 		 */
 		 */
-        void* lock(GpuLockOptions options)
+        void* lock(GpuLockOptions options, UINT32 syncMask = 0x00000001)
         {
         {
-            return this->lock(0, mSizeInBytes, options);
+            return this->lock(0, mSizeInBytes, options, syncMask);
         }
         }
 
 
 		/**	Releases the lock on this buffer. */
 		/**	Releases the lock on this buffer. */
@@ -67,11 +85,18 @@ namespace BansheeEngine
 		 * Reads data from a portion of the buffer and copies it to the destination buffer. Caller must ensure destination 
 		 * Reads data from a portion of the buffer and copies it to the destination buffer. Caller must ensure destination 
 		 * buffer is large enough.
 		 * buffer is large enough.
 		 *
 		 *
-		 * @param[in]	offset	Offset in bytes from which to copy the data.
-		 * @param[in]	length	Length of the area you want to copy, in bytes.
-		 * @param[in]	dest	Destination buffer large enough to store the read data.
+		 * @param[in]	offset		Offset in bytes from which to copy the data.
+		 * @param[in]	length		Length of the area you want to copy, in bytes.
+		 * @param[in]	dest		Destination buffer large enough to store the read data.
+		 * @param[in]	syncMask	Mask that determines how is the read operation synchronized with other operations on 
+		 *							this resource. This corresponds to the sync mask property on a CommandBuffer object.
+		 *							The system will wait on all commands buffers with the shared mask bits before continuing
+		 *							with the read. 
+		 *							
+		 *							It's up to the caller to ensure the usage is valid (e.g. not reading something that is
+		 *							currently being written to with a different sync mask). If not sure leave at default.
 		 */
 		 */
-        virtual void readData(UINT32 offset, UINT32 length, void* dest) = 0;
+        virtual void readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask = 0x00000001) = 0;
 
 
 		/**
 		/**
 		 * Writes data into a portion of the buffer from the source memory. 
 		 * Writes data into a portion of the buffer from the source memory. 
@@ -80,9 +105,16 @@ namespace BansheeEngine
 		 * @param[in]	length		Length of the area you want to copy, in bytes.
 		 * @param[in]	length		Length of the area you want to copy, in bytes.
 		 * @param[in]	source		Source buffer containing the data to write.
 		 * @param[in]	source		Source buffer containing the data to write.
 		 * @param[in]	writeFlags	Optional write flags that may affect performance.
 		 * @param[in]	writeFlags	Optional write flags that may affect performance.
+		 * @param[in]	syncMask	Mask that determines how is the write operation synchronized with other operations
+		 *							on this resource. This corresponds to the sync mask property on a CommandBuffer object.
+		 *							Setting a mask that's different from used command buffers allows the writes to be queued
+		 *							independantly from normal rendering commands, allowing for async execution.
+		 *							
+		 *							It's up to the caller to ensure the usage is valid (e.g. not writing to something that
+		 *							is currently being used by the GPU). If not sure leave at default.
 		 */
 		 */
         virtual void writeData(UINT32 offset, UINT32 length, const void* source,
         virtual void writeData(UINT32 offset, UINT32 length, const void* source,
-				BufferWriteType writeFlags = BufferWriteType::Normal) = 0;
+				BufferWriteType writeFlags = BWT_NORMAL, UINT32 syncMask = 0x00000001) = 0;
 
 
 		/**
 		/**
 		 * Copies data from a specific portion of the source buffer into a specific portion of this buffer.
 		 * Copies data from a specific portion of the source buffer into a specific portion of this buffer.
@@ -93,27 +125,46 @@ namespace BansheeEngine
 		 * @param[in]	length				Size of the data to copy, in bytes.
 		 * @param[in]	length				Size of the data to copy, in bytes.
 		 * @param[in]	discardWholeBuffer	Specify true if the data in the current buffer can be entirely discarded. This
 		 * @param[in]	discardWholeBuffer	Specify true if the data in the current buffer can be entirely discarded. This
 		 *									may improve performance.
 		 *									may improve performance.
+		 * @param[in]	syncMask			Mask that determines how is the copy operation synchronized with other 
+		 *									operations on this resource. This corresponds to the sync mask property on a 
+		 *									CommandBuffer object. Setting a mask that's different from used command buffers
+		 *									allows the copy to be queued independantly from normal rendering commands, 
+		 *									allowing for async execution.
+		 *									
+		 *									It's up to the caller to ensure the usage is valid (e.g. not reading from
+		 *									something that is currently being written to, or writing to something that is
+		 *									currently being read).		
 		 */
 		 */
 		virtual void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, 
 		virtual void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, 
-			UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false)
+			UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false, UINT32 syncMask = 0x00000001)
 		{
 		{
 			const void *srcData = srcBuffer.lock(
 			const void *srcData = srcBuffer.lock(
-				srcOffset, length, GBL_READ_ONLY);
-			this->writeData(dstOffset, length, srcData, discardWholeBuffer ? BufferWriteType::Discard : BufferWriteType::Normal);
+				srcOffset, length, GBL_READ_ONLY, syncMask);
+			this->writeData(dstOffset, length, srcData, discardWholeBuffer ? BWT_DISCARD : BWT_NORMAL, syncMask);
 			srcBuffer.unlock();
 			srcBuffer.unlock();
 		}
 		}
 
 
 		/**
 		/**
 		 * Copy data from the provided buffer into this buffer. If buffers are not the same size, smaller size will be used.
 		 * Copy data from the provided buffer into this buffer. If buffers are not the same size, smaller size will be used.
+		 * 
+		* @param[in]	syncMask			Mask that determines how is the copy operation synchronized with other 
+		 *									operations on this resource. This corresponds to the sync mask property on a 
+		 *									CommandBuffer object. Setting a mask that's different from used command buffers
+		 *									allows the copy to be queued independantly from normal rendering commands, 
+		 *									allowing for async execution.
+		 *									
+		 *									It's up to the caller to ensure the usage is valid (e.g. not reading from
+		 *									something that is currently being written to, or writing to something that is
+		 *									currently being read).		
 		 */
 		 */
-		virtual void copyData(HardwareBuffer& srcBuffer)
+		virtual void copyData(HardwareBuffer& srcBuffer, UINT32 syncMask = 0x00000001)
 		{
 		{
 			UINT32 sz = std::min(getSizeInBytes(), srcBuffer.getSizeInBytes()); 
 			UINT32 sz = std::min(getSizeInBytes(), srcBuffer.getSizeInBytes()); 
-			copyData(srcBuffer, 0, 0, sz, true);
+			copyData(srcBuffer, 0, 0, sz, true, syncMask);
 		}
 		}
 			
 			
 		/** Returns the size of this buffer in bytes. */
 		/** Returns the size of this buffer in bytes. */
-        UINT32 getSizeInBytes(void) const { return mSizeInBytes; }
+        UINT32 getSizeInBytes() const { return mSizeInBytes; }
 
 
 		/**	Returns the Usage flags with which this buffer was created. */
 		/**	Returns the Usage flags with which this buffer was created. */
         GpuBufferUsage getUsage() const { return mUsage; }
         GpuBufferUsage getUsage() const { return mUsage; }
@@ -142,7 +193,7 @@ namespace BansheeEngine
 		{  }
 		{  }
 
 
 		/** @copydoc lock */
 		/** @copydoc lock */
-		virtual void* map(UINT32 offset, UINT32 length, GpuLockOptions options) = 0;
+		virtual void* map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask) = 0;
 
 
 		/** @copydoc unlock */
 		/** @copydoc unlock */
 		virtual void unmap() = 0;
 		virtual void unmap() = 0;

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

@@ -138,7 +138,7 @@ namespace BansheeEngine
 			LOGERR("Index buffer values are being written out of valid range.");
 			LOGERR("Index buffer values are being written out of valid range.");
 		}
 		}
 
 
-		mIndexBuffer->writeData(0, indicesSize, srcIdxData, discardEntireBuffer ? BufferWriteType::Discard : BufferWriteType::Normal);
+		mIndexBuffer->writeData(0, indicesSize, srcIdxData, discardEntireBuffer ? BWT_DISCARD : BWT_NORMAL);
 
 
 		// Vertices
 		// Vertices
 		for (UINT32 i = 0; i <= mVertexDesc->getMaxStreamIdx(); i++)
 		for (UINT32 i = 0; i <= mVertexDesc->getMaxStreamIdx(); i++)
@@ -193,13 +193,13 @@ namespace BansheeEngine
 					}
 					}
 				}
 				}
 
 
-				vertexBuffer->writeData(0, bufferSize, bufferCopy, discardEntireBuffer ? BufferWriteType::Discard : BufferWriteType::Normal);
+				vertexBuffer->writeData(0, bufferSize, bufferCopy, discardEntireBuffer ? BWT_DISCARD : BWT_NORMAL);
 
 
 				bs_free(bufferCopy);
 				bs_free(bufferCopy);
 			}
 			}
 			else
 			else
 			{
 			{
-				vertexBuffer->writeData(0, bufferSize, srcVertBufferData, discardEntireBuffer ? BufferWriteType::Discard : BufferWriteType::Normal);
+				vertexBuffer->writeData(0, bufferSize, srcVertBufferData, discardEntireBuffer ? BWT_DISCARD : BWT_NORMAL);
 			}
 			}
 		}
 		}
 
 

+ 4 - 4
Source/BansheeCore/Source/BsMeshHeap.cpp

@@ -248,7 +248,7 @@ namespace BansheeEngine
 				}
 				}
 			}
 			}
 
 
-			vertexBuffer->writeData(vertChunkStart * vertSize, meshData->getNumVertices() * vertSize, vertDest, BufferWriteType::NoOverwrite);
+			vertexBuffer->writeData(vertChunkStart * vertSize, meshData->getNumVertices() * vertSize, vertDest, BTW_NO_OVERWRITE);
 		}
 		}
 
 
 		const IndexBufferProperties& ibProps = mIndexBuffer->getProperties();
 		const IndexBufferProperties& ibProps = mIndexBuffer->getProperties();
@@ -264,7 +264,7 @@ namespace BansheeEngine
 
 
 		UINT8* idxDest = mCPUIndexData + idxChunkStart * idxSize;
 		UINT8* idxDest = mCPUIndexData + idxChunkStart * idxSize;
 		memcpy(idxDest, meshData->getIndexData(), meshData->getNumIndices() * idxSize);
 		memcpy(idxDest, meshData->getIndexData(), meshData->getNumIndices() * idxSize);
-		mIndexBuffer->writeData(idxChunkStart * idxSize, meshData->getNumIndices() * idxSize, idxDest, BufferWriteType::NoOverwrite);
+		mIndexBuffer->writeData(idxChunkStart * idxSize, meshData->getNumIndices() * idxSize, idxDest, BTW_NO_OVERWRITE);
 	}
 	}
 
 
 	void MeshHeapCore::dealloc(SPtr<TransientMeshCore> mesh)
 	void MeshHeapCore::dealloc(SPtr<TransientMeshCore> mesh)
@@ -334,7 +334,7 @@ namespace BansheeEngine
 			}
 			}
 
 
 			if (destOffset > 0)
 			if (destOffset > 0)
-				vertexBuffer->writeData(0, destOffset * vertSize, buffer, BufferWriteType::NoOverwrite);
+				vertexBuffer->writeData(0, destOffset * vertSize, buffer, BTW_NO_OVERWRITE);
 
 
 			mCPUVertexData[i] = buffer;
 			mCPUVertexData[i] = buffer;
 		}
 		}
@@ -412,7 +412,7 @@ namespace BansheeEngine
 		}
 		}
 
 
 		if (destOffset > 0)
 		if (destOffset > 0)
-			mIndexBuffer->writeData(0, destOffset * idxSize, buffer, BufferWriteType::NoOverwrite);
+			mIndexBuffer->writeData(0, destOffset * idxSize, buffer, BTW_NO_OVERWRITE);
 
 
 		mCPUIndexData = buffer;
 		mCPUIndexData = buffer;
 
 

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

@@ -28,7 +28,7 @@ namespace BansheeEngine
 
 
 		/** @copydoc GpuBufferCore::writeData */
 		/** @copydoc GpuBufferCore::writeData */
         void writeData(UINT32 offset, UINT32 length, const void* pSource,
         void writeData(UINT32 offset, UINT32 length, const void* pSource,
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+			BufferWriteType writeFlags = BWT_NORMAL) override;
 
 
 		/** @copydoc GpuBufferCore::copyData */
 		/** @copydoc GpuBufferCore::copyData */
 		void copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset, 
 		void copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset, 

+ 4 - 4
Source/BansheeD3D11RenderAPI/Include/BsD3D11HardwareBuffer.h

@@ -42,22 +42,22 @@ namespace BansheeEngine
 		~D3D11HardwareBuffer();
 		~D3D11HardwareBuffer();
 
 
 		/** @copydoc HardwareBuffer::readData */
 		/** @copydoc HardwareBuffer::readData */
-		void readData(UINT32 offset, UINT32 length, void* dest) override;
+		void readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc HardwareBuffer::writeData */
 		/** @copydoc HardwareBuffer::writeData */
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+			BufferWriteType writeFlags = BWT_NORMAL, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc HardwareBuffer::copyData */
 		/** @copydoc HardwareBuffer::copyData */
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, 
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, 
-			UINT32 length, bool discardWholeBuffer = false) override;
+			UINT32 length, bool discardWholeBuffer = false, UINT32 syncMask = 0x00000001) override;
 
 
 		/**	Returns the internal DX11 buffer object. */
 		/**	Returns the internal DX11 buffer object. */
 		ID3D11Buffer* getD3DBuffer() const { return mD3DBuffer; }
 		ID3D11Buffer* getD3DBuffer() const { return mD3DBuffer; }
 
 
 	protected:
 	protected:
 		/** @copydoc HardwareBuffer::map */
 		/** @copydoc HardwareBuffer::map */
-		void* map(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+		void* map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask) override;
 
 
 		/** @copydoc HardwareBuffer::unmap */
 		/** @copydoc HardwareBuffer::unmap */
 		void unmap() override;
 		void unmap() override;

+ 4 - 4
Source/BansheeD3D11RenderAPI/Include/BsD3D11IndexBuffer.h

@@ -21,22 +21,22 @@ namespace BansheeEngine
 		~D3D11IndexBufferCore();
 		~D3D11IndexBufferCore();
 
 
 		/** @copydoc IndexBufferCore::readData */
 		/** @copydoc IndexBufferCore::readData */
-		void readData(UINT32 offset, UINT32 length, void* dest) override;
+		void readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc IndexBufferCore::writeData */
 		/** @copydoc IndexBufferCore::writeData */
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+			BufferWriteType writeFlags = BWT_NORMAL, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc IndexBufferCore::copyData */
 		/** @copydoc IndexBufferCore::copyData */
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, 
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, 
-			bool discardWholeBuffer = false) override;
+			bool discardWholeBuffer = false, UINT32 syncMask = 0x00000001) override;
 
 
 		/**	Gets the internal DX11 index buffer object. */
 		/**	Gets the internal DX11 index buffer object. */
 		ID3D11Buffer* getD3DIndexBuffer() const { return mBuffer->getD3DBuffer(); }		
 		ID3D11Buffer* getD3DIndexBuffer() const { return mBuffer->getD3DBuffer(); }		
 
 
 	protected:
 	protected:
 		/** @copydoc IndexBufferCore::map */
 		/** @copydoc IndexBufferCore::map */
-		void* map(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+		void* map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask) override;
 
 
 		/** @copydoc IndexBufferCore::unmap */
 		/** @copydoc IndexBufferCore::unmap */
 		void unmap() override;
 		void unmap() override;

+ 4 - 4
Source/BansheeD3D11RenderAPI/Include/BsD3D11VertexBuffer.h

@@ -21,22 +21,22 @@ namespace BansheeEngine
 		~D3D11VertexBufferCore();
 		~D3D11VertexBufferCore();
 
 
 		/** @copydoc VertexBufferCore::readData */
 		/** @copydoc VertexBufferCore::readData */
-		void readData(UINT32 offset, UINT32 length, void* dest) override;
+		void readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc VertexBufferCore::writeData */
 		/** @copydoc VertexBufferCore::writeData */
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+			BufferWriteType writeFlags = BWT_NORMAL, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc VertexBufferCore::copyData */
 		/** @copydoc VertexBufferCore::copyData */
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, 
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, 
-			bool discardWholeBuffer = false) override;
+			bool discardWholeBuffer = false, UINT32 syncMask = 0x00000001) override;
 
 
 		/**	Get the D3D-specific index buffer */
 		/**	Get the D3D-specific index buffer */
 		ID3D11Buffer* getD3DVertexBuffer() const { return mBuffer->getD3DBuffer(); }		
 		ID3D11Buffer* getD3DVertexBuffer() const { return mBuffer->getD3DBuffer(); }		
 
 
 	protected: 
 	protected: 
 		/** @copydoc VertexBufferCore::map */
 		/** @copydoc VertexBufferCore::map */
-		void* map(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+		void* map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask) override;
 
 
 		/** @copydoc VertexBufferCore::unmap */
 		/** @copydoc VertexBufferCore::unmap */
 		void unmap(void) override;
 		void unmap(void) override;

+ 1 - 1
Source/BansheeD3D11RenderAPI/Source/BsD3D11GpuParamBlockBuffer.cpp

@@ -48,7 +48,7 @@ namespace BansheeEngine
 
 
 	void D3D11GpuParamBlockBufferCore::writeToGPU(const UINT8* data)
 	void D3D11GpuParamBlockBufferCore::writeToGPU(const UINT8* data)
 	{
 	{
-		mBuffer->writeData(0, mSize, data, BufferWriteType::Discard);
+		mBuffer->writeData(0, mSize, data, BWT_DISCARD);
 
 
 		BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_GpuParamBuffer);
 		BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_GpuParamBuffer);
 	}
 	}

+ 7 - 6
Source/BansheeD3D11RenderAPI/Source/BsD3D11HardwareBuffer.cpp

@@ -90,7 +90,7 @@ namespace BansheeEngine
 			bs_delete(mpTempStagingBuffer);
 			bs_delete(mpTempStagingBuffer);
 	}
 	}
 
 
-	void* D3D11HardwareBuffer::map(UINT32 offset, UINT32 length, GpuLockOptions options)
+	void* D3D11HardwareBuffer::map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask)
 	{
 	{
 		if (length > mSizeInBytes)
 		if (length > mSizeInBytes)
 			BS_EXCEPT(RenderingAPIException, "Provided length " + toString(length) + " larger than the buffer " + toString(mSizeInBytes) + ".");		
 			BS_EXCEPT(RenderingAPIException, "Provided length " + toString(length) + " larger than the buffer " + toString(mSizeInBytes) + ".");		
@@ -217,7 +217,7 @@ namespace BansheeEngine
 	}
 	}
 
 
 	void D3D11HardwareBuffer::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, 
 	void D3D11HardwareBuffer::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, 
-		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer)
+		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer, UINT32 syncMask)
 	{
 	{
 		// If we're copying same-size buffers in their entirety
 		// If we're copying same-size buffers in their entirety
 		if (srcOffset == 0 && dstOffset == 0 &&
 		if (srcOffset == 0 && dstOffset == 0 &&
@@ -251,7 +251,7 @@ namespace BansheeEngine
 		}
 		}
 	}
 	}
 
 
-	void D3D11HardwareBuffer::readData(UINT32 offset, UINT32 length, void* pDest)
+	void D3D11HardwareBuffer::readData(UINT32 offset, UINT32 length, void* pDest, UINT32 syncMask)
 	{
 	{
 		// There is no functional interface in D3D, just do via manual lock, copy & unlock
 		// There is no functional interface in D3D, just do via manual lock, copy & unlock
 		void* pSrc = this->lock(offset, length, GBL_READ_ONLY);
 		void* pSrc = this->lock(offset, length, GBL_READ_ONLY);
@@ -259,14 +259,15 @@ namespace BansheeEngine
 		this->unlock();
 		this->unlock();
 	}
 	}
 
 
-	void D3D11HardwareBuffer::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags)
+	void D3D11HardwareBuffer::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags, 
+		UINT32 syncMask)
 	{
 	{
 		if(mDesc.Usage == D3D11_USAGE_DYNAMIC || mDesc.Usage == D3D11_USAGE_STAGING)
 		if(mDesc.Usage == D3D11_USAGE_DYNAMIC || mDesc.Usage == D3D11_USAGE_STAGING)
 		{
 		{
 			GpuLockOptions lockOption = GBL_WRITE_ONLY;
 			GpuLockOptions lockOption = GBL_WRITE_ONLY;
-			if(writeFlags == BufferWriteType::Discard)
+			if(writeFlags == BWT_DISCARD)
 				lockOption = GBL_WRITE_ONLY_DISCARD;
 				lockOption = GBL_WRITE_ONLY_DISCARD;
-			else if(writeFlags == BufferWriteType::NoOverwrite)
+			else if(writeFlags == BTW_NO_OVERWRITE)
 				lockOption = GBL_WRITE_ONLY_NO_OVERWRITE;
 				lockOption = GBL_WRITE_ONLY_NO_OVERWRITE;
 
 
 			void* pDst = this->lock(offset, length, lockOption);
 			void* pDst = this->lock(offset, length, lockOption);

+ 4 - 4
Source/BansheeD3D11RenderAPI/Source/BsD3D11IndexBuffer.cpp

@@ -29,7 +29,7 @@ namespace BansheeEngine
 		IndexBufferCore::initialize();
 		IndexBufferCore::initialize();
 	}
 	}
 
 
-	void* D3D11IndexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options)
+	void* D3D11IndexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask)
 	{
 	{
 #if BS_PROFILING_ENABLED
 #if BS_PROFILING_ENABLED
 		if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
 		if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
@@ -51,14 +51,14 @@ namespace BansheeEngine
 		mBuffer->unlock();
 		mBuffer->unlock();
 	}
 	}
 
 
-	void D3D11IndexBufferCore::readData(UINT32 offset, UINT32 length, void* pDest)
+	void D3D11IndexBufferCore::readData(UINT32 offset, UINT32 length, void* pDest, UINT32 syncMask)
 	{
 	{
 		mBuffer->readData(offset, length, pDest);
 		mBuffer->readData(offset, length, pDest);
 
 
 		BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_IndexBuffer);
 		BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_IndexBuffer);
 	}
 	}
 
 
-	void D3D11IndexBufferCore::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags)
+	void D3D11IndexBufferCore::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags, UINT32 syncMask)
 	{
 	{
 		mBuffer->writeData(offset, length, pSource, writeFlags);
 		mBuffer->writeData(offset, length, pSource, writeFlags);
 
 
@@ -66,7 +66,7 @@ namespace BansheeEngine
 	}
 	}
 
 
 	void D3D11IndexBufferCore::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset,
 	void D3D11IndexBufferCore::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset,
-		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer)
+		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer, UINT32 syncMask)
 	{
 	{
 		mBuffer->copyData(srcBuffer, srcOffset, dstOffset, length, discardWholeBuffer);
 		mBuffer->copyData(srcBuffer, srcOffset, dstOffset, length, discardWholeBuffer);
 	}
 	}

+ 5 - 4
Source/BansheeD3D11RenderAPI/Source/BsD3D11VertexBuffer.cpp

@@ -21,7 +21,7 @@ namespace BansheeEngine
 		BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_VertexBuffer);
 		BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_VertexBuffer);
 	}
 	}
 
 
-	void* D3D11VertexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options)
+	void* D3D11VertexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask)
 	{
 	{
 #if BS_PROFILING_ENABLED
 #if BS_PROFILING_ENABLED
 		if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
 		if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
@@ -43,20 +43,21 @@ namespace BansheeEngine
 		mBuffer->unlock();
 		mBuffer->unlock();
 	}
 	}
 
 
-	void D3D11VertexBufferCore::readData(UINT32 offset, UINT32 length, void* dest)
+	void D3D11VertexBufferCore::readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask)
 	{
 	{
 		mBuffer->readData(offset, length, dest);
 		mBuffer->readData(offset, length, dest);
 		BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_VertexBuffer);
 		BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_VertexBuffer);
 	}
 	}
 
 
-	void D3D11VertexBufferCore::writeData(UINT32 offset, UINT32 length, const void* source, BufferWriteType writeFlags)
+	void D3D11VertexBufferCore::writeData(UINT32 offset, UINT32 length, const void* source, BufferWriteType writeFlags, 
+		UINT32 syncMask)
 	{
 	{
 		mBuffer->writeData(offset, length, source, writeFlags);
 		mBuffer->writeData(offset, length, source, writeFlags);
 		BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_VertexBuffer);
 		BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_VertexBuffer);
 	}
 	}
 
 
 	void D3D11VertexBufferCore::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset,
 	void D3D11VertexBufferCore::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset,
-		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer)
+		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer, UINT32 syncMask)
 	{
 	{
 		mBuffer->copyData(srcBuffer, srcOffset, dstOffset, length, discardWholeBuffer);
 		mBuffer->copyData(srcBuffer, srcOffset, dstOffset, length, discardWholeBuffer);
 	}
 	}

+ 1 - 1
Source/BansheeEngine/Source/BsRenderable.cpp

@@ -301,7 +301,7 @@ namespace BansheeEngine
 				UINT32 bufferSize = meshData->getSize();
 				UINT32 bufferSize = meshData->getSize();
 				UINT8* data = meshData->getData();
 				UINT8* data = meshData->getData();
 
 
-				mMorphShapeBuffer->writeData(0, bufferSize, data, BufferWriteType::Discard);
+				mMorphShapeBuffer->writeData(0, bufferSize, data, BWT_DISCARD);
 				mMorphShapeVersion = animInfo->morphShapeInfo.version;
 				mMorphShapeVersion = animInfo->morphShapeInfo.version;
 			}
 			}
 		}
 		}

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

@@ -62,7 +62,7 @@ namespace BansheeEngine
 		 * @param[in]	writeFlags	Optional write flags that may affect performance.
 		 * @param[in]	writeFlags	Optional write flags that may affect performance.
 		 */
 		 */
         void writeData(UINT32 offset, UINT32 length, const void* source, 
         void writeData(UINT32 offset, UINT32 length, const void* source, 
-			BufferWriteType writeFlags = BufferWriteType::Normal);
+			BufferWriteType writeFlags = BWT_NORMAL);
 
 
 		/**	Returns internal OpenGL buffer ID. */
 		/**	Returns internal OpenGL buffer ID. */
         GLuint getGLBufferId() const { return mBufferId; }
         GLuint getGLBufferId() const { return mBufferId; }

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

@@ -29,7 +29,7 @@ namespace BansheeEngine
 
 
 		/** @copydoc GpuBufferCore::writeData */
 		/** @copydoc GpuBufferCore::writeData */
         void writeData(UINT32 offset, UINT32 length, const void* pSource,
         void writeData(UINT32 offset, UINT32 length, const void* pSource,
-				BufferWriteType writeFlags = BufferWriteType::Normal) override;
+				BufferWriteType writeFlags = BWT_NORMAL) override;
 
 
 		/** @copydoc GpuBufferCore::copyData */
 		/** @copydoc GpuBufferCore::copyData */
 		void copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset,
 		void copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset,

+ 3 - 3
Source/BansheeGLRenderAPI/Include/BsGLIndexBuffer.h

@@ -20,11 +20,11 @@ namespace BansheeEngine
 		~GLIndexBufferCore();
 		~GLIndexBufferCore();
 
 
 		/** @copydoc IndexBufferCore::readData */
 		/** @copydoc IndexBufferCore::readData */
-        void readData(UINT32 offset, UINT32 length, void* dest) override;
+        void readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc IndexBufferCore::writeData */
 		/** @copydoc IndexBufferCore::writeData */
         void writeData(UINT32 offset, UINT32 length, const void* source, 
         void writeData(UINT32 offset, UINT32 length, const void* source, 
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+			BufferWriteType writeFlags = BWT_NORMAL, UINT32 syncMask = 0x00000001) override;
 
 
 		/**	Returns internal OpenGL index buffer handle. */
 		/**	Returns internal OpenGL index buffer handle. */
         GLuint getGLBufferId() const { return mBuffer.getGLBufferId(); }
         GLuint getGLBufferId() const { return mBuffer.getGLBufferId(); }
@@ -34,7 +34,7 @@ namespace BansheeEngine
 		void initialize() override;	
 		void initialize() override;	
 
 
 		/** @copydoc IndexBufferCore::map */
 		/** @copydoc IndexBufferCore::map */
-		void* map(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+		void* map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask) override;
 
 
 		/** @copydoc IndexBufferCore::unmap */
 		/** @copydoc IndexBufferCore::unmap */
 		void unmap() override;
 		void unmap() override;

+ 3 - 3
Source/BansheeGLRenderAPI/Include/BsGLVertexBuffer.h

@@ -21,11 +21,11 @@ namespace BansheeEngine
 		~GLVertexBufferCore();
 		~GLVertexBufferCore();
 
 
 		/** @copydoc VertexBufferCore::readData */
 		/** @copydoc VertexBufferCore::readData */
-        void readData(UINT32 offset, UINT32 length, void* dest) override;
+        void readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc VertexBufferCore::writeData */
 		/** @copydoc VertexBufferCore::writeData */
         void writeData(UINT32 offset, UINT32 length, const void* source, 
         void writeData(UINT32 offset, UINT32 length, const void* source, 
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+			BufferWriteType writeFlags = BWT_NORMAL, UINT32 syncMask = 0x00000001) override;
 
 
 		/**	Returns internal OpenGL buffer ID. */
 		/**	Returns internal OpenGL buffer ID. */
         GLuint getGLBufferId() const { return mBuffer.getGLBufferId(); }
         GLuint getGLBufferId() const { return mBuffer.getGLBufferId(); }
@@ -41,7 +41,7 @@ namespace BansheeEngine
 		void initialize() override;
 		void initialize() override;
 
 
 		/** @copydoc VertexBufferCore::map */
 		/** @copydoc VertexBufferCore::map */
-		void* map(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+		void* map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask) override;
 
 
 		/** @copydoc VertexBufferCore::unmap */
 		/** @copydoc VertexBufferCore::unmap */
 		void unmap() override;
 		void unmap() override;

+ 2 - 2
Source/BansheeGLRenderAPI/Source/BsGLBuffer.cpp

@@ -104,9 +104,9 @@ namespace BansheeEngine
 		const void* pSource, BufferWriteType writeFlags)
 		const void* pSource, BufferWriteType writeFlags)
 	{
 	{
 		GpuLockOptions lockOption = GBL_WRITE_ONLY;
 		GpuLockOptions lockOption = GBL_WRITE_ONLY;
-		if (writeFlags == BufferWriteType::Discard)
+		if (writeFlags == BWT_DISCARD)
 			lockOption = GBL_WRITE_ONLY_DISCARD;
 			lockOption = GBL_WRITE_ONLY_DISCARD;
-		else if (writeFlags == BufferWriteType::NoOverwrite)
+		else if (writeFlags == BTW_NO_OVERWRITE)
 			lockOption = GBL_WRITE_ONLY_NO_OVERWRITE;
 			lockOption = GBL_WRITE_ONLY_NO_OVERWRITE;
 
 
 		void* bufferData = lock(offset, length, lockOption);
 		void* bufferData = lock(offset, length, lockOption);

+ 3 - 3
Source/BansheeGLRenderAPI/Source/BsGLIndexBuffer.cpp

@@ -26,7 +26,7 @@ namespace BansheeEngine
 		IndexBufferCore::initialize();
 		IndexBufferCore::initialize();
 	}
 	}
 
 
-	void* GLIndexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options)
+	void* GLIndexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask)
 	{
 	{
 		return mBuffer.lock(offset, length, options);
 		return mBuffer.lock(offset, length, options);
 	}
 	}
@@ -36,13 +36,13 @@ namespace BansheeEngine
 		mBuffer.unlock();
 		mBuffer.unlock();
 	}
 	}
 
 
-	void GLIndexBufferCore::readData(UINT32 offset, UINT32 length, void* pDest)
+	void GLIndexBufferCore::readData(UINT32 offset, UINT32 length, void* pDest, UINT32 syncMask)
 	{
 	{
 		mBuffer.readData(offset, length, pDest);
 		mBuffer.readData(offset, length, pDest);
 	}
 	}
 
 
 	void GLIndexBufferCore::writeData(UINT32 offset, UINT32 length,
 	void GLIndexBufferCore::writeData(UINT32 offset, UINT32 length,
-		const void* pSource, BufferWriteType writeFlags)
+		const void* pSource, BufferWriteType writeFlags, UINT32 syncMask)
 	{
 	{
 		mBuffer.writeData(offset, length, pSource, writeFlags);
 		mBuffer.writeData(offset, length, pSource, writeFlags);
 	}
 	}

+ 3 - 3
Source/BansheeGLRenderAPI/Source/BsGLVertexBuffer.cpp

@@ -43,7 +43,7 @@ namespace BansheeEngine
 			mVAObjects.erase(iterFind);
 			mVAObjects.erase(iterFind);
 	}
 	}
 
 
-	void* GLVertexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options)
+	void* GLVertexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask)
     {
     {
 		return mBuffer.lock(offset, length, options);
 		return mBuffer.lock(offset, length, options);
     }
     }
@@ -53,13 +53,13 @@ namespace BansheeEngine
 		mBuffer.unlock();
 		mBuffer.unlock();
     }
     }
 
 
-	void GLVertexBufferCore::readData(UINT32 offset, UINT32 length, void* pDest)
+	void GLVertexBufferCore::readData(UINT32 offset, UINT32 length, void* pDest, UINT32 syncMask)
     {
     {
 		mBuffer.readData(offset, length, pDest);
 		mBuffer.readData(offset, length, pDest);
     }
     }
 
 
 	void GLVertexBufferCore::writeData(UINT32 offset, UINT32 length,
 	void GLVertexBufferCore::writeData(UINT32 offset, UINT32 length,
-		const void* pSource, BufferWriteType writeFlags)
+		const void* pSource, BufferWriteType writeFlags, UINT32 syncMask)
     {
     {
 		mBuffer.writeData(offset, length, pSource, writeFlags);
 		mBuffer.writeData(offset, length, pSource, writeFlags);
     }
     }

+ 12 - 3
Source/BansheeVulkanRenderAPI/Include/BsVulkanDevice.h

@@ -53,13 +53,22 @@ namespace BansheeEngine
 		 */
 		 */
 		VkCommandPool getCommandPool(VulkanQueueType type) const { return mQueueInfos[(int)type].commandPool; }
 		VkCommandPool getCommandPool(VulkanQueueType type) const { return mQueueInfos[(int)type].commandPool; }
 
 
-		/** Allocates memory for the provided image, and binds it to the image. */
+		/** 
+		 * Allocates memory for the provided image, and binds it to the image. Returns null if it cannot find memory
+		 * with the specified flags.
+		 */
 		VkDeviceMemory allocateMemory(VkImage image, VkMemoryPropertyFlags flags);
 		VkDeviceMemory allocateMemory(VkImage image, VkMemoryPropertyFlags flags);
 
 
-		/** Allocates memory for the provided buffer, and binds it to the buffer. */
+		/** 
+		 * Allocates memory for the provided buffer, and binds it to the buffer. Returns null if it cannot find memory
+		 * with the specified flags.
+		 */
 		VkDeviceMemory allocateMemory(VkBuffer buffer, VkMemoryPropertyFlags flags);
 		VkDeviceMemory allocateMemory(VkBuffer buffer, VkMemoryPropertyFlags flags);
 
 
-		/** Allocates a block of memory according to the provided memory requirements. */
+		/** 
+		 * Allocates a block of memory according to the provided memory requirements. Returns null if it cannot find memory
+		 * with the specified flags. 
+		 */
 		VkDeviceMemory allocateMemory(const VkMemoryRequirements& reqs, VkMemoryPropertyFlags flags);
 		VkDeviceMemory allocateMemory(const VkMemoryRequirements& reqs, VkMemoryPropertyFlags flags);
 
 
 		/** Frees a previously allocated block of memory. */
 		/** Frees a previously allocated block of memory. */

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

@@ -28,7 +28,7 @@ namespace BansheeEngine
 
 
 		/** @copydoc GpuBufferCore::writeData */
 		/** @copydoc GpuBufferCore::writeData */
         void writeData(UINT32 offset, UINT32 length, const void* pSource,
         void writeData(UINT32 offset, UINT32 length, const void* pSource,
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+			BufferWriteType writeFlags = BWT_NORMAL) override;
 
 
 		/** @copydoc GpuBufferCore::copyData */
 		/** @copydoc GpuBufferCore::copyData */
 		void copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset, 
 		void copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset, 

+ 14 - 10
Source/BansheeVulkanRenderAPI/Include/BsVulkanHardwareBuffer.h

@@ -14,33 +14,37 @@ namespace BansheeEngine
 	/**	Class containing common functionality for all Vulkan hardware buffers. */
 	/**	Class containing common functionality for all Vulkan hardware buffers. */
 	class VulkanHardwareBuffer : public HardwareBuffer
 	class VulkanHardwareBuffer : public HardwareBuffer
 	{
 	{
+		/** Information about allocated buffer memory for a single device. */
+		struct MemoryInfo
+		{
+			SPtr<VulkanDevice> device;
+			VkDeviceMemory memory;
+		};
+
 	public:
 	public:
-		VulkanHardwareBuffer(GpuBufferUsage usage, UINT32 elementCount, UINT32 elementSize, bool systemMemory = false, 
-			bool streamOut = false, bool randomGpuWrite = false, bool useCounter = false);
+		VulkanHardwareBuffer(GpuBufferUsage usage, const VkMemoryRequirements& reqs, bool useSystemMem = false,
+			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 		~VulkanHardwareBuffer();
 		~VulkanHardwareBuffer();
 
 
 		/** @copydoc HardwareBuffer::readData */
 		/** @copydoc HardwareBuffer::readData */
-		void readData(UINT32 offset, UINT32 length, void* dest) override;
+		void readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc HardwareBuffer::writeData */
 		/** @copydoc HardwareBuffer::writeData */
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+			BufferWriteType writeFlags = BWT_NORMAL, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc HardwareBuffer::copyData */
 		/** @copydoc HardwareBuffer::copyData */
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, 
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, 
-			UINT32 length, bool discardWholeBuffer = false) override;
+			UINT32 length, bool discardWholeBuffer = false, UINT32 syncMask = 0x00000001) override;
 
 
 	protected:
 	protected:
 		/** @copydoc HardwareBuffer::map */
 		/** @copydoc HardwareBuffer::map */
-		void* map(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+		void* map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask) override;
 
 
 		/** @copydoc HardwareBuffer::unmap */
 		/** @copydoc HardwareBuffer::unmap */
 		void unmap() override;
 		void unmap() override;
 
 
-		bool mRandomGpuWrite;
-		bool mUseCounter;
-		UINT32 mElementCount;
-		UINT32 mElementSize;
+		MemoryInfo mAllocations[BS_MAX_VULKAN_DEVICES];
 	};
 	};
 
 
 	/** @} */
 	/** @} */

+ 4 - 4
Source/BansheeVulkanRenderAPI/Include/BsVulkanIndexBuffer.h

@@ -20,19 +20,19 @@ namespace BansheeEngine
 		~VulkanIndexBufferCore();
 		~VulkanIndexBufferCore();
 
 
 		/** @copydoc IndexBufferCore::readData */
 		/** @copydoc IndexBufferCore::readData */
-		void readData(UINT32 offset, UINT32 length, void* dest) override;
+		void readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc IndexBufferCore::writeData */
 		/** @copydoc IndexBufferCore::writeData */
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+			BufferWriteType writeFlags = BWT_NORMAL, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc IndexBufferCore::copyData */
 		/** @copydoc IndexBufferCore::copyData */
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, 
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, 
-			bool discardWholeBuffer = false) override;
+			bool discardWholeBuffer = false, UINT32 syncMask = 0x00000001) override;
 
 
 	protected:
 	protected:
 		/** @copydoc IndexBufferCore::map */
 		/** @copydoc IndexBufferCore::map */
-		void* map(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+		void* map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask) override;
 
 
 		/** @copydoc IndexBufferCore::unmap */
 		/** @copydoc IndexBufferCore::unmap */
 		void unmap() override;
 		void unmap() override;

+ 6 - 3
Source/BansheeVulkanRenderAPI/Include/BsVulkanPrerequisites.h

@@ -62,10 +62,13 @@ namespace BansheeEngine
 	};
 	};
 }
 }
 
 
-// Macro to get a procedure address based on a Vulkan instance.
+/** Macro to get a procedure address based on a Vulkan instance. */
 #define GET_INSTANCE_PROC_ADDR(instance, name) \
 #define GET_INSTANCE_PROC_ADDR(instance, name) \
 	vk##name = reinterpret_cast<PFN_vk##name>(vkGetInstanceProcAddr(instance, "vk"#name));
 	vk##name = reinterpret_cast<PFN_vk##name>(vkGetInstanceProcAddr(instance, "vk"#name));
 
 
-// Macro to get a procedure address based on a Vulkan device.
+/** Macro to get a procedure address based on a Vulkan device. */
 #define GET_DEVICE_PROC_ADDR(device, name) \
 #define GET_DEVICE_PROC_ADDR(device, name) \
-	vk##name = reinterpret_cast<PFN_vk##name>(vkGetDeviceProcAddr(device, "vk"#name));
+	vk##name = reinterpret_cast<PFN_vk##name>(vkGetDeviceProcAddr(device, "vk"#name));
+
+/** Maximum number of hardware devices usable at once. */
+#define BS_MAX_VULKAN_DEVICES 5

+ 4 - 4
Source/BansheeVulkanRenderAPI/Include/BsVulkanVertexBuffer.h

@@ -19,19 +19,19 @@ namespace BansheeEngine
 		~VulkanVertexBufferCore();
 		~VulkanVertexBufferCore();
 
 
 		/** @copydoc VertexBufferCore::readData */
 		/** @copydoc VertexBufferCore::readData */
-		void readData(UINT32 offset, UINT32 length, void* dest) override;
+		void readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc VertexBufferCore::writeData */
 		/** @copydoc VertexBufferCore::writeData */
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
 		void writeData(UINT32 offset, UINT32 length, const void* source, 
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+			BufferWriteType writeFlags = BWT_NORMAL, UINT32 syncMask = 0x00000001) override;
 
 
 		/** @copydoc VertexBufferCore::copyData */
 		/** @copydoc VertexBufferCore::copyData */
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, 
 		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, 
-			bool discardWholeBuffer = false) override;
+			bool discardWholeBuffer = false, UINT32 syncMask = 0x00000001) override;
 
 
 	protected: 
 	protected: 
 		/** @copydoc VertexBufferCore::map */
 		/** @copydoc VertexBufferCore::map */
-		void* map(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+		void* map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask) override;
 
 
 		/** @copydoc VertexBufferCore::unmap */
 		/** @copydoc VertexBufferCore::unmap */
 		void unmap(void) override;
 		void unmap(void) override;

+ 3 - 0
Source/BansheeVulkanRenderAPI/Source/BsVulkanDevice.cpp

@@ -165,6 +165,9 @@ namespace BansheeEngine
 		allocateInfo.memoryTypeIndex = findMemoryType(reqs.memoryTypeBits, flags);
 		allocateInfo.memoryTypeIndex = findMemoryType(reqs.memoryTypeBits, flags);
 		allocateInfo.allocationSize = reqs.size;
 		allocateInfo.allocationSize = reqs.size;
 
 
+		if (allocateInfo.memoryTypeIndex == -1)
+			return VK_NULL_HANDLE;
+
 		VkDeviceMemory memory;
 		VkDeviceMemory memory;
 
 
 		VkResult result = vkAllocateMemory(mLogicalDevice, &allocateInfo, gVulkanAllocator, &memory);
 		VkResult result = vkAllocateMemory(mLogicalDevice, &allocateInfo, gVulkanAllocator, &memory);

+ 64 - 12
Source/BansheeVulkanRenderAPI/Source/BsVulkanHardwareBuffer.cpp

@@ -1,27 +1,79 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsVulkanHardwareBuffer.h"
 #include "BsVulkanHardwareBuffer.h"
+#include "BsVulkanRenderAPI.h"
+#include "BsVulkanDevice.h"
 #include "BsException.h"
 #include "BsException.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	VulkanHardwareBuffer::VulkanHardwareBuffer(GpuBufferUsage usage, UINT32 elementCount, UINT32 elementSize,
-		bool useSystemMem, bool streamOut, bool randomGpuWrite, bool useCounter)
-		: HardwareBuffer(usage, useSystemMem), mElementCount(elementCount), mElementSize(elementSize)
-		, mRandomGpuWrite(randomGpuWrite), mUseCounter(useCounter)
+	VulkanHardwareBuffer::VulkanHardwareBuffer(GpuBufferUsage usage, const VkMemoryRequirements& reqs, bool useSystemMem, 
+		GpuDeviceFlags deviceMask)
+		: HardwareBuffer(usage, useSystemMem), mAllocations{}
 	{
 	{
-		
+		VulkanRenderAPI& rapi = static_cast<VulkanRenderAPI&>(RenderAPICore::instance());
+
+		UINT32 deviceIdx = 0;
+		if(deviceMask == GDF_DEFAULT)
+		{
+			const Vector<SPtr<VulkanDevice>>& devices = rapi._getPrimaryDevices();
+			for (auto& device : devices)
+				mAllocations[deviceIdx++].device = device;
+		}
+		else
+		{
+			for(UINT32 i = 0; i < BS_MAX_VULKAN_DEVICES; i++)
+			{
+				if ((1 << i) & deviceMask)
+					mAllocations[deviceIdx++].device = rapi._getDevice(i);
+			}
+		}
+
+		VkMemoryPropertyFlags flags = useSystemMem ?
+			(VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) : // Note: Use cached uncoherent memory
+			VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
+
+		for (UINT32 i = 0; i < BS_MAX_VULKAN_DEVICES; i++)
+		{
+			if (mAllocations[i].device == nullptr)
+				break;
+
+			mAllocations[i].memory = mAllocations[i].device->allocateMemory(reqs, flags);
+		}
+
+		mSizeInBytes = reqs.size;
 	}
 	}
 
 
 	VulkanHardwareBuffer::~VulkanHardwareBuffer()
 	VulkanHardwareBuffer::~VulkanHardwareBuffer()
 	{
 	{
-
+		for(auto& alloc : mAllocations)
+			alloc.device->freeMemory(alloc.memory);
 	}
 	}
 
 
-	void* VulkanHardwareBuffer::map(UINT32 offset, UINT32 length, GpuLockOptions options)
+	void* VulkanHardwareBuffer::map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask)
 	{
 	{
-		if (length > mSizeInBytes)
-			BS_EXCEPT(RenderingAPIException, "Provided length " + toString(length) + " larger than the buffer " + toString(mSizeInBytes) + ".");		
+		if ((offset + length) > mSizeInBytes)
+			BS_EXCEPT(RenderingAPIException, "Provided offset(" + toString(offset) + ") + length(" + toString(length) + ") "
+				"is larger than the buffer " + toString(mSizeInBytes) + ".");		
+
+		switch (options)
+		{
+		case GBL_WRITE_ONLY_DISCARD:
+
+			break;
+		case GBL_WRITE_ONLY_NO_OVERWRITE:
+
+			break;
+		case GBL_WRITE_ONLY:
+
+			break;
+		case GBL_READ_WRITE:
+
+			break;
+		case GBL_READ_ONLY:
+
+			break;
+		}
 
 
 		return nullptr;
 		return nullptr;
 	}
 	}
@@ -32,17 +84,17 @@ namespace BansheeEngine
 	}
 	}
 
 
 	void VulkanHardwareBuffer::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset,
 	void VulkanHardwareBuffer::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset,
-		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer)
+		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer, UINT32 syncMask)
 	{
 	{
 
 
 	}
 	}
 
 
-	void VulkanHardwareBuffer::readData(UINT32 offset, UINT32 length, void* pDest)
+	void VulkanHardwareBuffer::readData(UINT32 offset, UINT32 length, void* pDest, UINT32 syncMask)
 	{
 	{
 		
 		
 	}
 	}
 
 
-	void VulkanHardwareBuffer::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags)
+	void VulkanHardwareBuffer::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags, UINT32 syncMask)
 	{
 	{
 		
 		
 	}
 	}

+ 4 - 4
Source/BansheeVulkanRenderAPI/Source/BsVulkanIndexBuffer.cpp

@@ -22,7 +22,7 @@ namespace BansheeEngine
 		IndexBufferCore::initialize();
 		IndexBufferCore::initialize();
 	}
 	}
 
 
-	void* VulkanIndexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options)
+	void* VulkanIndexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask)
 	{
 	{
 #if BS_PROFILING_ENABLED
 #if BS_PROFILING_ENABLED
 		if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
 		if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
@@ -45,18 +45,18 @@ namespace BansheeEngine
 
 
 	}
 	}
 
 
-	void VulkanIndexBufferCore::readData(UINT32 offset, UINT32 length, void* pDest)
+	void VulkanIndexBufferCore::readData(UINT32 offset, UINT32 length, void* pDest, UINT32 syncMask)
 	{
 	{
 		BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_IndexBuffer);
 		BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_IndexBuffer);
 	}
 	}
 
 
-	void VulkanIndexBufferCore::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags)
+	void VulkanIndexBufferCore::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags, UINT32 syncMask)
 	{
 	{
 		BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_IndexBuffer);
 		BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_IndexBuffer);
 	}
 	}
 
 
 	void VulkanIndexBufferCore::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset,
 	void VulkanIndexBufferCore::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset,
-		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer)
+		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer, UINT32 syncMask)
 	{
 	{
 
 
 	}
 	}

+ 5 - 4
Source/BansheeVulkanRenderAPI/Source/BsVulkanVertexBuffer.cpp

@@ -14,7 +14,7 @@ namespace BansheeEngine
 		BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_VertexBuffer);
 		BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_VertexBuffer);
 	}
 	}
 
 
-	void* VulkanVertexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options)
+	void* VulkanVertexBufferCore::map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 syncMask)
 	{
 	{
 #if BS_PROFILING_ENABLED
 #if BS_PROFILING_ENABLED
 		if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
 		if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
@@ -36,18 +36,19 @@ namespace BansheeEngine
 
 
 	}
 	}
 
 
-	void VulkanVertexBufferCore::readData(UINT32 offset, UINT32 length, void* dest)
+	void VulkanVertexBufferCore::readData(UINT32 offset, UINT32 length, void* dest, UINT32 syncMask)
 	{
 	{
 		BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_VertexBuffer);
 		BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_VertexBuffer);
 	}
 	}
 
 
-	void VulkanVertexBufferCore::writeData(UINT32 offset, UINT32 length, const void* source, BufferWriteType writeFlags)
+	void VulkanVertexBufferCore::writeData(UINT32 offset, UINT32 length, const void* source, BufferWriteType writeFlags, 
+		UINT32 syncMask)
 	{
 	{
 		BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_VertexBuffer);
 		BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_VertexBuffer);
 	}
 	}
 
 
 	void VulkanVertexBufferCore::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset,
 	void VulkanVertexBufferCore::copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset,
-		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer)
+		UINT32 dstOffset, UINT32 length, bool discardWholeBuffer, UINT32 syncMask)
 	{
 	{
 
 
 	}
 	}