Skip to content

GLSL shader compatibility issue when targeting WebGL with wasm32-emscripten #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nii236 opened this issue May 16, 2025 · 0 comments
Open

Comments

@nii236
Copy link

nii236 commented May 16, 2025

Description

When building the any example with the wasm32-emscripten target, the fragment shader compilation fails with multiple errors indicating GLSL version incompatibility.

Steps to Reproduce

zig build texture_outline -Dtarget=wasm32-emscripten --sysroot /Users/nii236/gamedev/emsdk/upstream/emscripten

Environment

  • Platform: macOS
  • Zig version: 0.14.0
  • Raylib version: 5.6-dev
  • Target: wasm32-emscripten
  • Browser rendering: WebGL 1.0 (OpenGL ES 2.0)

Logs

Image

➜  raylib-zig git:(devel) zig build texture_outline -Dtarget=wasm32-emscripten --sysroot /Users/nii236/gamedev/emsdk/upstream/emscripten
Now listening at http://0.0.0.0:6931/
INFO: Initializing raylib 5.6-dev
INFO: Platform backend: WEB (HTML5)
INFO: Supported raylib modules:
INFO:     > rcore:..... loaded (mandatory)
INFO:     > rlgl:...... loaded (mandatory)
INFO:     > rshapes:... loaded (optional)
INFO:     > rtextures:. loaded (optional)
INFO:     > rtext:..... loaded (optional)
INFO:     > rmodels:... loaded (optional)
INFO:     > raudio:.... loaded (optional)
INFO: DISPLAY: Device initialized successfully
INFO:     > Display size: 800 x 450
INFO:     > Screen size:  800 x 450
INFO:     > Render size:  800 x 450
INFO:     > Viewport offsets: 0, 0
INFO: GL: Supported extensions count: 71
INFO: GL: OpenGL device information:
INFO:     > Vendor:   WebKit
INFO:     > Renderer: WebKit WebGL
INFO:     > Version:  OpenGL ES 2.0 (WebGL 1.0)
INFO:     > GLSL:     OpenGL ES GLSL ES 1.00 (WebGL GLSL ES 1.0 (1.0))
INFO: GL: VAO extension detected, VAO functions loaded successfully
WARNING: GL: NPOT textures extension not found, limited NPOT support (no-mipmaps, no-repeat)
INFO: GL: DXT compressed textures supported
INFO: GL: ETC1 compressed textures supported
INFO: PLATFORM: WEB: Initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 2] Default texture loaded successfully
INFO: SHADER: [ID 3] Vertex shader compiled successfully
INFO: SHADER: [ID 4] Fragment shader compiled successfully
INFO: SHADER: [ID 5] Program shader loaded successfully
INFO: SHADER: [ID 5] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 12] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: SYSTEM: Working Directory: /
INFO: FILEIO: [resources/textures/fudesumi.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (384x512 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 13] Texture loaded successfully (384x512 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [resources/shaders/glsl330/outline.fs] Text file loaded successfully
WARNING: SHADER: [ID 14] Failed to compile fragment shader code
WARNING: SHADER: [ID 14] Compile error: ERROR: 0:1: '
' : invalid version directive
ERROR: 0:4: 'in' : storage qualifier supported in GLSL ES 3.00 and above only
ERROR: 0:4: '' : No precision specified for (float)
ERROR: 0:5: 'in' : storage qualifier supported in GLSL ES 3.00 and above only
ERROR: 0:5: '' : No precision specified for (float)
ERROR: 0:9: '' : No precision specified for (float)
ERROR: 0:11: '' : No precision specified for (float)
ERROR: 0:12: '' : No precision specified for (float)
ERROR: 0:13: '' : No precision specified for (float)
ERROR: 0:16: 'out' : storage qualifier supported in GLSL ES 3.00 and above only
ERROR: 0:16: '' : No precision specified for (float)
ERROR: 0:20: '' : No precision specified for (float)
ERROR: 0:20: 'texture' : no matching overloaded function found
ERROR: 0:20: '=' : dimension mismatch
ERROR: 0:20: '=' : cannot convert from 'const mediump float' to '4-component vector of float'
ERROR: 0:21: '' : No precision specified for (float)
ERROR: 0:26: '' : No precision specified for (float)
ERROR: 0:27: 'texture' : no matching overloaded function found
ERROR: 0:27: 'a' :  field selection requires structure or vector on left hand side
ERROR: 0:28: 'texture' : no matching overloaded function found
ERROR: 0:28: 'a' :  field selection requires structure or vector on left hand side
ERROR: 0:29: 'texture' : no matching overloaded function found
ERROR: 0:29: 'a' :  field selection requires structure or vector on left hand side
ERROR: 0:30: 'texture' : no matching overloaded function found
ERROR: 0:30: 'a' :  field selection requires structure or vector on left hand side
ERROR: 0:32: '' : No precision specified for (float)
ERROR: 0:33: '' : No precision specified for (float)

INFO: TEXTURE: [ID 13] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 12] Unloaded texture data from VRAM (GPU)
INFO: SHADER: [ID 5] Default shader unloaded successfully
INFO: TEXTURE: [ID 2] Default texture unloaded successfully
INFO: Window closed successfully
error: LoadShader
texture_outline
└─ run /Users/nii236/gamedev/emsdk/upstream/emscripten/emrun failure
error: the following command exited with error code 1:
/Users/nii236/gamedev/emsdk/upstream/emscripten/emrun zig-out/htmlout/index.html
Build Summary: 6/8 steps succeeded; 1 failed
texture_outline transitive failure
└─ run /Users/nii236/gamedev/emsdk/upstream/emscripten/emrun failure
error: the following build command failed with exit code 1:
/Users/nii236/gamedev/raylib-zig/.zig-cache/o/02825d3c8f32fd5ebe923c456607d91f/build /Users/nii236/.zvm/0.14.0/zig /Users/nii236/.zvm/0.14.0/lib /Users/nii236/gamedev/raylib-zig /Users/nii236/gamedev/raylib-zig/.zig-cache /Users/nii236/.cache/zig --seed 0x9ed2576c -Z4640f493333c3707 texture_outline -Dtarget=wasm32-emscripten --sysroot /Users/nii236/gamedev/emsdk/upstream/emscripten
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

No branches or pull requests

1 participant