• Advertisement
Sign in to follow this  

assembly-style shader programming

This topic is 4006 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 substantial difference between programming a shader with the assembly style syntax or writing it in a high-level shader language?

Share this post


Link to post
Share on other sites
Advertisement
well, yes of course there is a big difference...

what kind of difference do you mean? Its certainly harder to write a complex shader in assembly. If you are using ps 2.0 or a higher version, you'd have to be crazy or very technically assured to try to write assembly. These versions were made specifically for HLSL.

Sure its not hard to write a ps 1_1 shader that dose some basic stuff in assembly.. but modern shaders are normally far too complex to do it this way, and speed difference is probably minimal in most cases. Trust the compiler, unless something is clearly not working right.

Share this post


Link to post
Share on other sites
Don't bother with anything but high level stuff these days. I think you'd have to be bonkers to consider writing ASM, yet strangely enough I still see a fair amount of people using ASM shaders. I've leafed through a few fairly recent shader books and many of the authors & chapters still persist with ASM shaders. It just obfuscates whatever it is they are trying to demonstrate and, IMO, it just serves to perpetuate ASM shaders' survival (as some people will read the book and see ASM, then say "hey there must be a reason ASM is used so I will use it too") when there's really little reason left to use anything other than high level stuff.

It is still useful to be able to read & understand ASM (particularly when you are targeting a shader model with a low instruction count and need to shave off a few ops) but I personally wouldn't bother unless there's something that pricks your interest, or you need to know. Well, that's the attitude I take anyway.

Share this post


Link to post
Share on other sites
In should be noted that in DirectX 10, it's not even possible to write a shader in assembly (or so I've been told). It only accepts HLSL.

Share this post


Link to post
Share on other sites
With any luck we won't have to endure sporadic chapters of ASM in shader books then :P (or even worse, chapter after chapter of ASM and the HLSL equivalent -- now that really is pointless).

Share this post


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

  • Advertisement