"The survival of liberty in our land increasingly depends on the success of liberty in other lands. The best hope for peace in our world is the expansion of freedom in all the world."
- George W. Bush
More pages: 1 2 3 4 5 6 7
New dynamic brancing demo
Thursday, July 1, 2004 | Permalink

Here's a demo that does dynamic branching, without the need for pixel shader 3.0, and still receives the huge performance boost that pixel shader 3.0 dynamic branching supposedly gives when utilized in a similar fashion.

Enjoy!


2004-07-03:
Since it seems people have lost the ability to understand smilies I removed the first line of this post. Couldn't have imagined that people would feel so seriously offended by it, and I certainly didn't foresee the amount of crap I would recieved for it.

2004-07-04: Did a minor update to the demo to work around the performance drop issue on nVidia cards. The demo will now let you choose between doing a full stencil clear or simply zero it for surviving fragment. The former method seems to be required for this technique to see any performance gains at all on nVidia hardware, while both methods run fast on ATI card, the latter at a higher speed though. In order to get maximum performance it will choose zeroing as default for ATI and full stencil clear on everyone else. I don't know if that assumption holds true for other vendors though.

Name

Comment

Enter the code below



strop
Sunday, July 4, 2004

Humus, I would like to ask you if this technique can be used automatically in a future HLSL compiler. I mean: it's possible that a 'if statement for dynamic branching' can always be replaced in the way you have done, when a programmer compiles with SM < 3.0 profile?

NeoKenobi
Sunday, July 4, 2004

I totally agree with your last post Humus. It's sad to see that some people seem to be unable to tell the difference between a joke and a serious statement. I think those hardcore fanboys are just so blinded by the "love" for their own company that they can't participate in an objective discussion. I don't say that it isn't good to support a company, but you must be able to look at the facts.

Humus
Sunday, July 4, 2004

strop,
Unfortunately that's not possible. Shaders doesn't carry any render state attributes. You could however if you're writing a game engine bake it into your own scripting language.

GianT
Monday, July 5, 2004

It's just soooooooooo sad not to have enough money to buy the latest ATI graphics chipsets 8-(
Whatever, keep us updated and go on with all this good work !
And please, don't forget OpenGL ;-)
Have fun and work hard !

Dig
Monday, July 5, 2004

Hey Humus, got any popcorn around this joing?

sqrt[-1]
Monday, July 5, 2004

Re the fullscreen clear update:
Instead of clearing the stencil buffer for each light could you not just increment the stencil reference value?
(ie use
dev->SetRenderState(D3DRS_STENCILREF, i+1);
instead of
dev->SetRenderState(D3DRS_STENCILREF, 1);

(or is there something going on that I am missing? (only allowing 255 lights etc?))

Anonymous
Monday, July 5, 2004

Something offtopic: It's very useful that the last comment is displayed on the main page!

Humus
Tuesday, July 6, 2004

sqrt[-1],
that's a pretty good idea. Works just fine. Doesn't speed things up noticable though, but it may help on nVidia cards I guess if they can skip clearing between lights.

Anonymous,
yeah, I'm pretty happy with it. Makes things a bit more convenient, and less chance to miss a comment.

More pages: 1 2 3 4 5 6 7