Jump to content
  • Advertisement
Sign in to follow this  
collie

Rendered object not becoming visible until mouse-press

This topic is 639 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Edited by collie

Share this post


Link to post
Share on other sites
Advertisement

If anyone is interested the error appeared to arise from the order I was calling the different Map's.

Previously it was calling the Maps in the order of...

 

D3D11_MAP_WRITE_NO_OVERWRITE <- Obj 1

D3D11_MAP_WRITE_DISCARD      <- Obj 2

 

Simply switching them around allowed both objects to render correctly.

I'm still unsure why pressing the mouse or prtscr allowed the rendering to be correct; but at least it works now.

 

Thank you.

Edited by collie

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!