Make dawn idl support dynamic buffer offset

This patch simply added dynamic buffer offset in dawn idl and
modify the shape of SetBindGroup.

BUG=dawn:55

Change-Id: I516e08f3ee558ba375a87d98eaea6d60e93d4514
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5600
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Yan, Shaobo 2019-03-18 06:01:37 +00:00 committed by Commit Bot service account
parent 931311700c
commit 991ab98f11
27 changed files with 130 additions and 46 deletions

View File

@ -73,7 +73,9 @@
{"value": 0, "name": "uniform buffer"}, {"value": 0, "name": "uniform buffer"},
{"value": 1, "name": "sampler"}, {"value": 1, "name": "sampler"},
{"value": 2, "name": "sampled texture"}, {"value": 2, "name": "sampled texture"},
{"value": 3, "name": "storage buffer"} {"value": 3, "name": "storage buffer"},
{"value": 4, "name": "dynamic uniform buffer"},
{"value": 5, "name": "dynamic storage buffer"}
] ]
}, },
"blend descriptor": { "blend descriptor": {
@ -375,7 +377,9 @@
"name": "set bind group", "name": "set bind group",
"args": [ "args": [
{"name": "group index", "type": "uint32_t"}, {"name": "group index", "type": "uint32_t"},
{"name": "group", "type": "bind group"} {"name": "group", "type": "bind group"},
{"name": "dynamic offset count", "type": "uint32_t"},
{"name": "dynamic offsets", "type": "uint32_t", "annotation": "const*", "length": "dynamic offset count"}
] ]
}, },
{ {
@ -776,7 +780,9 @@
"name": "set bind group", "name": "set bind group",
"args": [ "args": [
{"name": "group index", "type": "uint32_t"}, {"name": "group index", "type": "uint32_t"},
{"name": "group", "type": "bind group"} {"name": "group", "type": "bind group"},
{"name": "dynamic offset count", "type": "uint32_t"},
{"name": "dynamic offsets", "type": "uint32_t", "annotation": "const*", "length": "dynamic offset count"}
] ]
}, },
{ {

View File

@ -285,7 +285,7 @@ dawn::CommandBuffer createCommandBuffer(const dawn::Texture backbuffer, size_t i
{ {
dawn::ComputePassEncoder pass = encoder.BeginComputePass(); dawn::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(updatePipeline); pass.SetPipeline(updatePipeline);
pass.SetBindGroup(0, updateBGs[i]); pass.SetBindGroup(0, updateBGs[i], 0, nullptr);
pass.Dispatch(kNumParticles, 1, 1); pass.Dispatch(kNumParticles, 1, 1);
pass.EndPass(); pass.EndPass();
} }

View File

@ -169,7 +169,7 @@ void frame() {
{ {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup); pass.SetBindGroup(0, bindGroup, 0, nullptr);
pass.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets); pass.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets);
pass.SetIndexBuffer(indexBuffer, 0); pass.SetIndexBuffer(indexBuffer, 0);
pass.DrawIndexed(3, 1, 0, 0, 0); pass.DrawIndexed(3, 1, 0, 0, 0);

View File

@ -280,20 +280,20 @@ void frame() {
{ {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup[0]); pass.SetBindGroup(0, bindGroup[0], 0, nullptr);
pass.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets); pass.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets);
pass.SetIndexBuffer(indexBuffer, 0); pass.SetIndexBuffer(indexBuffer, 0);
pass.DrawIndexed(36, 1, 0, 0, 0); pass.DrawIndexed(36, 1, 0, 0, 0);
pass.SetStencilReference(0x1); pass.SetStencilReference(0x1);
pass.SetPipeline(planePipeline); pass.SetPipeline(planePipeline);
pass.SetBindGroup(0, bindGroup[0]); pass.SetBindGroup(0, bindGroup[0], 0, nullptr);
pass.SetVertexBuffers(0, 1, &planeBuffer, vertexBufferOffsets); pass.SetVertexBuffers(0, 1, &planeBuffer, vertexBufferOffsets);
pass.DrawIndexed(6, 1, 0, 0, 0); pass.DrawIndexed(6, 1, 0, 0, 0);
pass.SetPipeline(reflectionPipeline); pass.SetPipeline(reflectionPipeline);
pass.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets); pass.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets);
pass.SetBindGroup(0, bindGroup[1]); pass.SetBindGroup(0, bindGroup[1], 0, nullptr);
pass.DrawIndexed(36, 1, 0, 0, 0); pass.DrawIndexed(36, 1, 0, 0, 0);
pass.EndPass(); pass.EndPass();

View File

@ -525,7 +525,7 @@ namespace {
} }
const MaterialInfo& material = getMaterial(iPrim.material, strides[0], strides[1], strides[2]); const MaterialInfo& material = getMaterial(iPrim.material, strides[0], strides[1], strides[2]);
pass.SetPipeline(material.pipeline); pass.SetPipeline(material.pipeline);
pass.SetBindGroup(0, material.bindGroup0); pass.SetBindGroup(0, material.bindGroup0, 0, nullptr);
pass.SetPushConstants(dawn::ShaderStageBit::Vertex, pass.SetPushConstants(dawn::ShaderStageBit::Vertex,
0, sizeof(u_transform_block) / sizeof(uint32_t), 0, sizeof(u_transform_block) / sizeof(uint32_t),
reinterpret_cast<const uint32_t*>(&transforms)); reinterpret_cast<const uint32_t*>(&transforms));

