3.6 Using shaderinfo to Interrogate Shaders
shaderinfo is a utility to interrogate shaders compiled with shaderdl. It could be used as a quick way to see what parameters are needed for a particular shader or it could be used by third party software to build a graphical interface to manipulate shader parameters.
The general command line syntax is:
shaderdl [options] shader1 shader2 ... shadern
And the following list of options is accepted:
- ` -d'
- Output shader's parameters in a RIB format (see example below)
- ` -t'
- Output shader's parameters in an easy to parse tabular format
- ` -a'
- Output shader's annotations, if available
- ` -source'
- Output shader's source code if the shader was compiled with the `--embed-source' option as described in shaderdl options
- ` -v'
- Output
shaderinfoversion - ` -h'
- Print a help screen
A sample run on the `matte' shader gives the following output(15):
% shaderinfo matte
surface "matte"
"Ka" "uniform float"
Default value: 1
"Kd" "uniform float"
Default value: 1
If the output is intended for parsing, it might be better to use the `-t' option which gives the parameters in the following format:
Line 1- <displacement|volume|surface|lightsource|imager> <shadername>
Line 2- A number `n' specifying the total number of shader parameters
Lines 3 to n+3- 'n' lines of output, one for each parameter in the shader. Each line is a comma separated list of fields. Fields are, in order: name, storage, class, type, default space, default value. If there is no default space `<none>' will be used.
Interrogating the `matte' shader with the `-t' option gives the following output:
% shaderinfo -t matte surface matte 2 Ka,parameter,uniform,float,<none>,0,1 Kd,parameter,uniform,float,<none>,0,1
Shader annotation keys are listable using shaderinfo but this feature is better described in Attaching annotations to shaders.
3Delight 8.5. Copyright 2000-2009 The 3Delight Team. All Rights Reserved.