Compiling DSO Shadeops

return to main index


Cutter, version 5.3.5 and later, is designed to ease the task of writing, compiling and linking a 'C' language file that implements a RenderMan shadeop. Cutter's most important feature is that on Linux and MacOSX a shadeop 'C' language file can be directly compiled and linked without the need for the user to write a Makefile - figure 1.

Figure 1 - Process Monitor echo'ing messages from make.

Cutter applies syntax coloration to a 'C' language file that it recognizes to be the source code of a shadeop. Recognition is based on finding one of following macros in the 'C' file, SHADEOP_TABLE, SHADEOP_INIT or SHADEOP_CLEANUP. Cutter also provides a quick way to access the Pixar web document that explains how shadeops are written. The document is located at,


Option + double clicking on a word in the 'C' file will open the web document in Cutter's internal browser - figure 2.

Figure 2

The browser will scroll to the first instance of the selected word. The next instance can be found by hitting the return key. Alternatively, option + shift + double clicking on a word will cause Cutter to display the web document in the users preferred external browser. Of course, this facility depends on Pixar's documentation being installed on the users computer.

Figure 3

Lastly, Cutter enables a user to conveniently open an "#included" header file by control + clicking in the name of the header file - figure 3. Cutter automatically "expands" the selection to boundaries of the file name; the user does not have to manually select the name of the header file.

Compilation, Linking & Makefiles

Upon receiving the keyboard shortcut control + e, Cutter writes and saves a Makefile in the same directory as the 'C' file the user is editing. Depending on the users OS, Cutter reads a template Makefile from either of the following directories,


In the case of Linux, Cutter looks for a file named Makefile.dsoLINUX. On OSX it looks for a file named Makefile.dsoOSX. The template Makefile for Linux is shown below.

Listing 1 (Makefile.dsoLINUX)

# Used by Cutter to compile a dso for use with RenderMan shaders on Linux
STRICT = -Wall
    gcc ${CFLAGS} -c YOUR_DSO_NAME.c
    ld -export-dynamic -shared -o  YOUR_DSO_NAME.o

Within a template Makefile the following strings act as "placeholders",


Cutter copies the text of the template Makefile and substitutes the placeholders with the appropriate information derived from the name of the 'C' file the user is editing and from information found in preferences. Therefore, it is essential the user has correctly setup their prefs.

Setting Up the ShadeOP Preferences

The preferences for "ShadeOP" is shown in figure 4. The first path should specify the location of the devkit directory in which the lib and include directories that support the development of shadeops are located.

Figure 4

The "User Paths", shown empty in figure 4, should specify the full path to the users include and lib directories. If a user wishes to customize Cutter's Makefile functionality they can do so by copying the template Makefile from Cutter_Help to their own custom_templates directory. Then its a matter of editing their template so that it forms the basis of the Makefile that Cutter generates to control the actual compilation and linking of their DSOs.

The other preference that should be set is,
   Rman->Docs->Documentation Directories->RPS index

The lower portion of the preferences panel is shown in figure 5.

Figure 5

DSO Locations

If compilation and linking are successful, a DSO will be created in the same directory as the 'C' source code. If the user has set their "User Paths & Options" (figure 6), additional copies of the DSO will be saved in the users "shaders" and "RSL source" directories.

Figure 6

© 2002- Malcolm Kesson. All rights reserved.