Short Contents

3.5 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:

shaderinfo [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
` --methods'
Output the name of all the methods in the shader.
` -v'
Output shaderinfo version
` -h'
Print a help screen

A sample run on the `matte' shader gives the following output(12):

% 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>
Line 2
<shadername>
Line 3
A number `n' specifying the total number of shader parameters
Lines 4 to n+4
'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, array length, 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 10.0. Copyright 2000-2011 The 3Delight Team. All Rights Reserved.