Fix #8756: Allow computed array indexing on non-storage vectors#8768
Open
SOUMITRO-SAHA wants to merge 1 commit intoprocessing:dev-2.0from
Open
Fix #8756: Allow computed array indexing on non-storage vectors#8768SOUMITRO-SAHA wants to merge 1 commit intoprocessing:dev-2.0from
SOUMITRO-SAHA wants to merge 1 commit intoprocessing:dev-2.0from
Conversation
- Enable array indexing for storage and vector buffers - Added validation for array literals in shaders (2-4 elements only)
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.
Resolves #8756
Changes:
This PR fixes the bug where
get()could only be used on storage buffers inp5.strands, preventing array indexing (arr[0]) on non-storage vectors like those returned from helper functions.Root Cause:
The transpiler converted ALL computed member access (
arr[0]) to.get()calls, but theget()method instrands_node.jshad a guard that only allowed it for storage buffers, throwing "get() can only be used on storage buffers" for non-storage vectors.src/strands/strands_node.jssrc/strands/strands_transpiler.jssrc/webgl/strands_glslBackend.js(AddedARRAY_ACCESShandler, missing from GLSL backend - flagged by @Nixxx19 ).test/unit/webgpu/p5.Shader.jsScreenshots of the change:
PR Checklist
npm run lintpasses