mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
Update SetBindGroup dynamic offsets to uint32_t
In WebGPU these are uint32_t because Vulkan accepts at most a 32-bit unsigned integer. Bug: dawn:22 Change-Id: Ia61cd710f80c19135ac215a9a93ef9a8f683bac2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12942 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
c5e06a5d9f
commit
314fd3513d
@@ -571,7 +571,7 @@ TEST_P(BindGroupTests, SetDynamicBindGroupBeforePipeline) {
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
|
||||
// Set the first dynamic bind group.
|
||||
uint64_t dynamicOffset = 0;
|
||||
uint32_t dynamicOffset = 0;
|
||||
pass.SetBindGroup(0, bindGroup, 1, &dynamicOffset);
|
||||
|
||||
// Set the second dynamic bind group.
|
||||
@@ -645,7 +645,7 @@ TEST_P(BindGroupTests, BindGroupsPersistAfterPipelineChange) {
|
||||
|
||||
// Set the first bind group at a dynamic offset.
|
||||
// This bind group matches the slot in the pipeline layout.
|
||||
uint64_t dynamicOffset = 0;
|
||||
uint32_t dynamicOffset = 0;
|
||||
pass.SetBindGroup(0, bindGroup, 1, &dynamicOffset);
|
||||
|
||||
// Set the second bind group at a dynamic offset.
|
||||
@@ -740,7 +740,7 @@ TEST_P(BindGroupTests, DrawThenChangePipelineAndBindGroup) {
|
||||
pass.SetPipeline(pipeline0);
|
||||
|
||||
// Set the first bind group to color0 in the dynamic uniform buffer.
|
||||
uint64_t dynamicOffset = 0;
|
||||
uint32_t dynamicOffset = 0;
|
||||
pass.SetBindGroup(0, uniformBindGroup, 1, &dynamicOffset);
|
||||
|
||||
// Set the first bind group to color1 in the dynamic uniform buffer.
|
||||
|
||||
@@ -216,7 +216,7 @@ TEST_P(DynamicBufferOffsetTests, BasicRenderPipeline) {
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
std::array<uint64_t, 2> offsets = {0, 0};
|
||||
std::array<uint32_t, 2> offsets = {0, 0};
|
||||
wgpu::RenderPassEncoder renderPassEncoder =
|
||||
commandEncoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
renderPassEncoder.SetPipeline(pipeline);
|
||||
@@ -237,7 +237,7 @@ TEST_P(DynamicBufferOffsetTests, SetDynamicOffestsRenderPipeline) {
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
std::array<uint64_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
std::array<uint32_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
kMinDynamicBufferOffsetAlignment};
|
||||
wgpu::RenderPassEncoder renderPassEncoder =
|
||||
commandEncoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
@@ -258,7 +258,7 @@ TEST_P(DynamicBufferOffsetTests, SetDynamicOffestsRenderPipeline) {
|
||||
TEST_P(DynamicBufferOffsetTests, BasicComputePipeline) {
|
||||
wgpu::ComputePipeline pipeline = CreateComputePipeline();
|
||||
|
||||
std::array<uint64_t, 2> offsets = {0, 0};
|
||||
std::array<uint32_t, 2> offsets = {0, 0};
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
|
||||
@@ -277,7 +277,7 @@ TEST_P(DynamicBufferOffsetTests, BasicComputePipeline) {
|
||||
TEST_P(DynamicBufferOffsetTests, SetDynamicOffestsComputePipeline) {
|
||||
wgpu::ComputePipeline pipeline = CreateComputePipeline();
|
||||
|
||||
std::array<uint64_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
std::array<uint32_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
kMinDynamicBufferOffsetAlignment};
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
@@ -303,7 +303,7 @@ TEST_P(DynamicBufferOffsetTests, InheritDynamicOffestsRenderPipeline) {
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
std::array<uint64_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
std::array<uint32_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
kMinDynamicBufferOffsetAlignment};
|
||||
wgpu::RenderPassEncoder renderPassEncoder =
|
||||
commandEncoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
@@ -332,7 +332,7 @@ TEST_P(DynamicBufferOffsetTests, InheritDynamicOffestsComputePipeline) {
|
||||
wgpu::ComputePipeline pipeline = CreateComputePipeline();
|
||||
wgpu::ComputePipeline testPipeline = CreateComputePipeline(true);
|
||||
|
||||
std::array<uint64_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
std::array<uint32_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
kMinDynamicBufferOffsetAlignment};
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
@@ -360,9 +360,9 @@ TEST_P(DynamicBufferOffsetTests, UpdateDynamicOffestsMultipleTimesRenderPipeline
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
std::array<uint64_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
std::array<uint32_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
kMinDynamicBufferOffsetAlignment};
|
||||
std::array<uint64_t, 2> testOffsets = {0, 0};
|
||||
std::array<uint32_t, 2> testOffsets = {0, 0};
|
||||
|
||||
wgpu::RenderPassEncoder renderPassEncoder =
|
||||
commandEncoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
@@ -384,9 +384,9 @@ TEST_P(DynamicBufferOffsetTests, UpdateDynamicOffestsMultipleTimesRenderPipeline
|
||||
TEST_P(DynamicBufferOffsetTests, UpdateDynamicOffsetsMultipleTimesComputePipeline) {
|
||||
wgpu::ComputePipeline pipeline = CreateComputePipeline();
|
||||
|
||||
std::array<uint64_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
std::array<uint32_t, 2> offsets = {kMinDynamicBufferOffsetAlignment,
|
||||
kMinDynamicBufferOffsetAlignment};
|
||||
std::array<uint64_t, 2> testOffsets = {0, 0};
|
||||
std::array<uint32_t, 2> testOffsets = {0, 0};
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
|
||||
|
||||
@@ -541,7 +541,7 @@ void DrawCallPerf::RecordRenderCommands(Encoder pass) {
|
||||
break;
|
||||
|
||||
case BindGroup::Dynamic: {
|
||||
uint64_t dynamicOffset = static_cast<uint64_t>(i * mAlignedUniformSize);
|
||||
uint32_t dynamicOffset = static_cast<uint32_t>(i * mAlignedUniformSize);
|
||||
pass.SetBindGroup(uniformBindGroupIndex, mUniformBindGroups[0], 1, &dynamicOffset);
|
||||
} break;
|
||||
|
||||
|
||||
@@ -693,7 +693,7 @@ class SetBindGroupValidationTest : public ValidationTest {
|
||||
}
|
||||
|
||||
void TestRenderPassBindGroup(wgpu::BindGroup bindGroup,
|
||||
uint64_t* offsets,
|
||||
uint32_t* offsets,
|
||||
uint32_t count,
|
||||
bool expectation) {
|
||||
wgpu::RenderPipeline renderPipeline = CreateRenderPipeline();
|
||||
@@ -713,7 +713,7 @@ class SetBindGroupValidationTest : public ValidationTest {
|
||||
}
|
||||
|
||||
void TestComputePassBindGroup(wgpu::BindGroup bindGroup,
|
||||
uint64_t* offsets,
|
||||
uint32_t* offsets,
|
||||
uint32_t count,
|
||||
bool expectation) {
|
||||
wgpu::ComputePipeline computePipeline = CreateComputePipeline();
|
||||
@@ -741,7 +741,7 @@ TEST_F(SetBindGroupValidationTest, Basic) {
|
||||
device, mBindGroupLayout,
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
||||
std::array<uint64_t, 2> offsets = {256, 0};
|
||||
std::array<uint32_t, 2> offsets = {256, 0};
|
||||
|
||||
TestRenderPassBindGroup(bindGroup, offsets.data(), 2, true);
|
||||
|
||||
@@ -758,7 +758,7 @@ TEST_F(SetBindGroupValidationTest, DynamicOffsetsMismatch) {
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
||||
// Number of offsets mismatch.
|
||||
std::array<uint64_t, 1> mismatchOffsets = {0};
|
||||
std::array<uint32_t, 1> mismatchOffsets = {0};
|
||||
|
||||
TestRenderPassBindGroup(bindGroup, mismatchOffsets.data(), 1, false);
|
||||
|
||||
@@ -775,7 +775,7 @@ TEST_F(SetBindGroupValidationTest, DynamicOffsetsNotAligned) {
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
||||
// Dynamic offsets are not aligned.
|
||||
std::array<uint64_t, 2> notAlignedOffsets = {1, 2};
|
||||
std::array<uint32_t, 2> notAlignedOffsets = {1, 2};
|
||||
|
||||
TestRenderPassBindGroup(bindGroup, notAlignedOffsets.data(), 2, false);
|
||||
|
||||
@@ -792,7 +792,7 @@ TEST_F(SetBindGroupValidationTest, OffsetOutOfBoundDynamicUniformBuffer) {
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
||||
// Dynamic offset + offset is larger than buffer size.
|
||||
std::array<uint64_t, 2> overFlowOffsets = {1024, 0};
|
||||
std::array<uint32_t, 2> overFlowOffsets = {1024, 0};
|
||||
|
||||
TestRenderPassBindGroup(bindGroup, overFlowOffsets.data(), 2, false);
|
||||
|
||||
@@ -809,7 +809,7 @@ TEST_F(SetBindGroupValidationTest, OffsetOutOfBoundDynamicStorageBuffer) {
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
||||
// Dynamic offset + offset is larger than buffer size.
|
||||
std::array<uint64_t, 2> overFlowOffsets = {0, 1024};
|
||||
std::array<uint32_t, 2> overFlowOffsets = {0, 1024};
|
||||
|
||||
TestRenderPassBindGroup(bindGroup, overFlowOffsets.data(), 2, false);
|
||||
|
||||
@@ -827,7 +827,7 @@ TEST_F(SetBindGroupValidationTest, BindingSizeOutOfBoundDynamicUniformBuffer) {
|
||||
|
||||
// Dynamic offset + offset isn't larger than buffer size.
|
||||
// But with binding size, it will trigger OOB error.
|
||||
std::array<uint64_t, 2> offsets = {512, 0};
|
||||
std::array<uint32_t, 2> offsets = {512, 0};
|
||||
|
||||
TestRenderPassBindGroup(bindGroup, offsets.data(), 2, false);
|
||||
|
||||
@@ -843,7 +843,7 @@ TEST_F(SetBindGroupValidationTest, BindingSizeOutOfBoundDynamicStorageBuffer) {
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
// Dynamic offset + offset isn't larger than buffer size.
|
||||
// But with binding size, it will trigger OOB error.
|
||||
std::array<uint64_t, 2> offsets = {0, 512};
|
||||
std::array<uint32_t, 2> offsets = {0, 512};
|
||||
|
||||
TestRenderPassBindGroup(bindGroup, offsets.data(), 2, false);
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ TEST_F(WireArgumentTests, ValueArrayArgument) {
|
||||
WGPUCommandEncoder encoder = wgpuDeviceCreateCommandEncoder(device, nullptr);
|
||||
WGPUComputePassEncoder pass = wgpuCommandEncoderBeginComputePass(encoder, nullptr);
|
||||
|
||||
std::array<uint64_t, 4> testOffsets = {0, 42, 0xDEAD'BEEF'DEAD'BEEFu, 0xFFFF'FFFF'FFFF'FFFFu};
|
||||
std::array<uint32_t, 4> testOffsets = {0, 42, 0xDEAD'BEEFu, 0xFFFF'FFFFu};
|
||||
wgpuComputePassEncoderSetBindGroup(pass, 0, bindGroup, testOffsets.size(), testOffsets.data());
|
||||
|
||||
WGPUCommandEncoder apiEncoder = api.GetNewCommandEncoder();
|
||||
@@ -82,7 +82,7 @@ TEST_F(WireArgumentTests, ValueArrayArgument) {
|
||||
|
||||
EXPECT_CALL(api, ComputePassEncoderSetBindGroup(
|
||||
apiPass, 0, apiBindGroup, testOffsets.size(),
|
||||
MatchesLambda([testOffsets](const uint64_t* offsets) -> bool {
|
||||
MatchesLambda([testOffsets](const uint32_t* offsets) -> bool {
|
||||
for (size_t i = 0; i < testOffsets.size(); i++) {
|
||||
if (offsets[i] != testOffsets[i]) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user