Shader Language programming language (CG/HLSL/GLSL)

Shader LanguageProgramming language

Shader LanguageProgramming language

Shader Language currently has 3 mainstream languages:

OpenGL Shading Language based on OpenGL , referred to as GLSL ; High Level Shading Language based on DirectX , referred to as HLSL ; and NVIDIA 's C for Graphic , referred to as Cg language .

OpenGL (full-written Open Graphics Library) is a professional graphics program interface that defines cross-programming language and cross-platform programming interface specifications.
OpenGL GLSL Chinese manual

DirectX (Direct eXtension, DX for short) is a multimedia programming interface created by Microsoft Corporation. Implemented by C++ programming language, following COM . It is widely used in Microsoft Windows, Microsoft XBOX, Microsoft XBOX 360 and Microsoft XBOX ONE video game development, and can only support these platforms.
Microsoft Official Manual: High-Level Shader Language (HLSL)

Cg language (C for Graphic) is a high-level shading language designed for GPU programming. Cg strives to retain most of the semantics of C language and free developers from hardware details. Cg also has other benefits of a high-level language, such as code The ease of reusability, readability is improved, and the compiler code is optimized. Cg is a graphics processor programming language widely supported by OpenGL and Direct3D. Cg language and OpenGL, Direct3D are not languages ​​at the same level, but the upper layer of OpenGL and DirectX, that is, Cg programs run on the basis of OpenGL and DirectX standard vertex and pixel shaders. Cg was developed by NVIDIA and Microsoft in collaboration on the syntax and semantics of a standard hardware lighting language. So, HLSL and Cg are actually the same language.
Cg Nvidia Documentation

The image calls OpenGL, DirectX, and NVIDIA's C for Graphic as three pillars

Guess you like

Origin blog.csdn.net/weixin_44478077/article/details/125005860