View File

@ -138,6 +138,10 @@ namespace dawn_native {
case dawn::BindingType::Sampler: case dawn::BindingType::Sampler:
DAWN_TRY(ValidateSamplerBinding(device, binding)); DAWN_TRY(ValidateSamplerBinding(device, binding));
break; break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset.
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
return DAWN_VALIDATION_ERROR("Dawn doesn't support dynamic buffer yet");
} }
} }

View File

@ -512,6 +512,12 @@ namespace dawn_native {
case dawn::BindingType::Sampler: case dawn::BindingType::Sampler:
break; break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
break;
} }
} }
} }

View File

@ -81,7 +81,10 @@ namespace dawn_native {
memcpy(label, groupLabel, cmd->length + 1); memcpy(label, groupLabel, cmd->length + 1);
} }
void ProgrammablePassEncoder::SetBindGroup(uint32_t groupIndex, BindGroupBase* group) { void ProgrammablePassEncoder::SetBindGroup(uint32_t groupIndex,
BindGroupBase* group,
uint32_t dynamicOffsetCount,
const uint32_t* dynamicOffsets) {
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands()) || if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands()) ||
mTopLevelEncoder->ConsumedError(GetDevice()->ValidateObject(group))) { mTopLevelEncoder->ConsumedError(GetDevice()->ValidateObject(group))) {
return; return;
@ -92,6 +95,12 @@ namespace dawn_native {
return; return;
} }
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset.
if (dynamicOffsetCount != 0) {
mTopLevelEncoder->HandleError("Dynamic Buffer Offset not supported yet");
return;
}
SetBindGroupCmd* cmd = mAllocator->Allocate<SetBindGroupCmd>(Command::SetBindGroup); SetBindGroupCmd* cmd = mAllocator->Allocate<SetBindGroupCmd>(Command::SetBindGroup);
new (cmd) SetBindGroupCmd; new (cmd) SetBindGroupCmd;
cmd->index = groupIndex; cmd->index = groupIndex;

View File

