Parcourir la source

Started work on DX11 sub-region Clear

Marko Pintera il y a 12 ans
Parent
commit
78d44de269

+ 2 - 0
CamelotD3D11RenderSystem/CamelotD3D11RenderSystem.vcxproj

@@ -252,6 +252,7 @@
     <ClInclude Include="Include\CmD3D11MultiRenderTexture.h" />
     <ClInclude Include="Include\CmD3D11MultiRenderTexture.h" />
     <ClInclude Include="Include\CmD3D11GpuParamBlockBuffer.h" />
     <ClInclude Include="Include\CmD3D11GpuParamBlockBuffer.h" />
     <ClInclude Include="Include\CmD3D11Prerequisites.h" />
     <ClInclude Include="Include\CmD3D11Prerequisites.h" />
+    <ClInclude Include="Include\CmD3D11RenderUtility.h" />
     <ClInclude Include="Include\CmD3D11TextureView.h" />
     <ClInclude Include="Include\CmD3D11TextureView.h" />
     <ClInclude Include="Include\CmD3D11VertexBuffer.h" />
     <ClInclude Include="Include\CmD3D11VertexBuffer.h" />
     <ClInclude Include="Include\CmD3D11RasterizerState.h" />
     <ClInclude Include="Include\CmD3D11RasterizerState.h" />
@@ -288,6 +289,7 @@
     <ClCompile Include="Source\CmD3D11InputLayoutManager.cpp" />
     <ClCompile Include="Source\CmD3D11InputLayoutManager.cpp" />
     <ClCompile Include="Source\CmD3D11Mappings.cpp" />
     <ClCompile Include="Source\CmD3D11Mappings.cpp" />
     <ClCompile Include="Source\CmD3D11Plugin.cpp" />
     <ClCompile Include="Source\CmD3D11Plugin.cpp" />
+    <ClCompile Include="Source\CmD3D11RenderUtility.cpp" />
     <ClCompile Include="Source\CmD3D11TextureView.cpp" />
     <ClCompile Include="Source\CmD3D11TextureView.cpp" />
     <ClCompile Include="Source\CmD3D11VertexBuffer.cpp" />
     <ClCompile Include="Source\CmD3D11VertexBuffer.cpp" />
     <ClCompile Include="Source\CmD3D11MultiRenderTexture.cpp" />
     <ClCompile Include="Source\CmD3D11MultiRenderTexture.cpp" />

+ 6 - 0
CamelotD3D11RenderSystem/CamelotD3D11RenderSystem.vcxproj.filters

@@ -123,6 +123,9 @@
     <ClInclude Include="Include\CmD3D11GpuParamBlockBuffer.h">
     <ClInclude Include="Include\CmD3D11GpuParamBlockBuffer.h">
       <Filter>Header Files</Filter>
       <Filter>Header Files</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\CmD3D11RenderUtility.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\CmD3D11GpuProgram.cpp">
     <ClCompile Include="Source\CmD3D11GpuProgram.cpp">
@@ -227,5 +230,8 @@
     <ClCompile Include="Source\CmD3D11GpuParamBlockBuffer.cpp">
     <ClCompile Include="Source\CmD3D11GpuParamBlockBuffer.cpp">
       <Filter>Source Files</Filter>
       <Filter>Source Files</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\CmD3D11RenderUtility.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 1 - 0
CamelotD3D11RenderSystem/Include/CmD3D11Prerequisites.h

@@ -52,6 +52,7 @@ namespace CamelotFramework
 	class D3D11DepthStencilState;
 	class D3D11DepthStencilState;
 	class D3D11InputLayoutManager;
 	class D3D11InputLayoutManager;
 	class D3D11GpuBuffer;
 	class D3D11GpuBuffer;
