GLSL: rename all identifiers prefixed with gl_.

In GLSL, all identifiers beginning with gl_ are reserved (not just those
explicitly named in the spec), and so any found in WGSL must be renamed.

Bug: tint:1304
Change-Id: I92ed7ec674620f67775378ecb8debcfdb4b5bbb4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/69701
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White
2021-11-16 19:13:36 +00:00
committed by Tint LUCI CQ
parent 4b6eb0c6e3
commit ae4487f3f9
7 changed files with 190 additions and 216 deletions

View File

@@ -1309,7 +1309,8 @@ Output Renamer::Run(const Program* in, const DataMap& inputs) {
kReservedKeywordsGLSL,
kReservedKeywordsGLSL +
sizeof(kReservedKeywordsGLSL) / sizeof(const char*),
name_in)) {
name_in) &&
name_in.compare(0, 3, "gl_")) {
// No match, just reuse the original name.
return ctx.dst->Symbols().New(name_in);
}