Repository navigation
[GL] Store GLEmulation.materialShininess as a scalar number. NFC - #28107
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the materialShininess property in src/lib/libglemu.js from a single-element Float32Array to a primitive number initialized to 0. While this simplifies the code, a review comment correctly points out that completely removing the initialization line during state reset can lead to state leakage across context resets. It is recommended to explicitly reset GLEmulation.materialShininess to 0 in the re-initialization block.
Unlike the other material properties (`materialAmbient`, `materialDiffuse`, `materialSpecular`, and `materialEmission`), which are 4-component vectors passed to `GLctx.uniform4fv`, `materialShininess` is a single float passed to `GLctx.uniform1f`. Store `GLEmulation.materialShininess` directly as a number initialized to `0` (matching other scalar uniforms such as `fogStart` and `alphaTestRef`) instead of wrapping it in a 1-element `Float32Array`. This also avoids a Closure Compiler type warning on `GLEmulation.materialShininess[0]` when compiling with `-sEXPORT_ES6`. Split out from emscripten-core#27747
sbc100
force-pushed
the
glemu-material-shininess
branch
from
October 29, 2026 22:58
4ea223e to
43fb8c1
Compare
sbc100
enabled auto-merge (squash)
October 29, 2026 23:04
kripken
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unlike the other material properties (
materialAmbient,materialDiffuse,materialSpecular, andmaterialEmission), which are 4-component vectors passed toGLctx.uniform4fv,materialShininessis a single float passed toGLctx.uniform1f.Store
GLEmulation.materialShininessdirectly as a number initialized to0(matching other scalar uniforms such asfogStartandalphaTestRef) instead of wrapping it in a 1-elementFloat32Array. This also avoids a Closure Compiler type warning onGLEmulation.materialShininess[0]when compiling with-sEXPORT_ES6.Split out from #27747