locked
Apply a pixel shader to a single texture in a scene?

    Question

  • I am trying to render a few layers of content on my screen - specifically - some image, a couple of video frames transferred to my swapchain texture using IMFMediaEngine::TransferVideoFrame(), maybe some sprites. I need to apply a pixel shader to only one of these layers. How can I do it? It seems like if I want to use a pixel shader - I need to call ID3D11DeviceContext::PSSetShader, but this applies globally to the device and not a texture (which is something I guess I am used to being a spoiled WPF developer), so I guess I need to somehow switch a texture the device is rendering to for the time I am going to apply that shader and then somehow copy that texture to the swapchain, but I am not really sure how to get there.

    I am also worried that my pipeline that does all the rendering on a vsync event will take too much time resulting in some tearing if I spend too much time running shaders and copying bitmaps...


    Filip Skakun

    Monday, March 26, 2012 5:28 PM

Answers

All replies

  • Hello ,
    Thank you for your question.
    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
    Thank you for your understanding and support.
    Yi

    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, March 27, 2012 9:44 AM
  • Thanks for looking into this.

    Filip Skakun

    Tuesday, March 27, 2012 4:08 PM
  • Hello Filip,

    I'm just trying to get caught up. Are you still having problems with affecting a pixel shader on your video? If you still need help on this please let me know and I will see what I can do to help.

    Thanks,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Thursday, April 05, 2012 11:52 PM
    Moderator
  • Yes, I do and thanks for checking.

    Filip Skakun

    Friday, April 06, 2012 12:51 AM
  • Hey Filip,

    I *think* what you are looking to do is use a ID3D11ShaderResourceView and assign your texture to it. Check out the following links for more information. I know that this isn't necessarily a great answer but as you have found working with shaders is extremely complex notion. We are certainly trying to make it easier in VS 11 though.

    If you did through these links and still don't have a good solution let me know and we can work together to figure this out.

    How to: Create a Basic Texture Shader
    http://msdn.microsoft.com/en-us/library/windows/apps/hh315732(v=vs.110).aspx

    How to: Apply a Shader to a 3-D Model
    http://msdn.microsoft.com/en-us/library/windows/apps/hh315739(v=vs.110).aspx

    Assembling the rendering framework - Shows how to use ID3D11ShaderResourceView
    http://msdn.microsoft.com/en-us/library/windows/apps/Hh780565.aspx

    ID3D11ShaderResourceView
    http://msdn.microsoft.com/en-us/library/windows/apps/ff476628.aspx

    I hope this helps,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Saturday, April 07, 2012 12:57 AM
    Moderator
  • Thanks, I understand this is step-by-step learning. I think these should let me move me forward in my research.

    Filip Skakun

    Saturday, April 07, 2012 1:48 AM