Commit ca13dbc
authored
webgl: fix glGetUniform*v ignoring program param (#26845)
Fixes #26844. PR created with AI assistance.
`$emscriptenWebGLGetUniform` resolved its uniform location via
`$webglGetUniformLocation`, which uses `GLctx.currentProgram`. Per the
GLES spec, `glGetUniform*v` takes the program explicitly and does not
require `glUseProgram`. Calling it without a current program returned
undefined and `GLctx.getUniform` threw a `TypeError`.
Additionally, under `-sGL_ASSERTIONS`, the location validation ran
before the integer-`GLuint` -> `WebGLProgram` swap, dereferencing a
property of a `Number` and crashing.
Fix both: run assertions in the correct order around the swap and
prepare call, and resolve the location against the explicit program
inline. Adds a parameterized regression test.1 parent 112eaf3 commit ca13dbc
4 files changed
Lines changed: 116 additions & 16 deletions
File tree
- src/lib
- test
- browser
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
517 | | - | |
| 517 | + | |
518 | 518 | | |
519 | | - | |
| 519 | + | |
520 | 520 | | |
521 | 521 | | |
522 | | - | |
| 522 | + | |
523 | 523 | | |
524 | | - | |
| 524 | + | |
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2121 | 2121 | | |
2122 | 2122 | | |
2123 | 2123 | | |
2124 | | - | |
| 2124 | + | |
2125 | 2125 | | |
2126 | 2126 | | |
2127 | 2127 | | |
| |||
2139 | 2139 | | |
2140 | 2140 | | |
2141 | 2141 | | |
2142 | | - | |
| 2142 | + | |
2143 | 2143 | | |
2144 | 2144 | | |
2145 | 2145 | | |
| |||
2173 | 2173 | | |
2174 | 2174 | | |
2175 | 2175 | | |
2176 | | - | |
2177 | | - | |
2178 | | - | |
2179 | | - | |
| 2176 | + | |
| 2177 | + | |
2180 | 2178 | | |
2181 | 2179 | | |
2182 | 2180 | | |
2183 | | - | |
| 2181 | + | |
2184 | 2182 | | |
2185 | 2183 | | |
2186 | 2184 | | |
2187 | | - | |
| 2185 | + | |
2188 | 2186 | | |
2189 | 2187 | | |
2190 | 2188 | | |
2191 | 2189 | | |
2192 | 2190 | | |
2193 | 2191 | | |
2194 | 2192 | | |
2195 | | - | |
| 2193 | + | |
2196 | 2194 | | |
2197 | | - | |
2198 | | - | |
| 2195 | + | |
| 2196 | + | |
2199 | 2197 | | |
2200 | 2198 | | |
2201 | 2199 | | |
2202 | 2200 | | |
2203 | | - | |
| 2201 | + | |
2204 | 2202 | | |
2205 | 2203 | | |
2206 | 2204 | | |
| |||
2211 | 2209 | | |
2212 | 2210 | | |
2213 | 2211 | | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
2214 | 2223 | | |
2215 | 2224 | | |
2216 | 2225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1243 | 1243 | | |
1244 | 1244 | | |
1245 | 1245 | | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
1246 | 1254 | | |
1247 | 1255 | | |
1248 | 1256 | | |
| |||
0 commit comments