Fix WASM build: undeclared OpenGL constants - #240
Conversation
The WASM build was failing because it was trying to use desktop-only OpenGL constants like `GL_CONTEXT_PROFILE_MASK` and `GL_CONTEXT_FLAGS`, which are not available in OpenGL ES / WebGL 2.0. This commit wraps the diagnostic logging code using these constants in `#ifndef Q_OS_WASM` to ensure the project compiles for WebAssembly.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a WASM-specific guard around OpenGL context profile and flags logging so the WebAssembly build does not reference desktop-only OpenGL constants, while preserving behavior on native targets. Sequence diagram for MapCanvas::reportGLVersion with WASM guardsequenceDiagram
participant MapCanvas
participant gl as QOpenGLFunctions
participant Logger
MapCanvas->>gl: glGetString(GL_VERSION)
MapCanvas->>Logger: logString("OpenGL Version", GL_VERSION)
MapCanvas->>Logger: logString("OpenGL Vendor", GL_VENDOR)
MapCanvas->>Logger: logString("OpenGL GLSL", GL_SHADING_LANGUAGE_VERSION)
alt [not Q_OS_WASM]
MapCanvas->>gl: glGetInteger(GL_CONTEXT_PROFILE_MASK)
MapCanvas->>gl: glGetInteger(GL_CONTEXT_FLAGS)
MapCanvas->>Logger: logVector("OpenGL context profile", v, flags)
MapCanvas->>Logger: logVector("OpenGL context flags", v, flags)
else [Q_OS_WASM]
Note over MapCanvas,Logger: Context profile and flags logging skipped on WASM
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider adding a brief comment near the
#ifndef Q_OS_WASMguard explaining why these OpenGL profile/flag queries are desktop-only so future platform-specific changes are easier to reason about. - If possible, prefer checking for the presence of the relevant OpenGL extensions/capabilities instead of a platform macro (
Q_OS_WASM), so this code behaves correctly on other constrained OpenGL targets that might also lack these constants.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding a brief comment near the `#ifndef Q_OS_WASM` guard explaining why these OpenGL profile/flag queries are desktop-only so future platform-specific changes are easier to reason about.
- If possible, prefer checking for the presence of the relevant OpenGL extensions/capabilities instead of a platform macro (`Q_OS_WASM`), so this code behaves correctly on other constrained OpenGL targets that might also lack these constants.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #240 +/- ##
=======================================
Coverage 25.54% 25.54%
=======================================
Files 522 522
Lines 43450 43450
Branches 4718 4718
=======================================
Hits 11100 11100
Misses 32350 32350 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Guarded desktop-only OpenGL constants in
src/display/mapcanvas_gl.cppwith#ifndef Q_OS_WASMto fix compilation errors in the WebAssembly build. Verified that the project still compiles and passes tests on the native target.PR created automatically by Jules for task 9197963362326099983 started by @nschimme
Summary by Sourcery
Bug Fixes: