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

Fixed DX11 hardware buffer write so it properly handles offset when writing

Marko Pintera 11 лет назад
Родитель
Сommit
c17b562a7e

+ 19 - 1
BansheeD3D11RenderSystem/Source/BsD3D11HardwareBuffer.cpp

@@ -276,7 +276,25 @@ namespace BansheeEngine
 		}
 		}
 		else if(mDesc.Usage == D3D11_USAGE_DEFAULT)
 		else if(mDesc.Usage == D3D11_USAGE_DEFAULT)
 		{
 		{
-			mDevice.getImmediateContext()->UpdateSubresource(mD3DBuffer, 0, nullptr, pSource, offset, length);
+			if (mBufferType == BT_CONSTANT)
+			{
+				assert(offset == 0);
+
+				// Constant buffer cannot be updated partially using UpdateSubresource
+				mDevice.getImmediateContext()->UpdateSubresource(mD3DBuffer, 0, nullptr, pSource, 0, 0);
+			}
+			else
+			{
+				D3D11_BOX dstBox;
+				dstBox.left = (UINT)offset;
+				dstBox.right = (UINT)offset + length;
+				dstBox.top = 0;
+				dstBox.bottom = 1;
+				dstBox.front = 0;
+				dstBox.back = 1;
+
+				mDevice.getImmediateContext()->UpdateSubresource(mD3DBuffer, 0, &dstBox, pSource, 0, 0);
+			}
 		}
 		}
 		else
 		else
 		{
 		{

+ 1 - 4
BansheeUtility/Source/BsTaskScheduler.cpp

@@ -184,9 +184,6 @@ namespace BansheeEngine
 			return true;
 			return true;
 
 
 		// Otherwise we go by smaller id, as that task was queued earlier than the other
 		// Otherwise we go by smaller id, as that task was queued earlier than the other
-		if(lhs->mTaskId < rhs->mTaskId)
-			return true;
-
-		BS_EXCEPT(InternalErrorException, "Found two identical tasks.");
+		return lhs->mTaskId < rhs->mTaskId;
 	}
 	}
 }
 }

+ 1 - 3
SceneView.txt

@@ -1,8 +1,6 @@
 
 
  GIZMO TODO:
  GIZMO TODO:
-  - Figure out how to deal with builtin components like Camera and Renderable (e.g. how will they have gizmos since they're not managed components?)
-    - Make those two a non-component types. Anywhere they are used in the Renderer they should just be passed as pointers.
-	- Then make a Component wrapper around the non-component types, and also a C# wrapper around the same types
+  - Make a C# wrapper for Camera and Renderable
 
 
 REFACTOR material getParams* and related classes. Those params should update all gpu program params that share that variable, not just the first found
 REFACTOR material getParams* and related classes. Those params should update all gpu program params that share that variable, not just the first found
 Add a way to render GUI image without alpha
 Add a way to render GUI image without alpha