@ -39,7 +39,10 @@ namespace dawn_native {
void PopDebugGroup(); void PopDebugGroup();
void PushDebugGroup(const char* groupLabel); void PushDebugGroup(const char* groupLabel);
void SetBindGroup(uint32_t groupIndex, BindGroupBase* group); void SetBindGroup(uint32_t groupIndex,
BindGroupBase* group,
uint32_t dynamicOffsetCount,
const uint32_t* dynamicOffsets);
void SetPushConstants(dawn::ShaderStageBit stages, void SetPushConstants(dawn::ShaderStageBit stages,
uint32_t offset, uint32_t offset,
uint32_t count, uint32_t count,

View File

@ -95,6 +95,12 @@ namespace dawn_native { namespace d3d12 {
&samplerDesc, samplerHeapStart.GetCPUHandle(*samplerHeapOffset + &samplerDesc, samplerHeapStart.GetCPUHandle(*samplerHeapOffset +
bindingOffsets[bindingIndex])); bindingOffsets[bindingIndex]));
} break; } break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset.
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
break;
} }
} }

View File

@ -37,6 +37,11 @@ namespace dawn_native { namespace d3d12 {
case dawn::BindingType::Sampler: case dawn::BindingType::Sampler:
mBindingOffsets[binding] = mDescriptorCounts[Sampler]++; mBindingOffsets[binding] = mDescriptorCounts[Sampler]++;
break; break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset.
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
break;
} }
} }
@ -95,6 +100,11 @@ namespace dawn_native { namespace d3d12 {
case dawn::BindingType::Sampler: case dawn::BindingType::Sampler:
mBindingOffsets[binding] += descriptorOffsets[Sampler]; mBindingOffsets[binding] += descriptorOffsets[Sampler];
break; break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset.
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
break;
} }
} }
} }

View File

@ -199,6 +199,12 @@ namespace dawn_native { namespace metal {
[compute setTexture:textureView->GetMTLTexture() atIndex:computeIndex]; [compute setTexture:textureView->GetMTLTexture() atIndex:computeIndex];
} }
} break; } break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset.
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
break;
} }
} }
} }

View File

@ -53,6 +53,11 @@ namespace dawn_native { namespace metal {
mIndexInfo[stage][group][binding] = textureIndex; mIndexInfo[stage][group][binding] = textureIndex;
textureIndex++; textureIndex++;
break; break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
break;
} }
} }
} }

View File

@ -278,6 +278,12 @@ namespace dawn_native { namespace opengl {
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, ssboIndex, buffer, glBindBufferRange(GL_SHADER_STORAGE_BUFFER, ssboIndex, buffer,
binding.offset, binding.size); binding.offset, binding.size);
} break; } break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset.
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
break;
} }
} }
} }

View File

@ -159,6 +159,12 @@ namespace dawn_native { namespace opengl {
// These binding types are handled in the separate sampler and texture // These binding types are handled in the separate sampler and texture
// emulation // emulation
break; break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset.
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
break;
} }
} }
} }

View File

@ -53,6 +53,12 @@ namespace dawn_native { namespace opengl {
mIndexInfo[group][binding] = ssboIndex; mIndexInfo[group][binding] = ssboIndex;
ssboIndex++; ssboIndex++;
break; break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
break;
} }
} }
} }

View File

