Shader Assembly Compiler (SHARK)

OpenGL Logo

[Introduction] [Downloads] [Related tools] [Feedback]


Last year OpenGL pixel shading capabilities finally have been standardized by ARB (see ARB_fragment_program). Before that happened, vendors used to provide interface to their hardware through proprietary extensions (e.g. NV_register_combiners or ATI_fragment_shader). Such differences in API require developer to rewrite essentially the same shader several times for different extensions. This is where SHARK helps: from a single source file it can generate a C++/Pascal code to perform appropriate OpenGL setup via different extensions (listed here).

SHARK is a tool to perform automatic conversion from DirectX 9 pixel shader assembly language into a C++/Pascal code that performs corresponding OpenGL setup through IHV’s propietary- or ARB-extensions. Possible advantages of SHARK over Cg are:

SHARK offers Ps API to handle everything that is specific to underlying extensions (e.g. code for enabling pixel shaders or setting constants). Typically, using Ps API it is possible to make a single rendering path for all supported hardware.


End user package – Win32 binary, documentation, headers

Source code – Microsoft Visual C++ 7.0

Example of usage for Microsoft Visual C++ (requires GLUT)

Example of usage for Borland Delphi 7 (requires GLUT)

More complex example – EMBM, DOT3 for various hardware (source code – Microsoft Visual C++ 7.0)

Related tools

Microsoft DirectX 9 SDK – documentation on pixel shader assembly language, assembler with a good semantic checking

NVIDIA NVParse – library that performs run-time setup of NV_texture_shader+NV_register_combiners2 according to the given ps.1.0 assembly source.

ATI Rendermonkey


If you are unsure about the output of SHARK and suspect that there’s a bug in generated code, please email description of the problem to me. Make sure to attach shader in question.