I wanna render an image to a texture taking advantage of DirectX acceleration. But instead of showing that image on the screen, I wanna get this image back to the regular memory as a bitmap to do anything with the result. How do I transfer some texture to the regular memory? I am using DirectX 11.
Asked
Active
Viewed 5,633 times
1
-
1You can find the same problem, and the solution, [here](http://stackoverflow.com/questions/4120108/how-to-save-backbuffer-to-file-in-directx-10). You only need to use DirectX 11 version instead of 10. – enigma Dec 12 '12 at 15:09
-
almost there... In fact I want to have ACCESS to the pixels. D3DX10SaveTextureToFile() does it in background of course. But I wanna know how to do it by myself. I think it's something related to Map/Unmap of resources(DX10/DX11), but I couldn't find anything that really works! :-( – Wagner Patriota Dec 17 '12 at 20:49
1 Answers
2
You can use a seperate "staging" texture which has cpu read access. Than copy your rendertarget texture to this staging texture with CopySubresource() or CopyResource() an perform Map() to this staging texture.
--> http://msdn.microsoft.com/en-us/library/windows/desktop/ff476259(v=vs.85).aspx

sandicz
- 326
- 3
- 9
-
Oh, I saw that's the solution in the comments above... I used this several times and it works. Whats your problem with Map/Unmap? – sandicz Dec 19 '12 at 09:30
-
Any suggestions on how to do it in DirectX 12? It seems that many memory related things have changed there :( – Dimitri Podborski Jan 22 '20 at 11:35