Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ impl<'a> DerivedModule<'a> {
gather: *gather,
coordinate: map_expr!(coordinate),
array_index: map_expr_opt!(array_index),
offset: offset.map(|c| self.import_global_expression(c)),
offset: map_expr_opt!(offset),

Choose a reason for hiding this comment

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

What is this code doing and why does this change help?

Copy link
Member Author

@tychedelia tychedelia Jun 10, 2025

Choose a reason for hiding this comment

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

You tell me! It resolves the bug. :) More specifically, it follows the pattern of most of the other items here, which is how I arrived at the solution. I haven't seen any other evidences of errors produced by this change.

Iirc, this happens when using expressions when sampling (i.e. not using constant uv coordinates). But obviously our code did that before and I have no idea what changed in the Naga that could have caused this to break. I reviewed their changelog and didn't find anything obvious.

Copy link
Contributor

@Elabajaba Elabajaba Jun 10, 2025

Choose a reason for hiding this comment

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

As the person in the git blame, I have no idea. It looks like naga just renamed const_expressions to global_expressions on Modules in naga 0.20 so I just copied their renaming. I have to relearn the map_expr! stuff every time I update naga_oil.

level: match level {
SampleLevel::Auto | SampleLevel::Zero => *level,
SampleLevel::Exact(expr) => SampleLevel::Exact(map_expr!(expr)),
Expand Down