Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to make a simple post processing pipeline, depicted as follows with 3 effects in this case:

        |------|    |------|    |------|
   I -->|Shader|-O->|Shader|-I->|Shader|-O->
        |------|    |------|    |------|

I and O stand for a pair of 2 ShaderResourceViews/RenderTargetViews.

My plan was to do the following:

  1. Create a shader resource and render target for each the input and the output
  2. Apply the shader
  3. Swap input and output to be used for the next shader
  4. Goto 2.

This sounds somewhat confusing, but basically the same 2 ShaderResourceViews /RenderTargetViews should be reused for each stage of the post processing pipeline.

Is this possible, or do I have to create separate input and output ShaderResourceViews /RenderTargetViews for each stage of the postprocessing pipeline?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You'll need to create the textures with both the D3D11_BIND_RENDER_TARGET and D3D11_BIND_SHADER_RESOURCE bind flags, and you must take care to unbind them from their previous assignment before swapping them, but it should work fine.

Also, make sure the format you want to use is listed in the supported render target formats, and not listed in the formats not supported for Texture2D here: http://msdn.microsoft.com/en-us/library/windows/desktop/ff471325(v=vs.85).aspx

share|improve this answer
    
it's the second time you help me, thanks a lot! –  pivotnig Jan 26 '13 at 19:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.