Original Post
leaving the fact that copying data from the GPU to the CPU is a bottle-neck, I do have enough processing power to make things run with a dual processor PC.
However, I do have another complication. I have two renderviews. One of an observers point of view, looking at the robotic vehicle, and one view with the POV of the robotic vehicle. It is the latter view that I need to send to my vision software at 5Hz.
I have two threads, one where I render the observer''s view at 20Hz, and the other which renders the robot''s POV. I am sharing the Directx device thru a critical region. All works fine when I just render the view, and I don''t do any image copy of the robot''s view from GPU to CPU.
However, since that my observer''s view is running at 4 times the speed as my robot''s view, I want the robot''s view rendering kept at minimum, such that the observer''s view doesn''t have to wait to long when the robot''s view rendering is using the Directx Device. At least, not noticable-long.
So I want to do the copying of the robot''s view to the CPU memory after I leave the critical region (i.e. after I have presented my robot''s view).
The robot''s view is rendered on an aditional swap chain. And initially I had something like this pseudo code:
1 set render code to swapchain back buffer
2 render scene
3 copy back buffer
4 present
4 access copied backbuffer image bytes, and copy over to CPU
but that doesn''t work. I assume that after presenting the backbuffer to the front, I cannot access that data anymore.
So I modified my code like this
1 create offscreenplainbuffer
2 set render target to offscreen buffer
3 render
4 copy the offscreen buffer to backbuffer using UpdateSurface
5 present
6 access offscreen buffer image bytes, and copy over to CPU
But that doesnt work either, the image I created is all black.
Is my logic flawed? did I miss something?
Cheers
Bart