Pixel / vertex shader versions...
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
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement