Hello,
I am trying to speed up a D3D11 graphics engine I am working on by limiting the amount of DrawIndexedInstanced() calls.
My newly modified code only does a DrawIndexedInstanced() when A) a buffer is filled up B) an object has changed or C) there are no more objects to render.
The pseudo code would be like this...
{
loop (objects)
{
if (new-object OR buffer-filled)
{
// A
IASetInputLayout()
IASetVertexBuffers()
DrawIndexedInstanced()
hresult = Map (D3D11_MAP_WRITE_DISCARD)
}
else
{
// B
hresult = Map (D3D11_MAP_WRITE_NO_OVERWRITE)
}
memcpy buffer
UnMap
}
// no more objects
IASetInputLayout()
IASetVertexBuffers()
DrawIndexedInstanced()
}
I am currently rendering two different sized objects into a small window.
Everything appears to be rendering correctly if I capture a frame via the Graphics debugger; I see both objects.
The problem is that only one object is actually being displayed within the small window...that is *until* I use the mouse to press the windows title bar (or press prtscr).
When I do the second object appears (rendered correctly). When I release the mouse the second object disappears again.
It appears that when you grab the caption the DX application is paused until the mouse is released. If both objects share the same buffer could this be causing an issue; where the pause allows more time for it to be processed? Has anyone got any ideas whats happening?
Thank you