Skip to content

Fix example step 2 code in README.md - #1

Closed
mfila wants to merge 1 commit into
gpujs:masterfrom
mfila:master
Closed

Fix example step 2 code in README.md#1
mfila wants to merge 1 commit into
gpujs:masterfrom
mfila:master

Conversation

@mfila

@mfila mfila commented Oct 4, 2020

Copy link
Copy Markdown

Aligned the code in README.md with the one used in example.js.

Aligned the code in README.md with the one used in example.js.
@fuzzie360

Copy link
Copy Markdown
Member

Thanks for this @mfila, and sorry it sat for so long.

Your fix is correct. I verified it: on master the step 2 snippet passes the weights coords to .at() and the filter coords to .add(), which is backwards — .at() indexes the 2×2 parent out of bounds and throws. With your swap the snippet reproduces the README's own documented output byte-for-byte.

It turned out there was a second defect in the same snippets that this didn't cover: both reference filter.length, but no filter variable is ever defined, so the code still throws a ReferenceError on paste. Rather than merge and then immediately patch on top, I've folded your change together with that fix into #2, which also covers the security and CI work for this repo. Your commit is credited in the message there.

Closing this as incorporated — the fix is yours, it just ships via #2. Thanks again for reporting it.

@fuzzie360 fuzzie360 closed this Jul 27, 2026
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

Successfully merging this pull request may close these issues.

2 participants