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-in] Constructor improvements #1790

Merged
merged 4 commits into from
Mar 30, 2022

Conversation

teoxoy
Copy link
Member

@teoxoy teoxoy commented Mar 26, 2022

Adds support for zero value constructors and constructors that infer their type from their parameters.

Also adds 4 more types of errors to better indicate issues with constructors.

For instance, before you could construct atomic types

var _ = atomic<i32>(0);

now you will get this error:

error: type `atomic` is not constructible
  ┌─ wgsl:3:25
  │
3 │                 var _ = atomic<i32>(0);
  │                         ^^^^^^ type is not constructible

closes #1733
closes #1774

References
Constructors
Zero value constructors

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Very impressive work here!
We'll need a small pass to clean up some bits.

src/front/wgsl/mod.rs Outdated Show resolved Hide resolved
src/front/wgsl/mod.rs Outdated Show resolved Hide resolved
src/front/wgsl/mod.rs Outdated Show resolved Hide resolved
src/front/wgsl/mod.rs Outdated Show resolved Hide resolved
src/front/wgsl/mod.rs Outdated Show resolved Hide resolved
src/front/wgsl/mod.rs Outdated Show resolved Hide resolved
src/front/wgsl/mod.rs Outdated Show resolved Hide resolved
src/front/wgsl/mod.rs Outdated Show resolved Hide resolved
@teoxoy teoxoy requested a review from kvark March 28, 2022 10:24
Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Glorious!

@kvark kvark merged commit cfcf625 into gfx-rs:master Mar 30, 2022
@teoxoy teoxoy deleted the wgsl-constructor-improvements branch March 30, 2022 08:34
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.

WGSL constructor doesn't check length [wgsl-in] Zero value expressions are not implemented
2 participants