KhronosGroup / KhronosGroup/WebGL

Forbid long symbol names staring with `_`

Open
#3,783 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
2.9k
Forks
704
Avg merge
2d 9h
Merged PRs (30d)
4

Description

ANGLE's shader translator prefixes symbol names with _u, but it can't do that if the symbol name is at least 1022 characters. To avoid name collisions, it has validation that if a name is at least 1022 characters and starts with _u, compilation fails.

A while ago, we made that u in _u configurable, which means the check is not correct if the compiler is invoked with anything other than u. I've also recently found a case where it makes sense to use different prefixes for different symbols, so the check would have to verify multiple prefixes, like _u, _b, etc.

I'd like to change the validation to forbid any too-long name that starts with _ like this. This requires changing the conformance2/glsl3/shader-with-1024-character-identifier.frag.html test because it does use a long name that starts with _a.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/compiler/translator/ParseContext.cpp at the linked long-name validation, then inspect conformance2/glsl3/shader-with-1024-character-identifier.frag.html and the configurable prefix in include/GLSLANG/ShaderLang.h. Update the validation and adjust the named conformance test so the expected behavior covers long names beginning with any underscore prefix.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.