Sign in to follow this  
Scythen

Why use ps_1_1 over ps_2_0?

Recommended Posts

I should know this but I don’t [embarrass] I’ve seen several documents that say you should always use the lowest shader version possible. Sow why do ps_1_x shaders perform better than ps_2_x and ps_3_0 shaders?

Share this post


Link to post
Share on other sites
It's not that 1.1 performs better than 2.0, it's just supported on more cards. (And of course, 1.1 generally means simpler shaders, which does mean better performance)

But what that phrase really means is, well, just what it says. "Use the lowest shader version possible".
If you can implement the same shader in 1.1, 2.0 or 3.0, then why not make the 1.1 version, to allow it to run on as many cards as possible? If it can't be done with 1.1, then make it in 2.0, and if you need 3.0, then use that. It's not "use the lowest shader version in existence", but "use the lowest version possible for your shader". Just don't require SM3.0 for something that could be done in 1.1

Share this post


Link to post
Share on other sites
In addition, lower shader models have different implementation requirements, for example ps1.1 hw were allowed to store values in fixed-point (with a very limited range), so the hw could be optimized around it. If new hardware retains this kind of functionality, then it's probably indeed faster than a 2.0, floating point equivalent. ps1 also had a few modifiers that aren't present in newer shader models, so additional instructions can be avoided by cleverly using them.

All in all, it is quite possible for lower shader versions to run faster than an equivalent higher version one, assuming the hardware has a specialized path for them. Otherwise, it'd just "emulate" lower versions, so nothing would be gained. I I beleive, this is the reason for the advice in question.

(note that all of this apply only if the output is expected to be identical.)

Share this post


Link to post
Share on other sites
Ok, that makes sense.

I just found this (ChinaJoy2004_OptimizationAndTools.pdf) which seems to make the same point

Quote:

Do try to use the lowest pixel shader version available to
you. Basically, what this means is, if you're only doing 4 texture lookups and
8 map operations and you're not doing a dependent texture read, then use
PS-1.1 up to 1.3 version. If you're doing some dependent operations and
you can fit within 1.4 shader, then use that and, if you're doing lots of
dependent operations, then use, only then use pixel shader 2.0. This also
guarantees that, for previous pixel shader versions, 1.X, that you're using the
low precision register types so that actually saves storage and cycles. The
same as you get a certain number of batches per frame, you can also think
of getting the same number of pixel Shader cycles per frame. So you've got
to basically choose where you're going to spend your cycles.

Share this post


Link to post
Share on other sites
Same principle there, yes.
(Keep in mind that as Scythen said, earlier shader versions did have a few tricks that got cut in later versions, but the opposite is true as well. Newer versions also have little tricks that can make the same shader perform faster than it would in a 1.1 version. If you're after that kind of tweaking, you just have to research exactly what each shader version can do, and preferably test it heavily with several cards)

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