Sign in to follow this  
6666662000

question about preshader

Recommended Posts

Hi,all! I'm reading the topic"Using an Effect",it refers to a Improve Performance with Preshaders. Can I see the result of preshader? either I use fxc to compile the shader with /Od or not, the output results is the same.Did it means the optimizations is inside,I can't see?

Share this post


Link to post
Share on other sites
hi,

Quote:
A preshader is a technique for increasing shader efficiency by pre-calculating constant shader expressions. The effect compiler automatically pulls out shader computations from the body of a shader and executes them on the CPU prior to the shader running.
Yes, the purpuse of the preshader is to increase speed transparently. It would be bad if you could recognize differences because of an optimization, right? [smile]

kp

Share this post


Link to post
Share on other sites
You'll only see a performance increase from preshaders if your application is vertex-shader or [sometimes] shader constant bound. This is because some work is taken from the GPU and given to the CPU.

If your application is CPU bound, you will actually see a performance decrease because you're giving more work to an already overworked CPU. In this case, the GPU is likely sat idle a lot of the time.

If your application is bound by something else, such as fillrate, then you won't see any big difference in performance with/without preshaders.


Your performance is capped by whatever is your biggest bottleneck, [premature] optimization of things that aren't bottlenecks won't lead to any significant performance increases (if any at all).


Recipe for good performance:
1)make it work [v.little point in tuning something that's unfinished],
2)profile it to find the biggest bottleneck [PIX & co. are your friends],
3)optimize that bottleneck [e.g. use preshaders if it's vertex shader],
4)goto 1

Share this post


Link to post
Share on other sites
Quote:
Original post by 6666662000
Quote:
2)profile it to find the biggest bottleneck [PIX & co. are your friends],

what is co.?

Co. is short for Company. He was just meaning PIX and other applications like it. Intel's VTune, for example, is a very good CPU application profiler.

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