WinRT: added code to update the main texture on each frame with dummy data
authorDavid Ludwig <dludwig@pobox.com>
Wed, 21 Nov 2012 17:38:17 -0500
changeset 8349 020b8b65bcfc
parent 8348 7cdcd6d28c85
child 8350 ecc8c88ed82e
WinRT: added code to update the main texture on each frame with dummy data
src/video/windowsrt/SDL_winrtrenderer.cpp
--- a/src/video/windowsrt/SDL_winrtrenderer.cpp	Wed Nov 21 17:19:16 2012 -0500
+++ b/src/video/windowsrt/SDL_winrtrenderer.cpp	Wed Nov 21 17:38:17 2012 -0500
@@ -178,6 +178,30 @@
 		return;
 	}
 
+	// Update the main texture (for SDL usage):
+	D3D11_MAPPED_SUBRESOURCE textureMemory = {0};
+	DX::ThrowIfFailed(
+		m_d3dContext->Map(
+			m_mainTexture.Get(),
+			0,
+			D3D11_MAP_WRITE_DISCARD,
+			0,
+			&textureMemory)
+		);
+
+	const int max = (int)m_windowBounds.Width * (int)m_windowBounds.Height * 4;
+	uint8 * buf = (uint8 *)textureMemory.pData;
+	for (int i = 0; i < max; i += 4) {
+		buf[i+0] = 0x00;
+		buf[i+1] = 0xFF;
+		buf[i+2] = 0x00;
+		buf[i+3] = 0xFF;
+	}
+
+	m_d3dContext->Unmap(
+		m_mainTexture.Get(),
+		0);
+
 	m_d3dContext->OMSetRenderTargets(
 		1,
 		m_renderTargetView.GetAddressOf(),