Skip to main content
gamedev.net
🔒 Locked

Compiling shaders: Runtime vs Built

Started by SymLinked 4 replies 1.5k views
Original Post
SymLinked
SymLinked
Hiya, How is this handled usually? I was under the impression shaders were built before being shipped and then simply read on the users computer in assembly, but is this really how things are done? Will the generated assembly be different on different machines and perhaps more optimized if it's build locally?
darkelf2k5
darkelf2k5
Not really. Devs usually ship shaders in text format so it could be compiled based on the hardware of the end user. If they use a fixed shader version, say, 3.0 is the minimum for the game, they can just compile it and ship that. Compiled and stripped shaders are much much smaller than text based ones, also much harder to actually copy them for personal use.
Every time you implement a singleton, God kills a kitten. Please, think of the kittens!
MJP
MJP
The generated assembly will be exactly the same as long as you use the same version of the shader compiler (by linking to the same version of the DX runtimes). They're not compiled based on the hardware present on the host machine.

Some games don't compile until runtime, some compile in advance. You can do whatever you'd like. [smile]
sirob
sirob
It's important to note that actually compiling them at compile time (even if you don't actually use the compiled version at runtime), could save development time by detecting various errors before even running the application.

I'd certainly recommend compiling them even if you never use the compiled output.
Sirob Yes.» - status: Work-O-Rama.
Namethatnobodyelsetook
Namethatnobodyelsetook
We save compiled shaders for X360, and just load text for PC. The 360 takes a while to compile each shader, and load times must be minimized if you want to pass certification and/or not annoy your customers.
Ashkan
Ashkan
Quote:
Original post by sirob
It's important to note that actually compiling them at compile time (even if you don't actually use the compiled version at runtime), could save development time by detecting various errors before even running the application.

I'd certainly recommend compiling them even if you never use the compiled output.


Seconded. Also, in order to painlessly automate this process, you can customize your build by adding custom build rules.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.