@ -49,6 +49,9 @@ namespace dawn_native { namespace vulkan {
return VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; return VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
case dawn::BindingType::StorageBuffer: case dawn::BindingType::StorageBuffer:
return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
default: default:
UNREACHABLE(); UNREACHABLE();
} }
@ -125,6 +128,9 @@ namespace dawn_native { namespace vulkan {
return SAMPLED_IMAGE; return SAMPLED_IMAGE;
case dawn::BindingType::StorageBuffer: case dawn::BindingType::StorageBuffer:
return STORAGE_BUFFER; return STORAGE_BUFFER;
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
default: default:
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -108,6 +108,11 @@ namespace dawn_native { namespace vulkan {
write.pImageInfo = &writeImageInfo[numWrites]; write.pImageInfo = &writeImageInfo[numWrites];
} break; } break;
case dawn::BindingType::DynamicUniformBuffer:
case dawn::BindingType::DynamicStorageBuffer:
UNREACHABLE();
break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -27,7 +27,7 @@ protected:
dawn::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::ComputePassEncoder pass = encoder.BeginComputePass(); dawn::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup); pass.SetBindGroup(0, bindGroup, 0, nullptr);
pass.Dispatch(1, 1, 1); pass.Dispatch(1, 1, 1);
pass.EndPass(); pass.EndPass();
return encoder.Finish(); return encoder.Finish();
@ -155,7 +155,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
dawn::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup); pass.SetBindGroup(0, bindGroup, 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.EndPass(); pass.EndPass();
@ -275,7 +275,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize);
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup); pass.SetBindGroup(0, bindGroup, 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.EndPass(); pass.EndPass();
@ -370,8 +370,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
dawn::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroups[0]); pass.SetBindGroup(0, bindGroups[0], 0, nullptr);
pass.SetBindGroup(1, bindGroups[1]); pass.SetBindGroup(1, bindGroups[1], 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.EndPass(); pass.EndPass();
@ -445,10 +445,10 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets)
dawn::BindGroup bindGroup = utils::MakeBindGroup( dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, layout, { { 0, uniformBuffer, 0, sizeof(color) } }); device, layout, { { 0, uniformBuffer, 0, sizeof(color) } });
pass.SetBindGroup(0, bindGroup); pass.SetBindGroup(0, bindGroup, 0, nullptr);
pass.SetBindGroup(1, bindGroup); pass.SetBindGroup(1, bindGroup, 0, nullptr);
pass.SetBindGroup(2, bindGroup); pass.SetBindGroup(2, bindGroup, 0, nullptr);
pass.SetBindGroup(3, bindGroup); pass.SetBindGroup(3, bindGroup, 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);

View File

@ -116,12 +116,12 @@ class ColorStateTest : public DawnTest {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
// First use the base pipeline to draw a triangle with no blending // First use the base pipeline to draw a triangle with no blending
pass.SetPipeline(basePipeline); pass.SetPipeline(basePipeline);
pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({{base}}))); pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({{base}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
// Then use the test pipeline to draw the test triangle with blending // Then use the test pipeline to draw the test triangle with blending
pass.SetPipeline(testPipeline); pass.SetPipeline(testPipeline);
pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({{triangle.color}}))); pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({{triangle.color}})), 0, nullptr);
pass.SetBlendColor(&blendColor); pass.SetBlendColor(&blendColor);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.EndPass(); pass.EndPass();
@ -735,7 +735,7 @@ TEST_P(ColorStateTest, ColorWriteMaskBlendingDisabled) {
{ {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(testPipeline); pass.SetPipeline(testPipeline);
pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({{base}}))); pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({{base}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.EndPass(); pass.EndPass();
} }
@ -852,12 +852,12 @@ TEST_P(ColorStateTest, IndependentColorState) {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.SetPipeline(basePipeline); pass.SetPipeline(basePipeline);
pass.SetBindGroup( pass.SetBindGroup(
0, MakeBindGroupForColors(std::array<RGBA8, 4>({{base, base, base, base}}))); 0, MakeBindGroupForColors(std::array<RGBA8, 4>({{base, base, base, base}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.SetPipeline(testPipeline); pass.SetPipeline(testPipeline);
pass.SetBindGroup(0, MakeBindGroupForColors( pass.SetBindGroup(0, MakeBindGroupForColors(
std::array<RGBA8, 4>({{color0, color1, color2, color3}}))); std::array<RGBA8, 4>({{color0, color1, color2, color3}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.EndPass(); pass.EndPass();
} }
@ -926,11 +926,11 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(basePipeline); pass.SetPipeline(basePipeline);
pass.SetBindGroup(0, pass.SetBindGroup(0,
MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(0, 0, 0, 0)}}))); MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(0, 0, 0, 0)}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.SetPipeline(testPipeline); pass.SetPipeline(testPipeline);
pass.SetBindGroup( pass.SetBindGroup(
0, MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(255, 255, 255, 255)}}))); 0, MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(255, 255, 255, 255)}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.EndPass(); pass.EndPass();
} }
@ -948,12 +948,12 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(basePipeline); pass.SetPipeline(basePipeline);
pass.SetBindGroup(0, pass.SetBindGroup(0,
MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(0, 0, 0, 0)}}))); MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(0, 0, 0, 0)}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.SetPipeline(testPipeline); pass.SetPipeline(testPipeline);
pass.SetBlendColor(&kWhite); pass.SetBlendColor(&kWhite);
pass.SetBindGroup( pass.SetBindGroup(
0, MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(255, 255, 255, 255)}}))); 0, MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(255, 255, 255, 255)}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.EndPass(); pass.EndPass();
} }
@ -972,12 +972,12 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(basePipeline); pass.SetPipeline(basePipeline);
pass.SetBindGroup(0, pass.SetBindGroup(0,
MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(0, 0, 0, 0)}}))); MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(0, 0, 0, 0)}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.SetPipeline(testPipeline); pass.SetPipeline(testPipeline);
pass.SetBlendColor(&kWhite); pass.SetBlendColor(&kWhite);
pass.SetBindGroup( pass.SetBindGroup(
0, MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(255, 255, 255, 255)}}))); 0, MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(255, 255, 255, 255)}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.EndPass(); pass.EndPass();
} }
@ -985,11 +985,11 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(basePipeline); pass.SetPipeline(basePipeline);
pass.SetBindGroup(0, pass.SetBindGroup(0,
MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(0, 0, 0, 0)}}))); MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(0, 0, 0, 0)}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.SetPipeline(testPipeline); pass.SetPipeline(testPipeline);
pass.SetBindGroup( pass.SetBindGroup(
0, MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(255, 255, 255, 255)}}))); 0, MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(255, 255, 255, 255)}})), 0, nullptr);
pass.Draw(3, 1, 0, 0); pass.Draw(3, 1, 0, 0);
pass.EndPass(); pass.EndPass();
} }

