WinRT: added code to update the main texture on each frame with dummy data

This commit is contained in:
David Ludwig 2012-11-21 17:38:17 -05:00
parent e5b56efc86
commit 4686ec5943

View file

@ -178,6 +178,30 @@ void SDL_winrtrenderer::Render()
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(),