![]() |
| [[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]] |
|
|
#1 |
|
New Member
Join Date: May 2006
Location: Spain
Posts: 2
|
In DirectX, when compiling a shader with D3DXCompileShader() a buffer containing the shader bytecodes is received. Apart from the bytecodes, extra content like debug and symbol table information is embedded. That extra information is added in form of comments that probably can be eliminated because you are already processing it at compile-time and it is not needed at run-time when loading the shader.
If you can do without that information the following code will help you to save a few bytes, even halving the size of the byte-code in the best cases. Although not documented in the DirectX SDK, this CodeGem is not an undocumented hack. The Direct3D shader code format is documented in the MSDN, so it probaly won’t change in future revision of DirectX v9.0 (if there is going to be any more…) Code:
Happy coding, http://entland.homelinux.com/blog/ Last edited by ent : 01-17-2009 at 05:02 AM. |
|
|
|
|
|
#2 |
|
Valued Member
Join Date: Sep 2005
Location: Germany
Posts: 119
|
Sorry, but I don't understand why you would need to do something like that.
If you compile your code without debug informations then the comments will be ommited anyway. |
|
|
|
|
|
#3 | |
|
Senior Member
Join Date: Aug 2004
Location: Ghent, Belgium
Posts: 1,056
|
Quote:
For instance I know a tool which lets you visually 'construct' shaders with drag-and-drop diagrams. It's useful to have additional comments in the code about the dependencies (which can be shown to the artist), which should not be removed by the shader compiler. |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|