View File

@ -79,7 +79,7 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
dawn::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::ComputePassEncoder pass = encoder.BeginComputePass(); dawn::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup); pass.SetBindGroup(0, bindGroup, 0, nullptr);
pass.Dispatch(kInstances, 1, 1); pass.Dispatch(kInstances, 1, 1);
pass.EndPass(); pass.EndPass();

View File

@ -283,7 +283,7 @@ class DepthStencilStateTest : public DawnTest {
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetStencilReference(test.stencil); // Set the stencil reference pass.SetStencilReference(test.stencil); // Set the stencil reference
pass.SetBindGroup(0, bindGroup); // Set the bind group which contains color and depth data pass.SetBindGroup(0, bindGroup, 0, nullptr); // Set the bind group which contains color and depth data
pass.Draw(6, 1, 0, 0); pass.Draw(6, 1, 0, 0);
} }
pass.EndPass(); pass.EndPass();

View File

@ -304,7 +304,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
{ {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup); pass.SetBindGroup(0, bindGroup, 0, nullptr);
pass.Draw(6, 1, 0, 0); pass.Draw(6, 1, 0, 0);
pass.EndPass(); pass.EndPass();
} }

View File

@ -216,7 +216,7 @@ TEST_P(PushConstantTest, ComputePassDefaultsToZero) {
// Test compute push constants are set to zero by default. // Test compute push constants are set to zero by default.
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, binding.bindGroup); pass.SetBindGroup(0, binding.bindGroup, 0, nullptr);
pass.Dispatch(1, 1, 1); pass.Dispatch(1, 1, 1);
// Set push constants to non-zero value to check they will be reset to zero // Set push constants to non-zero value to check they will be reset to zero
// on the next BeginComputePass // on the next BeginComputePass
@ -228,7 +228,7 @@ TEST_P(PushConstantTest, ComputePassDefaultsToZero) {
dawn::ComputePassEncoder pass = encoder.BeginComputePass(); dawn::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, binding.bindGroup); pass.SetBindGroup(0, binding.bindGroup, 0, nullptr);
pass.Dispatch(1, 1, 1); pass.Dispatch(1, 1, 1);
pass.EndPass(); pass.EndPass();
@ -285,7 +285,7 @@ TEST_P(PushConstantTest, VariousConstantTypes) {
pass.SetPushConstants(dawn::ShaderStageBit::Compute, 0, 3, reinterpret_cast<uint32_t*>(&values)); pass.SetPushConstants(dawn::ShaderStageBit::Compute, 0, 3, reinterpret_cast<uint32_t*>(&values));
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, binding.bindGroup); pass.SetBindGroup(0, binding.bindGroup, 0, nullptr);
pass.Dispatch(1, 1, 1); pass.Dispatch(1, 1, 1);
pass.EndPass(); pass.EndPass();
@ -316,12 +316,12 @@ TEST_P(PushConstantTest, InheritThroughPipelineLayoutChange) {
// Set Push constant before there is a pipeline set // Set Push constant before there is a pipeline set
pass.SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, &one); pass.SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, &one);
pass.SetPipeline(pipeline1); pass.SetPipeline(pipeline1);
pass.SetBindGroup(0, binding1.bindGroup); pass.SetBindGroup(0, binding1.bindGroup, 0, nullptr);
pass.Dispatch(1, 1, 1); pass.Dispatch(1, 1, 1);
// Change the push constant before changing pipeline layout // Change the push constant before changing pipeline layout
pass.SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, &two); pass.SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, &two);
pass.SetPipeline(pipeline2); pass.SetPipeline(pipeline2);
pass.SetBindGroup(0, binding2.bindGroup); pass.SetBindGroup(0, binding2.bindGroup, 0, nullptr);
pass.Dispatch(1, 1, 1); pass.Dispatch(1, 1, 1);
pass.EndPass(); pass.EndPass();
@ -352,7 +352,7 @@ TEST_P(PushConstantTest, SetAllConstantsToNonZero) {
pass.SetPushConstants(dawn::ShaderStageBit::Compute, 0, kMaxPushConstants, &values[0]); pass.SetPushConstants(dawn::ShaderStageBit::Compute, 0, kMaxPushConstants, &values[0]);
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, binding.bindGroup); pass.SetBindGroup(0, binding.bindGroup, 0, nullptr);
pass.Dispatch(1, 1, 1); pass.Dispatch(1, 1, 1);
pass.EndPass(); pass.EndPass();