+	class D3D11RenderUtility;
 
 
 	enum TypeID_D3D11
 	enum TypeID_D3D11
 	{
 	{

+ 34 - 0
CamelotD3D11RenderSystem/Include/CmD3D11RenderUtility.h

@@ -0,0 +1,34 @@
+#pragma once
+
+#include "CmD3D11Prerequisites.h"
+#include "CmModule.h"
+
+namespace CamelotFramework
+{
+	class D3D11RenderUtility : public Module<D3D11RenderUtility>
+	{
+	public:
+		D3D11RenderUtility(D3D11Device* device);
+		~D3D11RenderUtility();
+
+		void drawClearQuad(float clipLeft, float clipWidth, float clipTop, float clipHeight, UINT32 clearBuffers, const Color& color, float depth, UINT16 stencil);
+
+	protected:
+		D3D11Device* mDevice;
+
+		void initClearQuadResources();
+
+		ID3D11Buffer* mClearQuadIB;
+		ID3D11Buffer* mClearQuadVB;
+		ID3D11InputLayout* mClearQuadIL;
+		ID3D11VertexShader* mClearQuadVS;
+		ID3D11PixelShader* mClearQuadPS;
+
+		BlendStatePtr mClearQuadBlendState;
+		RasterizerStatePtr mClearQuadRasterizerState;
+		DepthStencilStatePtr mClearQuadDSState_NoD_NoS;
+		DepthStencilStatePtr mClearQuadDSState_YesD_NoS;
+		DepthStencilStatePtr mClearQuadDSState_YesD_YesS;
+		DepthStencilStatePtr mClearQuadDSState_NoD_YesS;
+	};
+}

+ 64 - 36
CamelotD3D11RenderSystem/Source/CmD3D11RenderSystem.cpp

@@ -20,6 +20,7 @@
 #include "CmD3D11GpuParamBlockBuffer.h"
 #include "CmD3D11GpuParamBlockBuffer.h"
 #include "CmD3D11InputLayoutManager.h"
 #include "CmD3D11InputLayoutManager.h"
 #include "CmD3D11HLSLProgram.h"
 #include "CmD3D11HLSLProgram.h"
+#include "CmD3D11RenderUtility.h"
 #include "CmGpuParams.h"
 #include "CmGpuParams.h"
 #include "CmCoreThread.h"
 #include "CmCoreThread.h"
 #include "CmDebug.h"
 #include "CmDebug.h"
@@ -129,6 +130,8 @@ namespace CamelotFramework
 
 
 		RenderWindowPtr primaryWindow = RenderWindow::create(mPrimaryWindowDesc);
 		RenderWindowPtr primaryWindow = RenderWindow::create(mPrimaryWindowDesc);
 
 
+		D3D11RenderUtility::startUp(cm_new<D3D11RenderUtility>(mDevice));
+
 		RenderSystem::initialize_internal(asyncOp);
 		RenderSystem::initialize_internal(asyncOp);
 
 
 		asyncOp.completeOperation(primaryWindow);
 		asyncOp.completeOperation(primaryWindow);
@@ -138,6 +141,8 @@ namespace CamelotFramework
 	{
 	{
 		THROW_IF_NOT_CORE_THREAD;
 		THROW_IF_NOT_CORE_THREAD;
 
 
+		D3D11RenderUtility::shutDown();
+
 		if(mIAManager != nullptr)
 		if(mIAManager != nullptr)
 		{
 		{
 			cm_delete(mIAManager);
 			cm_delete(mIAManager);
@@ -575,53 +580,76 @@ namespace CamelotFramework
 	{
 	{
 		THROW_IF_NOT_CORE_THREAD;
 		THROW_IF_NOT_CORE_THREAD;
 
 
-		// Clear render surfaces
-		if (buffers & FBT_COLOR)
+		if(clearArea.width > 0 && clearArea.height > 0)
 		{
 		{
-			UINT32 maxRenderTargets = mCurrentCapabilities->getNumMultiRenderTargets();
+			RenderTargetPtr oldRenderTarget = mActiveRenderTarget;
+			if(target != mActiveRenderTarget)
+				setRenderTarget(target);
 
 
-			ID3D11RenderTargetView** views = cm_newN<ID3D11RenderTargetView*, ScratchAlloc>(maxRenderTargets);
-			memset(views, 0, sizeof(ID3D11RenderTargetView*) * maxRenderTargets);
+			float invViewportWidth = 1.0f / (target->getWidth() * 0.5f);
+			float invViewportHeight = 1.0f / (target->getHeight() * 0.5f);
 
 
-			target->getCustomAttribute("RTV", views);
-			if (!views[0])
-			{
-				cm_deleteN<ScratchAlloc>(views, maxRenderTargets);
-				return;
-			}
+			float clipLeft = -1.0f + (clearArea.x * invViewportWidth);
+			float clipRight = -1.0f + ((clearArea.x + clearArea.width) * invViewportWidth);
 
 
-			float clearColor[4];
-			clearColor[0] = color.r;
-			clearColor[1] = color.g;
-			clearColor[2] = color.b;
-			clearColor[3] = color.a;
+			float clipTop = 1.0f - (clearArea.y * invViewportHeight);
+			float clipBottom = 1.0f - ((clearArea.y + clearArea.height) * invViewportHeight);
 
 
-			for(UINT32 i = 0; i < maxRenderTargets; i++)
-			{
-				if(views[i] != nullptr)
-					mDevice->getImmediateContext()->ClearRenderTargetView(views[i], clearColor);
-			}
+			D3D11RenderUtility::instance().drawClearQuad(clipLeft, clipRight - clipLeft, clipTop, clipBottom - clipTop, buffers, color, depth, stencil);
 
 
-			cm_deleteN<ScratchAlloc>(views, maxRenderTargets);
+			if(oldRenderTarget != mActiveRenderTarget)
+				setRenderTarget(oldRenderTarget);
 		}
 		}
-
-		// Clear depth stencil
-		if((buffers & FBT_DEPTH) != 0 || (buffers & FBT_STENCIL) != 0)
+		else
 		{
 		{
-			ID3D11DepthStencilView* depthStencilView = nullptr;
-			target->getCustomAttribute("DSV", &depthStencilView);
+			// Clear render surfaces
+			if (buffers & FBT_COLOR)
+			{
+				UINT32 maxRenderTargets = mCurrentCapabilities->getNumMultiRenderTargets();
 
 
-			D3D11_CLEAR_FLAG clearFlag;
+				ID3D11RenderTargetView** views = cm_newN<ID3D11RenderTargetView*, ScratchAlloc>(maxRenderTargets);
+				memset(views, 0, sizeof(ID3D11RenderTargetView*) * maxRenderTargets);
 
 
-			if((buffers & FBT_DEPTH) != 0 && (buffers & FBT_STENCIL) != 0)
-				clearFlag = (D3D11_CLEAR_FLAG)(D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL);
-			else if((buffers & FBT_STENCIL) != 0)
-				clearFlag = D3D11_CLEAR_STENCIL;
-			else
-				clearFlag = D3D11_CLEAR_DEPTH;
+				target->getCustomAttribute("RTV", views);
+				if (!views[0])
+				{
+					cm_deleteN<ScratchAlloc>(views, maxRenderTargets);
+					return;
+				}
 
 
-			if(depthStencilView != nullptr)
-				mDevice->getImmediateContext()->ClearDepthStencilView(depthStencilView, clearFlag, depth, (UINT8)stencil);
+				float clearColor[4];
+				clearColor[0] = color.r;
+				clearColor[1] = color.g;
+				clearColor[2] = color.b;
+				clearColor[3] = color.a;
+
+				for(UINT32 i = 0; i < maxRenderTargets; i++)
+				{
+					if(views[i] != nullptr)
+						mDevice->getImmediateContext()->ClearRenderTargetView(views[i], clearColor);
+				}
+
+				cm_deleteN<ScratchAlloc>(views, maxRenderTargets);
+			}
+
+			// Clear depth stencil
+			if((buffers & FBT_DEPTH) != 0 || (buffers & FBT_STENCIL) != 0)
+			{
+				ID3D11DepthStencilView* depthStencilView = nullptr;
+				target->getCustomAttribute("DSV", &depthStencilView);
+
+				D3D11_CLEAR_FLAG clearFlag;
+
+				if((buffers & FBT_DEPTH) != 0 && (buffers & FBT_STENCIL) != 0)
+					clearFlag = (D3D11_CLEAR_FLAG)(D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL);
+				else if((buffers & FBT_STENCIL) != 0)
+					clearFlag = D3D11_CLEAR_STENCIL;
+				else
+					clearFlag = D3D11_CLEAR_DEPTH;
+
+				if(depthStencilView != nullptr)
+					mDevice->getImmediateContext()->ClearDepthStencilView(depthStencilView, clearFlag, depth, (UINT8)stencil);
+			}
 		}
 		}
 	}
 	}
 
 

+ 231 - 0
CamelotD3D11RenderSystem/Source/CmD3D11RenderUtility.cpp

@@ -0,0 +1,231 @@
+#include "CmD3D11RenderUtility.h"
+#include "CmD3D11Device.h"
+#include "CmVector3.h"
+#include "CmColor.h"
+#include "CmRect.h"
+
+namespace CamelotFramework
+{
+	struct ClearVertex
+	{
+		Vector3 pos;
+		UINT32 col;
+	};
+
+	D3D11RenderUtility::D3D11RenderUtility(D3D11Device* device)
+		:mDevice(device), mClearQuadIB(nullptr), mClearQuadVB(nullptr), 
+		mClearQuadIL(nullptr), mClearQuadVS(nullptr), mClearQuadPS(nullptr)
+	{
+
+	}
+
+	D3D11RenderUtility::~D3D11RenderUtility()
+	{
+		SAFE_RELEASE(mClearQuadPS);
+		SAFE_RELEASE(mClearQuadVS);
+		SAFE_RELEASE(mClearQuadIL);
+		SAFE_RELEASE(mClearQuadIB);
+		SAFE_RELEASE(mClearQuadVB);
+
+		// TODO - Clear up all resources
+	}
+
+	void D3D11RenderUtility::drawClearQuad(float clipLeft, float clipWidth, float clipTop, float clipHeight, 
+		UINT32 clearBuffers, const Color& color, float depth, UINT16 stencil)
+	{
+		// TODO - Set up states
+		// TODO - Make sure to apply proper states depending on "clearBuffers" flags. Don't forget about stencil
+
+		// TODO - How smart it is to update buffer right before drawing it!? (cache the clip area)
+		ClearVertex vertexData[4];
+		vertexData[0].pos = Vector3(clipLeft, clipTop, depth);
+		vertexData[1].pos = Vector3(clipLeft + clipWidth, clipTop, depth);
+		vertexData[2].pos = Vector3(clipLeft, clipTop + clipHeight, depth);
+		vertexData[3].pos = Vector3(clipLeft + clipWidth, clipTop + clipHeight, depth);
+
+		vertexData[0].col = color.getAsBGRA();
+		vertexData[1].col = color.getAsBGRA();
+		vertexData[2].col = color.getAsBGRA();
+		vertexData[3].col = color.getAsBGRA();
+
+		mDevice->getImmediateContext()->UpdateSubresource(mClearQuadVB, 0, nullptr, vertexData, 0, sizeof(vertexData));
+
+		mDevice->getImmediateContext()->VSSetShader(mClearQuadVS, nullptr, 0);
+		mDevice->getImmediateContext()->PSSetShader(mClearQuadPS, nullptr, 0);
+
+		ID3D11Buffer* buffers[1];
+		buffers[0] = mClearQuadVB;
+
+		UINT32 strides[1] = { sizeof(ClearVertex) };
+		UINT32 offsets[1] = { 0 };
+
+		mDevice->getImmediateContext()->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+		mDevice->getImmediateContext()->IASetIndexBuffer(mClearQuadIB, DXGI_FORMAT_R16_UINT, 0);
+		mDevice->getImmediateContext()->IASetVertexBuffers(0, 1, buffers, strides, offsets);
+		mDevice->getImmediateContext()->IASetInputLayout(mClearQuadIL);
+
+		mDevice->getImmediateContext()->DrawIndexed(4, 0, 0);
+
+	}
+
+	void D3D11RenderUtility::initClearQuadResources()
+	{
+		String vsShaderCode = "										\
+						void main(									\
+						in float3 inPos : POSITION,					\
+						in float4 color : COLOR0,					\
+						out float4 oPosition : SV_Position,			\
+						out float4 oColor : COLOR0)					\
+						{											\
+							oPosition = float4(inPos.xyz, 1);		\
+							oColor = color;							\
+						}											\
+						";
+
+		String psShaderCode = "float4 ps_main(in float4 inPos : SV_Position, float4 color : COLOR) : SV_Target	\
+								{ return color; }";
+
+		HRESULT hr;
+		ID3DBlob* microcode = nullptr;
+		ID3DBlob* errors = nullptr;
+
+		// Compile pixel shader
+		hr = D3DCompile(psShaderCode.c_str(), psShaderCode.size(), nullptr, nullptr, nullptr, "main", "ps_4_0",
+			D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR, 0, &microcode, &errors);
+
+		if (FAILED(hr))
+		{
+			String message = "Cannot assemble D3D11 high-level shader. Errors:\n" +
+				String(static_cast<const char*>(errors->GetBufferPointer()));
+
+			SAFE_RELEASE(errors);
+			CM_EXCEPT(RenderingAPIException, message);
+		}
+
+		SAFE_RELEASE(errors);
+
+		hr = mDevice->getD3D11Device()->CreatePixelShader(static_cast<DWORD*>(microcode->GetBufferPointer()), 
+			microcode->GetBufferSize(), mDevice->getClassLinkage(), &mClearQuadPS);
+
+		if (FAILED(hr))
+		{
+			SAFE_RELEASE(microcode);
+			CM_EXCEPT(RenderingAPIException, "Cannot create D3D11 high-level shader.");
+		}
+
+		// Compile vertex shader
+		hr = D3DCompile(vsShaderCode.c_str(), vsShaderCode.size(), nullptr, nullptr, nullptr, "main", "vs_4_0",
+			D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR, 0, &microcode, &errors);
+
+		if (FAILED(hr))
+		{
+			String message = "Cannot assemble D3D11 high-level shader. Errors:\n" +
+				String(static_cast<const char*>(errors->GetBufferPointer()));
+
+			SAFE_RELEASE(errors);
+			CM_EXCEPT(RenderingAPIException, message);
+		}
+
+		SAFE_RELEASE(errors);
+
+		hr = mDevice->getD3D11Device()->CreateVertexShader(static_cast<DWORD*>(microcode->GetBufferPointer()), 
+			microcode->GetBufferSize(), mDevice->getClassLinkage(), &mClearQuadVS);
+
+		if (FAILED(hr))
+		{
+			SAFE_RELEASE(microcode);
+			CM_EXCEPT(RenderingAPIException, "Cannot create D3D11 high-level shader.");
+		}
+
+		// Create input layout
+		D3D11_INPUT_ELEMENT_DESC* declElements = cm_newN<D3D11_INPUT_ELEMENT_DESC, ScratchAlloc>(2);
+		ZeroMemory(declElements, sizeof(D3D11_INPUT_ELEMENT_DESC) * 2);
+
+		declElements[0].SemanticName			= "POSITION";
+		declElements[0].SemanticIndex			= 0;
+		declElements[0].Format					= DXGI_FORMAT_R32G32B32_FLOAT;
+		declElements[0].InputSlot				= 0;
+		declElements[0].AlignedByteOffset		= 0;
+		declElements[0].InputSlotClass			= D3D11_INPUT_PER_VERTEX_DATA;
+		declElements[0].InstanceDataStepRate	= 0;
+
+		declElements[1].SemanticName			= "COLOR";
+		declElements[1].SemanticIndex			= 0;
+		declElements[1].Format					= DXGI_FORMAT_R8G8B8A8_UNORM;
+		declElements[1].InputSlot				= 0;
+		declElements[1].AlignedByteOffset		= sizeof(float) * 3;
+		declElements[1].InputSlotClass			= D3D11_INPUT_PER_VERTEX_DATA;
+		declElements[1].InstanceDataStepRate	= 0;
+
+		hr = mDevice->getD3D11Device()->CreateInputLayout(declElements, 2, microcode->GetBufferPointer(), 
+			microcode->GetBufferSize(), &mClearQuadIL);
+
+		cm_deleteN<ScratchAlloc>(declElements, 2);
+
+		if (FAILED(hr))
+		{
+			CM_EXCEPT(RenderingAPIException, "Cannot create D3D11 input layout.");
+		}
+
+		// Create vertex buffer
+		D3D11_BUFFER_DESC mVBDesc;
+
+		mVBDesc.ByteWidth = sizeof(float) * 3 + sizeof(UINT32);
+		mVBDesc.MiscFlags = 0;
+		mVBDesc.StructureByteStride = 0;
+
+		mVBDesc.Usage = D3D11_USAGE_DEFAULT;
+		mVBDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; 
+		mVBDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+
+		ClearVertex vertexData[4];
+		vertexData[0].pos = Vector3(0, 0, 0);
+		vertexData[1].pos = Vector3(0, 0, 0);
+		vertexData[2].pos = Vector3(0, 0, 0);
+		vertexData[3].pos = Vector3(0, 0, 0);
+
+		vertexData[0].col = Color::White.getAsBGRA();
+		vertexData[1].col = Color::White.getAsBGRA();
+		vertexData[2].col = Color::White.getAsBGRA();
+		vertexData[3].col = Color::White.getAsBGRA();
+
+		D3D11_SUBRESOURCE_DATA vertexSubresourceData;
+		vertexSubresourceData.pSysMem = vertexData;
+
+		hr = mDevice->getD3D11Device()->CreateBuffer(&mVBDesc, &vertexSubresourceData, &mClearQuadVB);
+		if (FAILED(hr) || mDevice->hasError())
+		{
+			String msg = mDevice->getErrorDescription();
+			CM_EXCEPT(RenderingAPIException, "Cannot create D3D11 buffer: " + msg);
+		}
+
+		// Create index buffer
+		D3D11_BUFFER_DESC mIBDesc;
+
+		mIBDesc.ByteWidth = sizeof(UINT16) * 4;
+		mIBDesc.MiscFlags = 0;
+		mIBDesc.StructureByteStride = 0;
+
+		mIBDesc.Usage = D3D11_USAGE_DEFAULT;
+		mIBDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; 
+		mIBDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
+
+		UINT16 indexData[6];
+		indexData[0] = 0;
+		indexData[1] = 1;
+		indexData[2] = 2;
+		indexData[3] = 1;
+		indexData[4] = 3;
+		indexData[5] = 2;
+
+		D3D11_SUBRESOURCE_DATA indexSubresourceData;
+		indexSubresourceData.pSysMem = indexData;
+
+		hr = mDevice->getD3D11Device()->CreateBuffer(&mIBDesc, &indexSubresourceData, &mClearQuadIB);
+		if (FAILED(hr) || mDevice->hasError())
+		{
+			String msg = mDevice->getErrorDescription();
+			CM_EXCEPT(RenderingAPIException, "Cannot create D3D11 buffer: " + msg);
+		}
+	}
+}

+ 2 - 20
EditorWindowDock.txt

@@ -19,9 +19,6 @@ DockContainer biggest issues:
 
 
 FIRST CREATE DOCK CONTAINER WITHOUT DRAG AND DROP SUPPORT
 FIRST CREATE DOCK CONTAINER WITHOUT DRAG AND DROP SUPPORT
 
 
-RenderTexture issues:
- Set up a GUIViewport element which sets up a camera so it renders to that part of the window
-
 Make sure to test everything thoroughly - right now I have tested very little
 Make sure to test everything thoroughly - right now I have tested very little
 Drag and drop manager currently ignores the provided icon, but it should use it as a cursor
 Drag and drop manager currently ignores the provided icon, but it should use it as a cursor
 
 
@@ -29,26 +26,11 @@ Prevent docking if available size is less than 20 pixels, otherwise there might
 
 
 GUIViewport:
 GUIViewport:
  - MAJOR TODO - Don't forget to update GUIViewport is to also gets updated when only mesh is dirty!
  - MAJOR TODO - Don't forget to update GUIViewport is to also gets updated when only mesh is dirty!
- - Test DX11 and GL
- - Clear the viewport before rendering. (Add Viewport.requiresClear)
+ - In DX11 it is not possible to clear just a sub-region of a render target
 
 
 ------------------------
 ------------------------
 
 
 Other things to remember:
 Other things to remember:
  - Possibly add a way to have hidden widgets in the EditorWidgetContainer (like side-bars that pop on mouse over in Visual Studio)
  - Possibly add a way to have hidden widgets in the EditorWidgetContainer (like side-bars that pop on mouse over in Visual Studio)
  - A way to persist window states
  - A way to persist window states
- - Also a way to reset all widgets to original locations
-
-------------------------
-
-Some use cases:
- 1. User drags one of the tabs on EditorWindow and then drops it
-  - If user drags for N pixels the draged tab (and its EditorWidget) is removed from the EditorWindow and added to DragAndDropManager
-  - If user drops the window onto empty/unsupported element drag and drop manager "dropCallback" is executed and EditorWidget is restored in its own EditorWindow.
-  - If user drags the window over a title bar, drop positions get highlighted on the title bar
-    - If the user releases over the title bar, the window is added at the specified drop position
-  - If the user drags over an EditorWidget content area, semi-transparent drop areas are shown, and current area is highlighted
-    - Dropping the window in that area will split the available space between existng and new window contents
-
- 2. User organizes his windows and the quits and restarts the program
-  - TODO
+ - Also a way to reset all widgets to original locations