Skip to content

WebGL1: Forbid #extension: disable after non-preprocessor tokens #3772

@ShabbyX

Description

@ShabbyX

WebGL1 says:

In the WebGL API, #extension directives may always occur after non-preprocessor tokens in GLSL ES 1.00 shaders. The scope of #extension directives in GLSL ES 1.00 shaders is always the whole shader, and #extension directives that occur later override those seen earlier for the whole shader.

Can we restrict this such that extensions cannot be disabled later in the shader after they were enabled? It's not a useful scenario to support, and it can be complicated to validate, for example if the shader enables an extension, use it (and pass validation) then disable it at the end of the shader.

Optionally (and less ideally), we could disallow extension disables after non-preprocessor tokens only if that extension was previously enabled by the shader, so the shader can't bypass validation like:

#extension Foo: enable
    use_tokens_from_foo();
#extension Foo: disable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions