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 8349020b8b65bcfc
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
     1.1 --- a/src/video/windowsrt/SDL_winrtrenderer.cpp	Wed Nov 21 17:19:16 2012 -0500
     1.2 +++ b/src/video/windowsrt/SDL_winrtrenderer.cpp	Wed Nov 21 17:38:17 2012 -0500
     1.3 @@ -178,6 +178,30 @@
     1.4  		return;
     1.5  	}
     1.6  
     1.7 +	// Update the main texture (for SDL usage):
     1.8 +	D3D11_MAPPED_SUBRESOURCE textureMemory = {0};
     1.9 +	DX::ThrowIfFailed(
    1.10 +		m_d3dContext->Map(
    1.11 +			m_mainTexture.Get(),
    1.12 +			0,
    1.13 +			D3D11_MAP_WRITE_DISCARD,
    1.14 +			0,
    1.15 +			&textureMemory)
    1.16 +		);
    1.17 +
    1.18 +	const int max = (int)m_windowBounds.Width * (int)m_windowBounds.Height * 4;
    1.19 +	uint8 * buf = (uint8 *)textureMemory.pData;
    1.20 +	for (int i = 0; i < max; i += 4) {
    1.21 +		buf[i+0] = 0x00;
    1.22 +		buf[i+1] = 0xFF;
    1.23 +		buf[i+2] = 0x00;
    1.24 +		buf[i+3] = 0xFF;
    1.25 +	}
    1.26 +
    1.27 +	m_d3dContext->Unmap(
    1.28 +		m_mainTexture.Get(),
    1.29 +		0);
    1.30 +
    1.31  	m_d3dContext->OMSetRenderTargets(
    1.32  		1,
    1.33  		m_renderTargetView.GetAddressOf(),