Sign in to follow this  
SteveDeFacto

Multipass shaders in CG?

Recommended Posts

SteveDeFacto    109
I'm trying to improve my blur shader and I found out that I'm going to need to use two passes one for the horizontal axis and one for the vertical axis. This would be very easy in HLSL but I'm not sure how to do passes on the fragment shader in CG. Is there a way I can do it without having to render to my full screen quad twice?

Share this post


Link to post
Share on other sites
Hodgman    51231
Cg and HLSL are essentially the same thing... What makes it easy in HLSL but hard in Cg?

If I was using either of them (or even GL+GLSL) I would render the quad twice -- if this is for a separable blur, then each pass needs different texture inputs and a different render-target anyway, which means you [i]have[/i] to render the quad twice.

Share this post


Link to post
Share on other sites
SteveDeFacto    109
[quote name='Hodgman' timestamp='1313034525' post='4847495']
Cg and HLSL are essentially the same thing... What makes it easy in HLSL but hard in Cg?

If I was using either of them (or even GL+GLSL) I would render the quad twice -- if this is for a separable blur, then each pass needs different texture inputs and a different render-target anyway, which means you [i]have[/i] to render the quad twice.
[/quote]

I suppose you are right. I was thinking of the technique class but I guess in the end it's the same thing.

Share this post


Link to post
Share on other sites
Hodgman    51231
If you do need them, [font="'Courier New"]technique[/font]s and [font="'Courier New"]pass[/font]es aren't part of HLSL or Cg --- they're part of the DirectX FX format and the CGFX format, which means you can use them either via DirectX or via the Cg runtime.

Share this post


Link to post
Share on other sites
SteveDeFacto    109
[quote name='Hodgman' timestamp='1313049151' post='4847538']
If you do need them, [font="Courier New"]technique[/font]s and [font="Courier New"]pass[/font]es aren't part of HLSL or Cg --- they're part of the DirectX FX format and the CGFX format, which means you can use them either via DirectX or via the Cg runtime.
[/quote]

Really there is a CGFX format?! Awesome I didn't even know that! [img]http://public.gamedev.net/public/style_emoticons/default/laugh.gif[/img]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this