GithubHelp home page GithubHelp logo

rakete / glsl-validator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from felixpalmer/glsl-validator

0.0 3.0 0.0 1.37 MB

Command line tool for validating GLSL files

License: MIT License

Python 85.28% GLSL 14.72%

glsl-validator's Introduction

GLSL Validator

The GLSL validator is a tool for validating WebGL shaders, with support for adding prefixes to your shaders, leading to compatibility with libraries such as THREE.js, which automatically pass in variables into your shaders.

For more details, see post here

Usage

Add the directory containing the glsl-validate.py command to your path, then invoke using glsl-validate.py FILE [FILE ...]

Example output

If there any errors in the passed in shader files, they will be displayed along with the line they occured on:

The tool can also be used to generate the shader assembly instructions to give you an idea of how compute intensive it is. Note this is just a guide, actual instruction will be driver dependent.

Prefix files

In order to keep the ANGLE compiler happy, we prepend prefix files to the GLSL files being checked, which contain the code that a library will pass in.

The prefix files that the validator will use are prefix/prefix.frag and prefix/prefix.vert for fragment and vertex shaders, respectively. Example prefix files for various libraries can also be found in the prefix directory, e.g. prefix.threejs.vert.

To not load the prefix files, use the --raw flag.

Validation engine

To validate the GLSL code, the ANGLE compiler is used. Binaries have been taken from the Sublime Text GL Validator

CGC compiler

The tool uses the Cg Toolkit to get an estimate (it is driver dependant) of the shader instructions a given shader will output. The required binary for this to function is: cgc, which (on OSX) can be obtained by downloading the Cg Toolkit from https://developer.nvidia.com/cg-toolkit-download and then using Show package contents to extract the cgc binary from Cg-3.1.0013.app/Contents/Resources/Installer Items/NVIDIA_Cg.tgz (the installer did not work for me). l

glsl-validator's People

Contributors

felixpalmer avatar rakete avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.