OpenGL Shading Language: Difference between revisions

Content deleted Content added
Restored revision 1269975510 by GreenC bot (talk)
added Infobox and unofficial logo
 
(One intermediate revision by one other user not shown)
Line 1:
{{Short description|High-level shading language}}
{{distinguish|Open Shading Language}}
 
{{Infobox software
| name = GLSL
| title = GLSL
| logo = GLSL_Logo_(Unofficial).svg
| logo size = x64px
| logo caption = ''Unofficial logo''
| screenshot =
| caption =
| collapsible =
| author = [[OpenGL ARB]]
| developer = [[Khronos Group]]
| released = {{Start date and age|2002|07|24}} (as an extension)
| discontinued =
| latest_release_version = 4.60.8
| latest_release_date = {{Start date and age|2023|08|14}}<ref>{{cite web|url=https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.html|title=The OpenGL® Shading Language, Version 4.60.8}}</ref>
| latest preview version =
| latest preview date = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} -->
| programming language =
| operating_system =
| platform = [[Cross-platform]]
| size =
| genre = [[Programming Language]]
| license =
| website =
| standard =
| AsOf =
}}
 
[[File:Linux kernel and OpenGL video games.svg|thumb|[[Video games]] outsource rendering calculations to the [[Graphics processing unit|GPU]] over [[OpenGL]] in real-time. Shaders are written in '''OpenGL Shading Language''' and compiled. The compiled programs are executed on the GPU.]]
Line 89 ⟶ 117:
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__}}.<ref>{{cite book |title=OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition |url=https://www.oreilly.com/library/view/opengl-programming-guide/9780132748445/ch02lev2sec5.html |language=en |chapter=Shader Preprocessor}}</ref>
 
The {{code|GL_ARB_shading_language_include}} extension<ref>{{cite web |title=ARB_shading_language_include |url=https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shading_language_include.txt |website=Khronos.org |access-date=2020-05-31}}</ref> (implemented for example in Nvidia drivers<ref>{{cite web |title=NVIDIA driver 265.90 WHQL Quadro |url=https://forums.laptopvideo2go.com/topic/27639-nvidia-driver-26590-whql-quadro/?tab=comments#comment-134520 |archive-url=https://web.archive.org/web/20210308165926/https://forums.laptopvideo2go.com/topic/27639-nvidia-driver-26590-whql-quadro/?tab=comments#comment-134520 |url-status=dead |archive-date=March 8, 2021 |website=LaptopVideo2Go Forums }}</ref> on Windows and Linux, and all Mesa 20.0.0<ref>{{cite web |title=Mesa 20.0.0 Release Notes / 2020-02-19 |url=https://www.mesa3d.org/relnotes/20.0.0.html |website=www.mesa3d.org |access-date=2020-05-31 |archive-date=2020-05-12 |archive-url=https://web.archive.org/web/20200512220620/https://mesa3d.org/relnotes/20.0.0.html |url-status=dead }}</ref> drivers on Linux, FreeBSD and Android) implements ability to use {{code|#include}} in source code, allowing easier sharing of code and definitions between many shaders without extra manual pre-processing. Similar extension {{code|GL_GOOGLE_include_directive}} and {{code|GL_GOOGLE_cpp_style_line_directive}} exist for using GLSL with Vulkan, and are supported in reference SPIR-V compiler ({{code|glslang}} aka glslangValidator).<ref>{{cite web |title=#include directive support by antiagainst · Pull Request #46 · KhronosGroup/glslang |url=https://github.com/KhronosGroup/glslang/pull/46 |website=GitHub |access-date=2020-05-31 |language=en}}</ref><ref>{{cite web |title=Preprocessing line number handling by antiagainst · Pull Request #38 · KhronosGroup/glslang |url=https://github.com/KhronosGroup/glslang/pull/38 |website=GitHub |language=en}}</ref><ref>{{cite web |title=Extend the syntax of #line and __FILE__ to support filename strings by antiagainst · Pull Request #43 · KhronosGroup/glslang |url=https://github.com/KhronosGroup/glslang/pull/43 |website=GitHub |language=en}}</ref>
 
==Compilation and execution==