Skip to content

fix(@typegpu/gl): Reserve all keywords defined in the GLSL ES 3.0 spec - #2905

Merged
iwoplaza merged 1 commit into
mainfrom
fix/glsl-reserved-keywords
Aug 28, 2026
Merged

fix(@typegpu/gl): Reserve all keywords defined in the GLSL ES 3.0 spec#2905
iwoplaza merged 1 commit into
mainfrom
fix/glsl-reserved-keywords

Conversation

@iwoplaza

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI lite review requested due to automatic review settings August 23, 2026 08:44
@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/tinyest@8ee99468729ca8bf4d7ab5bb51d922062323ea78
https://pkg.pr.new/software-mansion/TypeGPU/tinyest-for-wgsl@8ee99468729ca8bf4d7ab5bb51d922062323ea78
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@8ee99468729ca8bf4d7ab5bb51d922062323ea78
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@8ee99468729ca8bf4d7ab5bb51d922062323ea78
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@8ee99468729ca8bf4d7ab5bb51d922062323ea78

benchmark
view benchmark

commit
view commit

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands @typegpu/gl’s GLSL generator identifier reservation to cover the full set of keywords (and built-in globals) from the GLSL ES 3.0 specification, preventing generated names from colliding with reserved tokens in emitted GLSL.

Changes:

  • Added a reservedKeywords list (GLSL ES 3.0 keywords + built-in globals) in glslGenerator.ts.
  • Updated GlslGenerator.initGenerator() to reserve all entries from that list via ctx.reserveIdentifier(...).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/typegpu-gl/src/glslGenerator.ts Outdated
Comment thread packages/typegpu-gl/src/glslGenerator.ts

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ ВAppпру two typos inline — both inside the new keyword list.

Reviewed changes

  • Replaced the one-off reserveIdentifier('gl_Position', 'global') / reserveIdentifier('sample', 'global') calls with a module-level reservedKeywords array enumerating the globals, defined keywords, and future-reserved type/qualifier words from GLSL ES 3.0, reserved in a loop inside the generator constructor.

The list goes one word too far in a couple of places (see the inline comment and nitpick).

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread packages/typegpu-gl/src/glslGenerator.ts Outdated
@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

Resolution Time Benchmark

---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.80, 1.64, 3.52, 5.95, 7.00, 11.28, 21.15, 21.73]
  line [0.88, 1.75, 3.33, 5.89, 6.80, 11.11, 20.96, 22.50]
  line [0.84, 1.62, 3.70, 5.89, 6.62, 11.51, 21.04, 22.65]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.32, 0.54, 0.70, 0.81, 1.09, 1.08, 1.27, 1.39]
  line [0.32, 0.48, 0.66, 0.74, 1.02, 1.02, 1.23, 1.42]
  line [0.26, 0.45, 0.62, 0.71, 1.00, 1.07, 1.32, 1.37]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.74, 1.90, 3.36, 6.67, 11.21, 23.74, 51.23, 102.83]
  line [0.78, 1.88, 2.91, 6.69, 10.86, 23.39, 50.28, 101.22]
  line [0.89, 1.98, 3.24, 6.01, 11.14, 24.31, 48.67, 99.27]
Loading

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 Decreased ➖ Unchanged 🔴 Increased ❔ Unknown
0 325 0 0

No notable changes.

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

@iwoplaza
iwoplaza force-pushed the fix/glsl-reserved-keywords branch 2 times, most recently from 22ac1a8 to d151ba8 Compare August 23, 2026 09:13

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. Prior feedback addressed in d151ba82.

Reviewed changes

  • Fixed the pler2DMSArray typo to sampler2DMSArray, restoring reservation of the real GLSL ES keyword (it now matches its isampler2DMSArray / usampler2DMSArray siblings).
  • Removed the duplicate volatile entry.

Both items raised in the previous review are cleanly resolved; the keyword list now has each real GLSL ES 3.0 word once and correctly spelled.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@aleksanderkatan aleksanderkatan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔑L

Comment thread packages/typegpu-gl/src/glslGenerator.ts Outdated
Comment thread packages/typegpu-gl/src/glslGenerator.ts
@iwoplaza
iwoplaza force-pushed the fix/glsl-reserved-keywords branch from d151ba8 to ccf0d00 Compare August 28, 2026 15:14
@iwoplaza
iwoplaza force-pushed the fix/glsl-reserved-keywords branch from ccf0d00 to 8ee9946 Compare August 28, 2026 15:24
@iwoplaza
iwoplaza merged commit 4fe359f into main Aug 28, 2026
8 of 9 checks passed
@iwoplaza
iwoplaza deleted the fix/glsl-reserved-keywords branch August 28, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants