Jump to content
  • Advertisement
Sign in to follow this  
littlekid

Shader language type

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

Is there any difference in the method of writing a shader file? There seems to be 2 method, one is written something like C with struct and a function. The other is very like assembly. Is there any benefit over another? Which should i go for?

Share this post


Link to post
Share on other sites
Advertisement
Quote:

Is there any difference in the method of writing a shader file? There seems to be 2 method, one is written something like C with struct and a function.

In DirectX8, shaders were written in a low-level shader assembly language. We no longer have to write shaders in assembly language. DirectX9 has supplied a High-Level Shading Language that we can use to write shaders (C-style).

I hope this helps.

Share this post


Link to post
Share on other sites
Quote:
Original post by littlekid
Is there any benefit over another? Which should i go for?

HLSL (the c-style one!) is just a different representation of the Assembly shaders - the actual Direct3D runtime will use the ASM code and the HLSL is pretty much just for us developers. For the most part they are identical.

The only exception to this is if you're targetting the low-end shader profiles (ps_1_x and vs_1_x) as the HLSL compiler often can't generate ASM code that fits within the shader profile's restrictions. You'll see a lot of graphics programmers using assembly directly for such tasks...

For the higher profiles (SM2 and SM3) the restrictions are less of a problem, and you'd have to be a pretty good assembly-level programmer to beat the HLSL compiler [smile]

Bottom line is that if you're particularly interested in the low-end hardware/profiles you'll want to look at the ASM route. For everything else I'd recommend HLSL, but it's pretty much up to you to choose whichever one you prefer...

hth
Jack

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!