Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WGSL] [WASM] Add reflection endpoints + Fix bit manipulation operations #5499

Merged
merged 10 commits into from
Nov 8, 2024

Conversation

saipraveenb25
Copy link
Collaborator

  • Add necessary layout reflection endpoints to Slang API's WASM bindings.
  • Emit parenthesis around bit-shift, bit-xor and bit-or operations to avoid WGSL compiler complaining about precendence issues.

csyonghe
csyonghe previously approved these changes Nov 5, 2024
@@ -386,6 +386,47 @@ HashedString* ComponentType::loadStrings()
return hashedStrings;
}

ProgramLayout* ComponentType::getLayout(unsigned int targetIndex)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to making really hard in javascript to ensure all these reflection objects are explicitly delete()'d when they are no longer in use.

We should instead just return a raw pointer to the layout without allocating a fresh object on the heap, and use allow_raw_pointers in emscripten bind, to free the javascript side from the responsibility of manually calling delete().

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let me see if I can change up the wasm bindings

@saipraveenb25
Copy link
Collaborator Author

/format

@slangbot
Copy link
Contributor

slangbot commented Nov 5, 2024

🌈 Formatted, please merge the changes from this PR

@csyonghe
Copy link
Collaborator

csyonghe commented Nov 7, 2024

@saipraveenb25 this PR is still not ready to merge, can you fix the formatting?

@csyonghe
Copy link
Collaborator

csyonghe commented Nov 7, 2024

@saipraveenb25 do you have plans to change the pointer ownership model in the wasm binding here?

csyonghe
csyonghe previously approved these changes Nov 8, 2024
Copy link
Collaborator

@csyonghe csyonghe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need another formatting pass. You can setup vscode to perform a format-on-save, so you don't need to worry about formatting anymore.

@saipraveenb25 saipraveenb25 merged commit f66b046 into shader-slang:master Nov 8, 2024
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants