OpenGL Shading Language: Difference between revisions

Content deleted Content added
m Extra comma
No edit summary
Line 64:
The two languages are similar but different. They can be interconverted through [[Standard Portable Intermediate Representation|SPIR-Cross]].<ref>{{Citation|last=|first=|title=KhronosGroup/SPIRV-Cross|date=2019-09-06|url=https://github.com/KhronosGroup/SPIRV-Cross|volume=|pages=|publisher=The Khronos Group|access-date=2019-09-08}}</ref>
 
==Operators Language ==
===Operators===
GLSL contains same operators as the [[operators in C and C++]], with the exception of [[Pointer (computer programming)|pointer]]s. [[Bitwise operators]] were added in version 1.30.
 
===Functions and control structures===
Similar to the [[C (programming language)|C programming language]], GLSL supports loops and branching, for instance: if-else, for, switch, etc. Recursion is forbidden and checked for during compilation.
 
User-defined functions are supported and built-in functions are provided. The graphics card manufacturer may optimize built-in functions at the hardware level. Many of these functions are similar to those in the math library of the C programming language while others are specific to graphics programming.
 
=== Preprocessor ===
GLSL defines a subset of the [[C preprocessor]] (CPP), combined with its own special directives for specifying versions and OpenGL extensions. The parts removed from CPP are those relating to file names such as {{code|#include}} and {{code|__FILE__}}.
 
==Compilation and execution==