Jump to content
  • Advertisement
Sign in to follow this  
TheKrust

Pixel / vertex shader versions...

This topic is 3945 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Could someone please point out the differneces between different versions (1.0, 1.4, 2.0, 3.0) of pixel and vertex shaders in HLSL? Are they faster or more advanced? Are there any major structure or syntax changes between them? Is code transportable from one to the other (Ie, if I had a tutorial on version 1.4, and I was programming in 2.0, would I have a problem)? thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by TheKrust
Could someone please point out the differneces between different versions (1.0, 1.4, 2.0, 3.0) of pixel and vertex shaders in HLSL?


Smaller numbered versions have less features and smaller size limits on the shaders. Generally if you try to do something in HLSL that can't be done on a lower shader level, then the HLSL compiler will fail to compile the shader.

Quote:
Are they faster or more advanced?


More advanced.

Quote:
Are there any major structure or syntax changes between them?


No, except the instruction length limits on PS 1.x shaders are so low that its unlikely you'll be able to write any sort of useful shader in HLSL; those parts were exposing "pixel shaders" that really accepted only a limited number of instructions with lots of restrictions on how they could be used. It was really more like a fixed-function configurable block exposed as a shader.

Quote:
Is code transportable from one to the other (Ie, if I had a tutorial on version 1.4, and I was programming in 2.0, would I have a problem)?


Moving to a higher version always includes whatever you could do in a lower version in HLSL. If you were coding in shader assembly, you'd have to make some adjustments when moving from the earlier architectures.

In D3D10, they don't even expose the assembly language anymore; you have to write your shaders in HLSL. If you want to see what the assembly shader stuff looks like for vertex shaders, look at Chapter 9. Vertex Shaders from my book.

Share this post


Link to post
Share on other sites
The DirectX SDK documentation is the place to look for the full answer to your question. Basically though higher shader versions generally add extra functionality, including things like increasing the maximum number of instructions that can be executed, expanding the number of constant registers available, increasing the number of textures that can be bound, enabling looping and branching in shaders and adding new instructions to support new features. In general higher shader versions are not inherently faster though (that's a function of the hardware you're running on), rather they provide increased functionality and/or flexibility.

While many of the principles of shader programming carry over between versions there are some fairly significant differences between 1.x pixel shaders and 2.x and higher pixel shaders so if you're learning now I'd suggest looking for references that discuss 2.x shaders and higher.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!