Shaders Reference


General:


Why are conditionals slow in shaders?
Because shaders have to pick between different code branches at runtime for Shader models less than HLSL 4.0.

What are some work-around methods for implementing conditionals in shaders?
One method often used is #ifdef, #ifndef, #define pre-processor logic to create what are typically called fragment shaders.

HLSL (High Level Shader Language--used with DirectX/XNA):


Are there bools in HLSL?
No there are not, you have to use numbers or other logic.

GLSL (OpenGL Shader Language) :


What is GLSL?
GLSL (GLslang) is a short term for the official OpenGL Shading Language. GLSL is a C/C++ similar high level programming language for several parts of the graphic card.
With GLSL you can code (right up to) short programs, called shaders, which are executed on the GPU.