Cg (programming language)
Shading language / From Wikipedia, the free encyclopedia
Dear Wikiwand AI, let's keep it short by simply answering these key questions:
Can you list the top facts and stats about Cg (programming language)?
Summarize this article for a 10 year old
Cg (short for C for Graphics) and High-Level Shader Language (HLSL) are two names given to a high-level shading language developed by Nvidia and Microsoft for programming shaders. Cg/HLSL is based on the C programming language and although they share the same core syntax, some features of C were modified and new data types were added to make Cg/HLSL more suitable for programming graphics processing units.[1][2]
Family | shading language |
---|---|
Developer | nVIDIA, Microsoft |
Website | developer |
Dialects | |
Cg, HLSL, Playstation Shading Language | |
Influenced by | |
C, RenderMan Shading Language | |
Influenced | |
GLSL |
Two main branches of the Cg/HLSL language exist: the Nvidia Cg compiler (cgc) which outputs DirectX or OpenGL and the Microsoft HLSL which outputs DirectX shaders in bytecode format.[3][4] Nvidia's cgc was deprecated in 2012, with no additional development or support available.[5]
HLSL shaders can enable many special effects in both 2D and 3D computer graphics. The Cg/HLSL language originally only included support for vertex shaders and pixel shaders, but other types of shaders were introduced gradually as well:
- DirectX 10 (Shader Model 4) and Cg 2.0 introduced geometry shaders.[6]
- DirectX 11 (Shader Model 5) introduced compute shaders (GPGPU) and tessellation shaders (hull and domain). The latter is present in Cg 3.1.
- DirectX 12 (Shader Model 6.3) introduced ray tracing shaders (ray generation, intersection, bit / closest hit / miss).