Conditional returns

Is there a way to do conditional returns in fragment programs?

It keeps telling me the profile doesn’t support it.

It seems silly that I can’t bail out of the fragment program if I’m processing a fragment that was rasterized from a back facing polygon.

Thanks.

What exactly doesn’t work on which hardware?

It seems silly that I can’t bail out of the fragment program if I’m processing a fragment that was rasterized from a back facing polygon.
I question your intent.

Backfacing polygons are normally culled by backface culling. That is, they don’t get rasterized anyway.

However, you can rasterize back-facing polygons if you disable backface culling.

But then, why would want to allow backfacing polygons, and then kill all the fragments there? Just enable backface culling and be done with it.

My bad, didn’t realize that back facing fragments were cut at the rasterization step. I guess it’s ok then.

The problem stands however,

I have an NV 6800 GT…says profile doesn’t support conditional returns in fragment programs.

whatever, it’s not the end of the world I suppose.

Why not use “discard”?

Or better, just place the remaining part of the shader in an else-clause.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.