GLSL and ESSL are Khronos high-level shading languages.

Related tags

Graphics GLSL
Overview

GLSL

GLSL and ESSL are Khronos high-level shading languages.

Khronos Registries are available for

Extension specifications in this repository are listed below.

This Project Contains

This GLSL shading language project contains the following for the GLSL and ESSL Khronos shading languages:

  • issue tracking for the core specifications
  • issue tracking for shading language extensions (however, vendor-specific extension issues should be discussed with the vendor)
  • new shading language extension proposals and discussions
  • shading language extensions that do not live in the Khronos registries for OpenGL or OpenGL ES (e.g., those created to enable access to Vulkan features)

Note this family of languages is used by (at least) the following APIs:

  • OpenGL: consumes GLSL and ESSL
  • OpenGL ES: consumes ESSL
  • Vulkan: makes use of GLSL and ESSL, via SPIR-V

While OpenGL and OpenGL ES normatively accept GLSL and ESSL as input into their APIs, this is not true of core Vulkan, which normatively accepts SPIR-V but does not normatively consume a high-level shading language.

Extension Specifications in this Repository

Comments
  • Add a new GL_EXT_subgroupuniform_qualifier.

    Add a new GL_EXT_subgroupuniform_qualifier.

    Add a new GL_EXT_dynamically_uniform_attribute extension that introduces a variable declaration, function parameter, and function return type attribute [[dynamically_uniform]] to signify that the value is uniform across the shader.

    This maps to the SPIR-V Uniform decoration.

    Vulkan 
    opened by sheredom 17
  • How does NV_compute_shader_derivatives relate with variable workgroup sizes?

    How does NV_compute_shader_derivatives relate with variable workgroup sizes?

    The text makes clear that we need to validate the work group size in compile time, so that would exclude variable size work groups.

    If that's not the case, what to do when the size is set to something that don't follow the rules for the given arrangement?

    Adding a clarification about this could be nice. (Same comment applies to the corresponding SPV spec)

    OpenGL OpenGL ES Vulkan 
    opened by cmarcelo 14
  • Can gl_in be redeclared with an implicit array size in tessellation shaders?

    Can gl_in be redeclared with an implicit array size in tessellation shaders?

    From https://github.com/KhronosGroup/glslang/issues/1300:

    • Generally, an array declared as explicitly-sized cannot be redeclared without a size
    • Tessellation evaluation and control shaders pre-declare gl_in as gl_in[gl_MaxPatchVertices]
    • A later example of redeclaring gl_in uses gl_in[], which seems okay for geometry shading, but not for tessellation

    Now, the purpose of redeclaring a built-in block is to subset its members, not establish array size. So, it could be tolerated to redeclare gl_in[] even if it was pre-declared with a specific size.

    Or, we could be firm that it needs a size, and must be redeclared as gl_in[gl_MaxPatchVertices].

    One question is how have drivers interpreted the specification? As, I think, the specification could be clarified in either direction. We would then ensure glslang follows suit.

    Another question is whether another part of the specification already makes this more clear.

    (Currently, glslang is narrow, requiring the explicit redeclaration, which seems quite intentional, as the check is specific to built-in block redeclarations.)

    Specification 
    opened by johnkslang 9
  • Increase GL_MAX_COMPUTE_UNIFORM_BLOCKS and GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS interface block constrains in compute shaders

    Increase GL_MAX_COMPUTE_UNIFORM_BLOCKS and GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS interface block constrains in compute shaders

    The amount of interface blocks used in compute shaders such as uniform blocks and shader storage blocks are currently limited by GL_MAX_COMPUTE_UNIFORM_BLOCKS and GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS respectively. The constraints lay around 8 for shader storage blocks and 15 for uniform blocks on most modern GPUs which is inadequate. It would be very useful if some extension were added increasing these constraints.

    opened by emilmasoumi 8
  • Compute: Control barrier and shared memory within the local work group

    Compute: Control barrier and shared memory within the local work group

    The GLSL spec isn't very clear if a control barrier is all that is needed to synchronize access to shared memory in compute shaders. There are two options:

    • barrier() synchronizes execution order and makes writes to shared memory visible to other invocations with the local work group,
    • barrier() synchronizes execution and additionally memoryBarrierShared() is required in order to make memory writes visible to other invocations within the local work group.

    There is language in the GLSL spec (section 8.16 Shader Invocation Control Functions) that says:

    The function barrier() provides a partially defined order of execution between shader invocations. This ensures that values written by one invocation prior to a given static instance of barrier() can be safely read by other invocations after their call to the same static instance barrier().

    The above quotation suggests that barrier() is sufficient to synchronize access to shared memory in compute shaders. It's worth to mention that this language was initially introduced in ARB_tessellation_shaders.

    On the other hand, the SPIR-V spec states explicitly that control barriers make writes visibile only for tessellation shaders:

    When used with the TessellationControl execution model, it also implicitly synchronizes the Output Storage Class: Writes to Output variables performed by any invocation executed prior to a OpControlBarrier will be visible to any other invocation after return from that OpControlBarrier.

    So, are memoryBarrierShared() barriers required together with control barriers in compute shaders in order to make memory writes visible to other invocations within the local work group? Is SPIR-V different than GLSL?

    Resolving Inside Khronos 
    opened by jozefkucia 8
  • Add new extension GL_EXT_control_flow_attributes.

    Add new extension GL_EXT_control_flow_attributes.

    This extension is open for discussion, which can be held here in this pull request.

    Basically, it adds control-flow hints (very strong suggestions). E.g.,

            [[unroll]]               for (int x = 0; i < 8; ++i) { ... }
            [[dont_unroll]]          while(...) { ... }
            [[dependency_infinite]]  do { ... } while(...);
            [[dependency_length(4)]] for (int x = 0; i < 8; ++i) { ... }
            [[flatten]]              if (...) { ... } else { ... }
            [[dont_flatten]]         switch(...) { ... }
    

    See content of the extension for more detail. There is an implementation under way for this in glslang.

    opened by johnkslang 7
  • GLSL 4.60: No mention of TCS/TES in array block matching rules

    GLSL 4.60: No mention of TCS/TES in array block matching rules

    Consider this from 4.3.9:

    Furthermore, if a matching block is declared as an array, then the array sizes must also match (or follow array matching rules for the shader interface between a vertex and a geometry shader).

    Array matching rules are also different for TCS/TES stages. I'd suggest changing it to:

    Furthermore, if a matching block is declared as an array, then the array sizes must also match, in accord with the array matching rules for the shader interface between the two stages.

    Or something of the sort.

    OpenGL OpenGL ES Specification 
    opened by NicolBolas 7
  • Clarify about RayQuery with using DeviceAddress...

    Clarify about RayQuery with using DeviceAddress...

    I address into glslang issue, but about spec issue... should be used any uint64_t or uvec2 with accelerationStructureEXT(accStructAddress) or not, with ray query compute shaders? Issue: https://github.com/KhronosGroup/glslang/issues/2903

    opened by unit-a-user 6
  • [question] Add  maximum number of uniform buffer or shader storage block bindings Built-In Constants.

    [question] Add maximum number of uniform buffer or shader storage block bindings Built-In Constants.

    Hi , I have a question about here's why not include the maximum number of uniform buffer or shader storage block bindings into the built-in constants. but i did find out some description at ogl4.5 spec and some cts test also test this feature. Is there any historical reason here? And I think their roles just like the built-in constants at ch7.3, ogl4.6 spec. Thank you.

    ogl4.5 spec : chapter 4.4.5 Uniform and Shader Storage Block Layout Qualifiers

    If the binding point for any uniform or shader storage block instance is less than zero, or greater than or equal to the implementation-dependent maximum number of uniform buffer bindings, a compile-time error will occur.

    shader

    ES31-CTS.functional.layout_binding.negative.ssbo.vertex_binding_over_max
    layout(std140, binding = 8) buffer ColorBuffer0
    {
           highp vec4 color1;
           highp vec4 color2;
    } colors0;
    
    OpenGL OpenGL ES 
    opened by ZhiqianXia 6
  • Typo:

    Typo: "uint64_t, uint64_t" ?

    The same conversion type is repeated.

    https://github.com/KhronosGroup/GLSL/blob/7af180fd19879171437d0665b6622d14d0d83164/extensions/ext/GL_EXT_shader_explicit_arithmetic_types.txt#L505

     The following table shows allowed integral conversions:
          -------------------------------------------------------------------------
          | Type of    |     Can be implicitly converted to                       |
          | expression |                                                          |
          -------------------------------------------------------------------------
          | ...        |                                                          |
          | uint32_t   | uint64_t, uint64_t                                       |
          | ...        |                                                          |
          -------------------------------------------------------------------------
    
    Vulkan 
    opened by allanmac 6
  • Can share variables be declared with initializer?

    Can share variables be declared with initializer?

    GLSL ES 3.10 says "Variables declared as shared may not have initializers and their contents are undefined at the beginning of shader execution.". Does the wording 'may not' means 'must not'?' It's actually allowed in many GL driver implementations per my observation, at least Linux INTEL/AMD/NVIDIA, and Windows NVIDIA. It would be better to have it clarified in spec. Thanks a lot!

    OpenGL OpenGL ES 
    opened by jchen10 6
  • Symbolic/Automatic Differentiation Implementation in glsl

    Symbolic/Automatic Differentiation Implementation in glsl

    Like I explained here #2870 it would be very nice to have symbolic and/or automatic differentiation in the language.

    Example for how this could look like

    float a = 3;
    float b = a * a;
    // db/da forward mode ad
    float gradForward = forwardGrad(b, a);
    // db/da backward mode ad
    float gradBackward = backwardGrad(b, a);
    // results should be: 
    // b == 9
    // forwardGrad == backwardGrad == 6
    
    // same thing for vec or mat
    vec3 c = vec3(2, 3, 4);
    vec3 b = c * c;
    // forward mode ad
    // vec3(db0/dcX, db1/dcX, db2/dcX)
    // (1 input -> 3 outputs)
    vec3 gradForward0 = forwardGrad(b, c[0]);
    vec3 gradForward1 = forwardGrad(b, c[1]);
    vec3 gradForward2 = forwardGrad(b, c[2]);
    // backward mode ad
    // vec3(dbX/dc0, dbX/dc1, dbX/dc2)
    // (3 input -> 1 outputs)
    vec3 gradBackward0 = backwardGrad(b[0], c);
    vec3 gradBackward1 = backwardGrad(b[1], c);
    vec3 gradBackward2 = backwardGrad(b[2], c);
    // b == (4, 9, 16)
    // gradForward0 == gradBackward0 == (4, 0, 0)
    // gradForward1 == gradBackward1 == (0, 6, 0)
    // gradForward2 == gradBackward2 == (0, 0, 8)
    

    The idea would be if these operations are encountered, the compiler would add the autodiff instructions required to the ast... Maybe having an OpForwardAD and OpBackwardAD would be even better, then this could be handled by the driver

    opened by fknfilewalker 0
  • Another descriptor binding model (new data type idea)

    Another descriptor binding model (new data type idea)

    Trivia:

    1. Would to suggest the new vulkan descriptor model 2.0 (I have no any details, except raw binding, or using device address).
    2. Would suggest to add new type: raw_buffer_t, raw_uniform_t, raw_shared_t, raw_texture_t, raw_image_t, etc.
    3. raw_buffer_t, raw_uniform_t, raw_shared_t are similar to uint64_t, but with some rules, limitations and exceptions.
    4. There data types respondent from real descriptor bindings. It may also need to be unified in some way.
    5. The idea was also motivated by OpenCL.

    Example:

    layout(image_reference, rgba32f) uniform image2D imageRef;
    
    layout(uniform_reference, scalar, uniform_reference_align = 16) uniform uniformRef {
       uvec4 data;
    };
    
    layout(buffer_reference, scalar, buffer_reference_align = 16) buffer bufferRef {
       uvec4 data;
    };
    
    layout(shared_reference, scalar, shared_reference_align = 16) shared sharedRef {
       uvec4 data;
    };
    
    layout(binding = 0) uniform raw_buffer_t buffers[]; // which can be handled similar alike buffer reference
    layout(binding = 1) uniform raw_texture_t textures[]; // which can contain 2D, 3D, cubemap textures, etc.
    layout(binding = 2) uniform raw_image_t images[];
    raw_shared_t sharedMemory;
    
    void main() {
      bufferRef buf = bufferRef (buffers[0]);
      texture2D tex = texture2D(textures[0]);
      sharedRef sbt = sharedRef(sharedMemory);
      imageRef imf = imageRef(images[0]);
      //vec4 imagePixel = imageLoad(imf, ivec2(coordinate));
    }
    

    Let me explain what this is all about:

    1. raw_buffer_t, raw_uniform_t, raw_shared_t have a + byteOffset capability
    2. References to these handles can be passed by function, with atomic operation capabilities
    3. The real number is never known, they are actually virtual
    4. Easier to debug because they are bound to descriptor binding, including the indexed model
    5. You can check the presence of this binding (element), but again you can't know its number
    6. You can't save them (those handles) to memory. You can only operate on them inside the shader.

    Why did I still decide not to add the idea from shader model 6.6 in its entirety?

    1. Backward compatibility with the current bindings model.
    2. Avoiding some misunderstandings and conflicts in terms of typing.

    And what will change?

    1. Essentially the implementation of the pointer and reference model.
    2. The ability to check for presence or empty binding.
    3. Different data types for different purposes.
    4. Ability to atomic operations on argument in functions.

    Virtual device buffer address? Aka. shader model 6.6 miscellaneous. Not applicable everywhere. For example shared is more of a purely hardware thing, and it doesn't have a good binding.

    // expose raw_buffer_t
    struct VBA64 {
      uint32_t set_binding_index;  //de-facto device address of binding
      uint32_t byteOffset;
    };
    
    // expose raw_buffer_t (alt)
    struct VBA64Indexed {
      uint16_t set_and_binding; //de-facto device address of binding
      uint16_t index; // if indexed
      uint32_t byteOffset;
    };
    
    // expose raw_shared_t
    struct VSA32 {
      uint32_t byteOffset;
    };
    

    Safety. Stands between the physical device buffer address and the binding to the descriptor. And the same limit checks, validation, and debugging are available (though in bytes, in hex code). Even an availability check is available.

    Vulkan 
    opened by unit-a-user 0
  • `VK_KHR_shader_integer_dot_product` for GLSL?

    `VK_KHR_shader_integer_dot_product` for GLSL?

    I still not seen no one pull requests, no issue tracking, no speaks or mentions... I think it's time to implement VK_KHR_shader_integer_dot_product in GLSL...? Looks like GLSL already died...

    Vulkan 
    opened by unit-a-user 1
  • Are atomic operations allowed on writeonly memory?

    Are atomic operations allowed on writeonly memory?

    The spec is unclear whether memory decorated with writeonly can be passed to, for example, atomicAdd. The atomic operations are specifically described to read then write the memory in question, so it seem reasonable that either writeonly or readonly should be invalid. Section 8.11 (Atomic Memory Functions) goes to some effort to say that restrict, coherent, and volatile are valid, but it makes no mention of readonly or writeonly.

    However, we have discovered that the GIANTS Editor does this in many of its shaders, and closed-source drivers from both AMD and NVIDIA accept the shaders.

    See also https://gitlab.freedesktop.org/mesa/mesa/-/issues/5842.

    opened by ianromanick 1
  • GLSL Specification 4.60.7: typos in function signatures

    GLSL Specification 4.60.7: typos in function signatures

    In The OpenGL Shading Language, Version 4.60.7, section 8.9.2. Texel Lookup Functions the parameter P is missing a type in the gsampler3D overload of textureGrad

    gvec4 textureGrad(gsampler3D sampler, P, vec3 dPdx, vec3 dPdy)
                                          ~ missing parameter type 'vec3'
    

    In section 8.12, Image Functions one of the overloads of imageSize is listed with the type gimageRect which does not exist. The correct parameter type should be gimage2DRect

    ivec2 imageSize(readonly writeonly gimageRect image)
                                       ~~~~~~~~~~ should be gimage2DRect
    
    opened by kociap 1
Owner
The Khronos Group
Connecting Software to Silicon
The Khronos Group
Legion Low Level Rendering Interface provides a graphics API agnostic rendering interface with minimal CPU overhead and low level access to verbose GPU operations.

Legion-LLRI Legion-LLRI, or “Legion Low Level Rendering Interface” is a rendering API that aims to provide a graphics API agnostic approach to graphic

Rythe Interactive 25 Dec 6, 2022
The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation

DirectX Shader Compiler The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) pr

Microsoft 2.4k Jan 3, 2023
After Effects Plug-in to write GLSL with a format of glslCanvas

glslCanvas4AE After Effects plug-in to run codes written at The Book of Shaders Editor. NOTE: This codes is working in progress and has many problems

Baku 麦 176 Dec 19, 2022
My implementations of Ray Tracing in One Weekend written in many different languages.

Ray Tracing in Many Languages This repository contains my implementation of the Ray Tracing in One Weekend book written in several different programmi

Joshua Vega 1 Oct 19, 2021
A modern cross-platform low-level graphics library and rendering framework

Diligent Engine A Modern Cross-Platform Low-Level 3D Graphics Library Diligent Engine is a lightweight cross-platform graphics API abstraction library

Diligent Graphics 2.6k Dec 30, 2022
Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal

Low Level Graphics Library (LLGL) Documentation NOTE: This repository receives bug fixes only, but no major updates. Pull requests may still be accept

