Skip to content

Commit

Permalink
HLSL-IR: Use stable_sort to sort members in ShaderIO (part 2)
Browse files Browse the repository at this point in the history
I only updated one of the two calls to std::sort in my last CL:
https://dawn-review.googlesource.com/c/dawn/+/212355

Bug: 364865292
Bug: 376052018
Change-Id: I7c9e2ac4637cda98d8c1349cfb7ec6dd5b5a815f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/212738
Auto-Submit: Antonio Maiorano <[email protected]>
Commit-Queue: Antonio Maiorano <[email protected]>
Reviewed-by: James Price <[email protected]>
  • Loading branch information
amaiorano authored and Dawn LUCI CQ committed Oct 28, 2024
1 parent 9eb59d0 commit 5f21563
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tint/lang/hlsl/writer/raise/shader_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,10 @@ struct StateImpl : core::ir::transform::ShaderIOBackendState {
}

// Sort the struct members to satisfy HLSL interfacing matching rules.
std::sort(output_data.begin(), output_data.end(),
[&](auto& x, auto& y) { return StructMemberComparator(x, y); });
// We use stable_sort so that two members with the same attributes maintain their relative
// ordering (e.g. kClipDistance).
std::stable_sort(output_data.begin(), output_data.end(),
[&](auto& x, auto& y) { return StructMemberComparator(x, y); });

output_indices.Resize(outputs.Length());
output_values.Resize(outputs.Length(), nullptr);
Expand Down

0 comments on commit 5f21563

Please sign in to comment.