mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
Ensure dynamic buffer offset bindings are sorted in increasing order
A previous CL sorted bindings by binding number, but bindings were first sorted by type. This means a bind group layout with mixed dynamic storage and uniform buffers would not always have all dynamic bindings in increasing order. Instead, it would be strictly increasing within each section of uniform/storage buffers. This CL corrects the issue by first sorting dynamic buffers by binding number. Bug: dawn:408 Change-Id: I3689eb64ad8aa8768cebe266eebcba75a21894ce Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22303 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
4c32bd0b7d
commit
f7a98fa854
@@ -1012,11 +1012,13 @@ TEST_F(SetBindGroupValidationTest, BindingSizeOutOfBoundDynamicStorageBuffer) {
|
||||
TEST_F(SetBindGroupValidationTest, DynamicOffsetOrder) {
|
||||
// Note: The order of the binding numbers of the bind group and bind group layout are
|
||||
// intentionally different and not in increasing order.
|
||||
// This test uses both storage and uniform buffers to ensure buffer bindings are sorted first by
|
||||
// binding number before type.
|
||||
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||
device, {
|
||||
{3, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageBuffer, true},
|
||||
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageBuffer, true},
|
||||
{2, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageBuffer, true},
|
||||
{2, wgpu::ShaderStage::Compute, wgpu::BindingType::UniformBuffer, true},
|
||||
});
|
||||
|
||||
// Create buffers which are 3x, 2x, and 1x the size of the minimum buffer offset, plus 4 bytes
|
||||
@@ -1028,7 +1030,7 @@ TEST_F(SetBindGroupValidationTest, DynamicOffsetOrder) {
|
||||
wgpu::Buffer buffer2x =
|
||||
CreateBuffer(2 * kMinDynamicBufferOffsetAlignment + 4, wgpu::BufferUsage::Storage);
|
||||
wgpu::Buffer buffer1x =
|
||||
CreateBuffer(1 * kMinDynamicBufferOffsetAlignment + 4, wgpu::BufferUsage::Storage);
|
||||
CreateBuffer(1 * kMinDynamicBufferOffsetAlignment + 4, wgpu::BufferUsage::Uniform);
|
||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, bgl,
|
||||
{
|
||||
{0, buffer3x, 0, 4},
|
||||
|
||||
Reference in New Issue
Block a user