Lukas Hermanns 1.5k Jan 8, 2023
Deno gl - WIP Low-level OpenGL (GLFW) bindings and WebGL API implementation for Deno.

deno_gl WIP Low-level OpenGL (GLFW) bindings and WebGL API implementation for Deno. Building Make dist directory if it doesn't exist. Build gl helper

DjDeveloper 14 Jun 11, 2022
A low-level, cross-platform GPU library

vgpu is cross-platform low-level GPU library. Features Support for Windows, Linux, macOS. Modern rendering using Vulkan and Direct3D12. Dependencies U

Amer Koleci 9 Jul 28, 2022
Source Code for "Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs" by Eric Haines and Tomas Akenine-Möller

Apress Source Code This repository accompanies Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs by Eric Haines and Tomas

Apress 862 Dec 29, 2022
Efficiently spawn and move high amounts of objects like bullets for bullet hells, particles and more.

Godot Native Bullets Efficiently spawn and move high amounts of objects like bullets for bullet hells, particles and more. This is a GDNative plugin,

Samuele Zolfanelli 105 Jan 6, 2023
Open source Altium Database Library with over 147,000 high quality components and full 3d models.

Open source Altium Database Library with over 147,000 high quality components and full 3d models.

Mark 1.4k Dec 29, 2022
A library for high-performance, modern 2D graphics with SDL written in C.

