• Advertisement
Sign in to follow this  

how to write a multipass shader in HLSL

This topic is 4436 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

Folks, I am writing a a little complicated shader. I am running out of instruction limit imposed by PS2.0. I need to break my shader into multiple passes, first pass doing something and saving its output to somewhere and the second pass reading the output generated by first pass and so on. Can anybody point me to a some sample code somewhere, where I can see how this is done? Are static variables supported in PS2.0? Thanks -Rahul

Share this post


Link to post
Share on other sites
Advertisement
Check out the render-to-texture samples in the SDK - there are several of them. PostProcess, HDRDemo and HDRLighting to name a few [smile]

The basic idea is that, in your first pass, you output to a render-target texture and in the second pass you use that same texture as an input and sample from it as appropriate.

You might also want to look into the effects framework - a 'technique' in an effect file is defined in terms of a number of passes.

hth
Jack

Share this post


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

  • Advertisement