Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork35.9k
Examples - Update WebGPU Compute Water#30440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:dev
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@sunag looks good? |
@cmhhelgeson did a great job, I just would like to think a little more about |
cmhhelgeson commentedFeb 6, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Dirty version I was able to come up with in StructNode, though it currently has only limited use cases (i.e it can destructure right after creating a struct but not a struct that has been returned from a funtion). I'll try experimenting from here. destructure(){conststructMembers=this.structLayoutNode.membersLayout.map(member=>member.name);constmemberNodes={};for(constmemberofstructMembers){memberNodes[member]=this.get(member);}returnmemberNodes;} // Use Case constneighborValues=NeighborValuesStruct();const{ north, south, east, west}=neighborValues.destructure();north.assign(store.element(northIndex));south.assign(store.element(southIndex));east.assign(store.element(eastIndex));west.assign(store.element(westIndex));returnneighborValues; Would we prefer destructure(StructNodeInstance) or StructNodeInstance.destructure() |
Initially I did the assignment directly from the declaration of constneighborValues=NeighborValuesStruct();neighborValues.north.assign( ...) The problem is that this doesn't work when we work with TSL function returns. So my solution was to create Then I thought about generating a member for properties that had the constneighborValues=NeighborValuesStruct();neighborValues.$north.assign( ...) This would solve the case, since with the prefix you could still access undefined properties of the Nodes. But I would be extremely dependent on the Proxy class, and to be honest, I hope we can do everything with prototype in the future. So I was thinking about using |
👍 |
Uh oh!
There was an error while loading.Please reload this page.
Related issue:#30426
Description
Updates WebGPU Compute Water to demonstrate an example of returning a struct from a defined function. DOES NOT solve the issue mentioned by this comment in this initial struct implementation, which is still under investigation:#30394 (comment)