locked
CompositionTarget::Rendering not hit if using GPU picking

    Question

  • Hi,

    I've got a strange problem with my DirectX/XAML Windows Store app.

    Basically I use the CompositionTarget::Rendering event to do my rendering and this works fine.

    I have also implemented GPU picking (giving each model a different color based on an ID number) because it is much faster than ray-trace picking.

    My problem is, I want to be able to "draw" my finger using OnPointerMoved while GPU picking but GPU picking seems to stop the CompositionTarget::Rendering event to be fired.

    If I comment out my GPU picking code while moving my finger on the screen, CompositionTarget::Rendering gets hit everytime but the moment I try GPU picking again it doesn't fire.

    I assume it is something to do with the fact I am rendering a frame with different vertex and pixel shaders for my GPU picking to work and that is somehow telling CompositionTarget::Rendering not to fire.

    Through trial and error of selectively commenting lines out etc., I have found which line is stopping it happening:

            d3dDeviceContext->Map(t, 0, D3D11_MAP_READ, 0, &msr);

    Where t is an ID3D11Texture2D and msr is a D3D11_MAPPED_SUBRESOURCE.

    So in short, while OnPointerMoved() is being hit I want my geometry to keep rendering but when I have GPU picking turned on and we hit this Map() line, it stops CompositionTarget::Rendering from being fired and therefore rendering halts until I lift my finger and OnPointerMoved() stops being called and in turn stops calling my GPU Picking.

    Does anyone know why it is happening here and how to fix this?

    Thanks in advance for your time.


    • Edited by ponchoshh Friday, July 26, 2013 8:54 AM
    Thursday, July 25, 2013 6:01 PM