WireCmd: require opt-in to treat ID 0 as nullptr instead of error.

In preparation for the descriptorization of BindGroup, support was added
to treat wire ID 0 as nullptr for a bunch of objects. Now that we have a
fuzzer for the wire+frontend, we need to validate when we have a 0 id.
Either the wire needs to reject the ID or the frontend needs to validate
against nullptrs. Since only few entrypoints will have a use for
nullptrs (bind groups, render pass resolve textures), we require an
opt-in in the JSON file for a structure member or an argument to be
optional.

This disables the tests related to ID 0 = nullptr, because we don't yet
have optional argument/members in dawn.json.

BUG=chromium:905273
BUG=chromium:906418
BUG=chromium:908678

Change-Id: If9a3c4857db43ca26a90abff2437e1cebb0ab79b
Reviewed-on: https://dawn-review.googlesource.com/c/2704
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2018-11-28 17:00:33 +00:00
committed by Commit Bot service account
parent 32abaffa73
commit d8c1a48fc4
6 changed files with 47 additions and 37 deletions

View File

@@ -329,32 +329,27 @@ TEST_F(WireTests, CStringArgument) {
// Test that the wire is able to send objects as value arguments
TEST_F(WireTests, ObjectAsValueArgument) {
// Create pipeline
dawnComputePipelineDescriptor pipelineDesc;
pipelineDesc.nextInChain = nullptr;
pipelineDesc.layout = nullptr;
pipelineDesc.entryPoint = "main";
pipelineDesc.module = nullptr;
dawnComputePipeline pipeline = dawnDeviceCreateComputePipeline(device, &pipelineDesc);
// Create a RenderPassDescriptor
dawnRenderPassDescriptorBuilder renderPassBuilder = dawnDeviceCreateRenderPassDescriptorBuilder(device);
dawnRenderPassDescriptor renderPass = dawnRenderPassDescriptorBuilderGetResult(renderPassBuilder);
dawnComputePipeline apiPipeline = api.GetNewComputePipeline();
EXPECT_CALL(api, DeviceCreateComputePipeline(apiDevice, _))
.WillOnce(Return(apiPipeline));
dawnRenderPassDescriptorBuilder apiRenderPassBuilder = api.GetNewRenderPassDescriptorBuilder();
EXPECT_CALL(api, DeviceCreateRenderPassDescriptorBuilder(apiDevice))
.WillOnce(Return(apiRenderPassBuilder));
dawnRenderPassDescriptor apiRenderPass = api.GetNewRenderPassDescriptor();
EXPECT_CALL(api, RenderPassDescriptorBuilderGetResult(apiRenderPassBuilder))
.WillOnce(Return(apiRenderPass));
// Create command buffer builder, setting pipeline
// Create command buffer builder, setting render pass descriptor
dawnCommandBufferBuilder cmdBufBuilder = dawnDeviceCreateCommandBufferBuilder(device);
dawnComputePassEncoder pass = dawnCommandBufferBuilderBeginComputePass(cmdBufBuilder);
dawnComputePassEncoderSetComputePipeline(pass, pipeline);
dawnCommandBufferBuilderBeginRenderPass(cmdBufBuilder, renderPass);
dawnCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
.WillOnce(Return(apiCmdBufBuilder));
dawnComputePassEncoder apiPass = api.GetNewComputePassEncoder();
EXPECT_CALL(api, CommandBufferBuilderBeginComputePass(apiCmdBufBuilder))
.WillOnce(Return(apiPass));
EXPECT_CALL(api, ComputePassEncoderSetComputePipeline(apiPass, apiPipeline));
EXPECT_CALL(api, CommandBufferBuilderBeginRenderPass(apiCmdBufBuilder, apiRenderPass))
.Times(1);
FlushClient();
}
@@ -486,7 +481,7 @@ TEST_F(WireTests, StructureOfStructureArrayArgument) {
}
// Test passing nullptr instead of objects - object as value version
TEST_F(WireTests, NullptrAsValue) {
TEST_F(WireTests, DISABLED_NullptrAsValue) {
dawnCommandBufferBuilder builder = dawnDeviceCreateCommandBufferBuilder(device);
dawnComputePassEncoder pass = dawnCommandBufferBuilderBeginComputePass(builder);
dawnComputePassEncoderSetComputePipeline(pass, nullptr);
@@ -506,7 +501,7 @@ TEST_F(WireTests, NullptrAsValue) {
}
// Test passing nullptr instead of objects - array of objects version
TEST_F(WireTests, NullptrInArray) {
TEST_F(WireTests, DISABLED_NullptrInArray) {
dawnBindGroupLayout nullBGL = nullptr;
dawnPipelineLayoutDescriptor descriptor;