View RSS Feed

JarkkoL

GLSL Shader Compiler

Rate this Entry
by , 05-09-2011 at 11:22 AM (52872 Views)
Here's a little GLSL compiler tool (Windows executable) I created for compiling GLSL shaders off-line for projects.

The tool inputs a GLSL file, compiles the file using native GLSL compiler (outputs warnings/errors if encountered) and outputs a stripped version of the input code that can be included in a .cpp file (defines a static variable, much like Direct3D Shader Compiler "fxc /Fh" for HLSL). Unlike GLSL standard, the tool also supports #include preprocessor directives and unfolds the directives for the output code. There are also VS2008 and VS2010 build rule files for *.glsl files to make it easy to embed GLSL files to Visual Studio projects: Once the rule is enabled for a project, just add a .glsl file to the project and in the file properties define the shader type from the "Shader Type" drop-down menu: Vertex (default), Fragment, Geometry, Tesselation Control or Tesselation Evaluation.

The format of compiler warnings & errors depends on the display drivers and I have tested the compiler only with NVIDIA and AMD drivers. OpenGL drivers of other vendors may output warnings/errors in a format that's not properly displayed by the tool. Warnings and errors are formatted so that in Visual Studio you can get to the offending file & line by simply hitting F4-key.

[Update 5/29/2011]: Version 1.01 - fixed missing #include file to fail compilation


Cheers, Jarkko
Attached Thumbnails Attached Files
Tags: None Add / Edit Tags
Categories
Uncategorized

Comments

kas ekimi sac ekimi