SDL_gpu, a library for making hardware-accelerated 2D graphics easy. by Jonathan Dearborn SDL_gpu is licensed under the terms of the MIT License. See

Jonathan Dearborn 1.1k Jan 5, 2023
High frequency trading bot for crypto currencies

Gamma Ray WARNING: The author of this software will not be responsible for your losses on the market, use at your own discretion. Introduction Gamma R

TIAN Liang Yuan 267 Dec 25, 2022
⚡High-performance rendering for python

ZenGL ZenGL is a minimalist Python module providing exactly one way to render scenes with OpenGL. pip install zengl Documentation zengl on Github zen

Szabolcs Dombi 133 Dec 17, 2022
Horde3D is a small 3D rendering and animation engine. It is written in an effort to create an engine being as lightweight and conceptually clean as possible.

Horde3D Horde3D is a 3D rendering engine written in C++ with an effort being as lightweight and conceptually clean as possible. Horde3D requires a ful

Volker Vogelhuber 1.3k Dec 31, 2022
Lightweight and modular C++11 graphics middleware for games and data visualization

Magnum — Lightweight and modular C++11/C++14 graphics middleware for games and data visualization Looking for an open-source library that gives you gr

Vladimír Vondruš 4.3k Dec 30, 2022
ANSI C library for NURBS, B-Splines, and Bézier curves with interfaces for C++, C#, D, Go, Java, Lua, Octave, PHP, Python, R, and Ruby.

TinySpline TinySpline is a small, yet powerful library for interpolating, transforming, and querying arbitrary NURBS, B-Splines, and Bézier curves. Th

Marcel Steinbeck 895 Dec 28, 2022
Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilities

Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilities

Raul Mur-Artal 7.8k Jan 5, 2023
A C++/DirectX 11 implementation of "A Scalable and Production Ready Sky and Atmosphere Rendering Technique"

Atmosphere Renderer A C++/DirectX 11 implementation of "A Scalable and Production Ready Sky and Atmosphere Rendering Technique" Features interactive e

Z Guan 37 Nov 20, 2022