subagent transcript

session 18e25685 · workflow wf_23df5b1c
delegated task
You are an adversarial verifier for a FreeCAD-wasm code review. A reviewer claims: SEVERITY: low CATEGORY: gl-error-spam FILE: /home/magik6k/lcad-wasm
▸ Magik
You are an adversarial verifier for a FreeCAD-wasm code review. A reviewer claims: SEVERITY: low CATEGORY: gl-error-spam FILE: /home/magik6k/lcad-wasm/freecad-port/FreeCAD/src/Gui/WasmGLFixedFunc.cpp SUMMARY: Emulated GL_TEXTURE_2D enable/disable issues g.disable(TEXTURE_2D), an INVALID_ENUM in WebGL2. DETAIL/EVIDENCE: WasmGLFixedFunc.cpp:330 handles cap 0x0DE1 (GL_TEXTURE_2D) with 'enable?g.disable(g.TEXTURE_2D||0):0'. TEXTURE_2D is not a toggleable capability in GLES3/WebGL2, so gl.disable(TEXTURE_2D) raises GL_INVALID_ENUM on every fixed-function glEnable(GL_TEXTURE_2D). It is non-fatal (the branch returns 1, so no fall-through), but produces a GL error / console noise each frame Coin toggles texturing, and the enable-calls-disable logic is backwards. RECOMMENDATION: Make cap 0x0DE1 a pure no-op that just returns 1 (track a JS-side 'textureEnabled' flag if needed); do not call g.disable(TEXTURE_2D). Independently verify by reading the actual file(s) and running git/grep as needed (repo at /home/magik6k/lcad-wasm/freecad-port/FreeCAD, toolchain at /opt/toolchains, deploy at /home/magik6k/lcad-wasm/freecad-port/deploy-gui). Default to REFUTED if you cannot confirm the evidence. Adjust severity to what the evidence actually supports.
Fable
thinking
I'll check the file to confirm that.
Fable
⚙ Read {"file_path": "/home/magik6k/lcad-wasm/freecad-port/FreeCAD/src/Gui/WasmGLFixedFunc.cpp", "offset": 300, "limit": 60}
tool result
300	}
301	void glMaterialf(GLenum, GLenum, GLfloat){ }
302	void glMateriali(GLenum, GLenum, GLint){ }
303	void glColorMaterial(GLenum, GLenum){ }
304	void glShadeModel(GLenum){ }
305	void glLightf(GLenum, GLenum, GLfloat){ }
306	void glLighti(GLenum, GLenum, GLint){ }
307	void glLightModelfv(GLenum, const GLfloat*){ }
308	void glLightModeli(GLenum, GLint){ }
309	void glLightfv(GLenum light, GLenum pname, const GLfloat* params){
310	    ensure();
311	    if (pname == 0x1203 /*GL_POSITION*/) {
312  …[truncated]
Fable
thinking
Looking at line 330, I can see the issue: when `enable` is truthy, it calls `g.disable(g.TEXTURE_2D||0)`, but `TEXTURE_2D` isn't a valid capability for the `disable` function even though it's a legitimate WebGL2 constant for texture targets. The error happens whenever `glEnable(GL_TEXTURE_2D)` is called, which confirms this is a real issue that occurs during texture toggling. Severity low is appropriate.
Fable
The evidence is confirmed exactly. Line 330 reads: `case 0x0DE1: if(g){ enable?g.disable(g.TEXTURE_2D||0):0; } return 1; // GL_TEXTURE_2D` `g.TEXTURE_2D` is `0x0DE1`, which is a valid texture target but not a valid capability for `gl.disable()` in WebGL2/GLES3 (valid caps are BLEND, CULL_FACE, DEPTH_TEST, DITHER, POLYGON_OFFSET_FILL, SAMPLE_ALPHA_TO_COVERAGE, SAMPLE_COVERAGE, SCISSOR_TEST, STENCIL_TEST, RASTERIZER_DISCARD). So `gl.disable(0x0DE1)` raises `GL_INVALID_ENUM`. The branch returns 1 so there is no fall-through and it is non-fatal, and the enable→disable logic is indeed backwards (only the `enable` truthy case triggers a disable call). Severity low is appropriate: it is pure console/GL-error noise, non-fatal.
Fable
⚙ StructuredOutput {"verdict": "CONFIRMED", "reason": "Line 330 of WasmGLFixedFunc.cpp contains exactly `case 0x0DE1: if(g){ enable?g.disable(g.TEXTURE_2D||0):0; } return 1; // GL_TEXTURE_2D`. g.TEXTURE_2D resolves to 0x0DE1, a texture target, not a valid cap…
tool result
Structured output provided successfully