Jump to content
  • Advertisement
Sign in to follow this  
dyerseve

pixel shader language?

This topic is 4837 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

OK theres like 20 different pixel shading langauges right now: Direct3D: ps_1_1 to ps_3_0 (asm-like) HLSL (high level) OpenGL: arb_fragment_program (asm-like) GLSL (high level) And Cg, which can compile to arb_fragment_program. (I saw somewhere that it supported some of Direct3D's languages. Is this true?) My questions is which of the above languages will be/is currently the most widely supported in hardware?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
HLSL, GLSL and Cg are very common and highly supported.

5-6 languages, not quite the mellow dramatic 20...

Use which ever you like best for the graphics API you like...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Actually there's only 4 "used" languages:

HLSL - DirectX.
ARB_x_program - OpenGL.
OGLSL - OpenGL.

And then there's the bastard kid, Cg, which can compile to something useable by DirectX or to something useable by OpenGL.

And also ps 1.1 to 3.0 are just feature sets, not languages.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yup, 1.1, 1.4, 2.0, and 3.0 are just the version of the pixel shader. LKater version can support more and different commands. Generally, you want to use the lowest version that will do what you need, so more cards can handle it. You may also want to include multiple versions of the shaders and run the highest one possible.

HLSL, GLSL, and the asm shaders are just the language used. HLSL and GLSL both compile to the asm language (IIRC). They will all have the same features exposed. HLSL/GLSL are both easier to learn (they have a very c like syntax), while the assembly typw can be tricky for a beginner. I think there is probably a small performance loss from the higher level languages, but I really don't know...

Share this post


Link to post
Share on other sites
So HLSL compiles to DirectX-usable-assembly and GLSL compilles to OpenGL-usable assembly, and Cg compiles to both?

Share this post


Link to post
Share on other sites
Quote:
Original post by dyerseve
So HLSL compiles to DirectX-usable-assembly and GLSL compilles to OpenGL-usable assembly, and Cg compiles to both?


Something like that...

Share this post


Link to post
Share on other sites
In the end they all get compiled into the same thing that your "regular" code gets compiled into. Nothing but a bunch of on and off patterns that the processor's hardware has been designed to do something useful with.

In this case, the GPU as opposed to the CPU.

Unless you need to do some crazy optimization, go with the high level languages because they provide convenient commands and semantics that will make your life SO much easier.

Share this post


Link to post
Share on other sites
Actualy IF you need crazy optimization, usually you will be better off using a high-level language. If you use it correctly the compiler will do the rest of the dirty work well enough.

Share this post


Link to post
Share on other sites
Very true. There's always exceptional cases though. Let me rephrase. Unless you really know what you're doing and profile your code and REALLY think asm coding your shader is going to make a difference (or let you do something you wouldn't otherwise be able to do) then use the compilers =D

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!