View File

@ -142,7 +142,7 @@ protected:
{ {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&mRenderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&mRenderPass.renderPassInfo);
pass.SetPipeline(mPipeline); pass.SetPipeline(mPipeline);
pass.SetBindGroup(0, bindGroup); pass.SetBindGroup(0, bindGroup, 0, nullptr);
pass.Draw(6, 1, 0, 0); pass.Draw(6, 1, 0, 0);
pass.EndPass(); pass.EndPass();
} }

View File

@ -180,7 +180,7 @@ protected:
{ {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&mRenderPass.renderPassInfo); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&mRenderPass.renderPassInfo);
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup); pass.SetBindGroup(0, bindGroup, 0, nullptr);
pass.Draw(6, 1, 0, 0); pass.Draw(6, 1, 0, 0);
pass.EndPass(); pass.EndPass();
} }

View File

@ -193,7 +193,7 @@ TEST_F(CommandBufferValidationTest, BufferWithReadAndWriteUsage) {
DummyRenderPass dummyRenderPass(device); DummyRenderPass dummyRenderPass(device);
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass);
pass.SetIndexBuffer(buffer, 0); pass.SetIndexBuffer(buffer, 0);
pass.SetBindGroup(0, bg); pass.SetBindGroup(0, bg, 0, nullptr);
pass.EndPass(); pass.EndPass();
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
@ -224,7 +224,7 @@ TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
// Use the texture as both sampeld and output attachment in the same pass // Use the texture as both sampeld and output attachment in the same pass
dawn::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.SetBindGroup(0, bg); pass.SetBindGroup(0, bg, 0, nullptr);
pass.EndPass(); pass.EndPass();
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }