Pipeline Configuration for Post-Processing Shaders

Started by
3 comments, last by markypooch 9 years, 9 months ago

Hello all,

This is a new concept for me, so I apologize if I come across as short-sighted or noobish,

I am writing a post-process shader that will take a scene that has been rendered to a texture and blur it.

Since this blur shader only operates on the texture, there is no need for a Vertex Shader.

So, How do I configure the Pipeline?

I know with a typical effect, you usually have two shaders, a Vertex Shader and a Pixel Shader.

So I would prime the API like so,

d3dContext->IASetInputLayout("Parameters");

d3dContext->IASetIndexBuffer("Parameters");

d3dContext->IASetVertexBuffer("Parameters");

d3dContext->IASetPrimitiveTopology("Parameters");

d3dContext->VSSetShader();

d3dContext->PSSetShader();

///////////////////////////////////////////////////////////////////////////

//Binding of worldViewProj Matrices and assests to their respective Constant Buffers

////////////////////////////////////////////////////////////////////////////

And then eventually,

d3dContext->draw || d3dContext->DrawIndexed();

But with only a pixel shader, I would only need to do this, maybe?

d3dContext->IASetInputLayout("Parameters");

d3dContext->PSSetShader();

d3dContext->PSSetShaderResources();

d3dContext->Draw();

But what would I be drawing! If I don't have a vertex shader I don't need to submit a vertex or index buffer. Nor any of the corresponding matrices.

If I don't have a VertexBuffer submitted to D3D, I wouldn't expect the draw call to do anything.

But if I don't make this call: d3dContext->Draw();

How is this shader to be executed?

I guess i'm asking is how to execute a post-process shader or point me if possible in the right direction for learning how to utilize post-process shaders

Thansk for any replies!

Marcus

Advertisement
You still need a vertex shader - the geometry is a quad or triangle that covers your entire screen!

To work without any geometry at all, you'd use a compute shader instead of a pixel shader, an Dispatch instead of Draw.

You still need a vertex shader - the geometry is a quad or triangle that covers your entire screen!

To work without any geometry at all, you'd use a compute shader instead of a pixel shader, an Dispatch instead of Draw.

tongue.png It's been a looooong day.

I knew better, thank you so much.

Marcus

Drawing without a vertex buffer is a common idiom for fullscreen quads. See Using the Input-Assembler Stage without Buffers on MSDN for a description and sample code.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

Drawing without a vertex buffer is a common idiom for fullscreen quads. See Using the Input-Assembler Stage without Buffers on MSDN for a description and sample code.

Very informative. So Really for my simple Post-Process Shader, I can pretty much skip Buffer submission to D3D and just define my quad in the Vertex Shader...I Like it!

I guess my orginal thought regarding Post-Processing is more akin to utilitizing a Compute Shader (Don't know why at the time I thought no Geometry would be involved, It was a looooong day yesterday!)

Thanks for the replies, and sorry for the newebish question. it did give me some interesting ideas!

Marcus

This topic is closed to new replies.

Advertisement