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

[WIP] update naga to 0.13.0 #37

Closed
wants to merge 4 commits into from

Conversation

VitalyAnkh
Copy link
Contributor

@VitalyAnkh VitalyAnkh commented Jul 24, 2023

Still WIP. Fix #33.

@VitalyAnkh VitalyAnkh force-pushed the update-naga-to-0.13 branch from 6d32366 to 0152fd0 Compare July 24, 2023 11:15
Copy link
Collaborator

@robtfm robtfm left a comment

Choose a reason for hiding this comment

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

thanks for looking at this. i haven't had much time to look into the new naga version so my comments may not be right ...

src/derive.rs Outdated Show resolved Hide resolved
src/derive.rs Outdated
init: if c.r#override == Override::None {
self.import_const_expression(&c.init)
} else {
// r#override doesn't do anything now
Copy link
Collaborator

Choose a reason for hiding this comment

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

it looks to me like init and override can both be specified - init is the default if an override is not provided on the pipeline.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but the override doesn't do anything at this time. Maybe we should wait for naga to add functionality for this override field?

Copy link
Collaborator

Choose a reason for hiding this comment

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

i'd just import/copy both the fields over. no reason not to

src/derive.rs Outdated
init: self.import_const_expression(&c.init),
}
}
// TODO
Copy link
Collaborator

Choose a reason for hiding this comment

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

const_expressions can be more than just constants, they can be compound expressions as long as all the components are const_expressions as well.

i haven't looked in a lot of detail, but i think rather than making a new function here, the easier thing to do is to use the existing import_expression fn passing self.const_expressions and self.shader.const_expressions in as the new and old arenas (instead of the function-local arenas that are used when import_expression is called in function import).

you will probably need to also make a member for the already_imported param, that gets reset when the shader is changed. this might mean we end up with duplicate const_expressions if multiple modules define the same constant, but that should be ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

use the existing import_expression fn passing self.const_expressions and self.shader.const_expressions in as the new and old arenas

With this approach I'm struggling with the borrow checker 🤕 🤕 🤕 The import_expression both borrows self.const_expressions and self.shader.const_expressions exclusively. Please give me some time to fix this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think it would be pretty reasonable to change the already_imported and new_expressions params to RefCells (as well as the const_expressions and const_expressions_map members).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed them to RefCells but there are many runtime BorrowMut errors when running tests, still working at it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i don't think you should change everything to refcell, just the const_expression bits (and the params for import_expression). i should have time at the weekend for a proper look if you get stuck.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I didn't change everything to RefCell, I can't change the &mut self to &self, which occurs in import_block, import_const and other import functions, then borrow checkings errors happens: self.import_expression(...&self.const_expression_map, &self.const_expressions,...) 🤕

i should have time at the weekend for a proper look if you get stuck.

Appreciate it! I'm going on a trip tomorrow so maybe I don't have much time at the weekend, but I will try my best to work with you and make this update happen.

@robtfm
Copy link
Collaborator

robtfm commented Jul 29, 2023

closing in favour of #40. thanks for making a good start !

@robtfm robtfm closed this Jul 29, 2023
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.

Update to naga 0.13
2 participants