Normalize case X : {} break; to case X : { break;}
Dawn was using a very uncommon way to do breaks from case statements
when a block was introduced for that case statement. Fix it by running
the following commands:
git grep -l "} break;" | xargs sed -i "" -e "s/} break;/break;}/"
git cl format
Some -Wunreachable-code-break become very apparent in this CL but and are
fixed in a follow-up to keep mechanical and manual changes separate.
Bug: None
Change-Id: I558eda92bb1c9d938cc7cf07b091b733b57d3aca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18660
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/BindGroup.cpp b/src/dawn_native/BindGroup.cpp
index 74db217..1eae8f2 100644
--- a/src/dawn_native/BindGroup.cpp
+++ b/src/dawn_native/BindGroup.cpp
@@ -86,12 +86,14 @@
if (!texture->GetFormat().HasComponentType(bindingInfo.textureComponentType)) {
return DAWN_VALIDATION_ERROR("texture component type usage mismatch");
}
- } break;
+ break;
+ }
case wgpu::TextureUsage::Storage: {
if (texture->GetFormat().format != bindingInfo.storageTextureFormat) {
return DAWN_VALIDATION_ERROR("storage texture format mismatch");
}
- } break;
+ break;
+ }
default:
UNREACHABLE();
break;
diff --git a/src/dawn_native/BindGroupLayout.cpp b/src/dawn_native/BindGroupLayout.cpp
index cf11439..3c2cb06 100644
--- a/src/dawn_native/BindGroupLayout.cpp
+++ b/src/dawn_native/BindGroupLayout.cpp
@@ -34,7 +34,8 @@
return DAWN_VALIDATION_ERROR(
"storage buffer binding is not supported in vertex shader");
}
- } break;
+ break;
+ }
case wgpu::BindingType::WriteonlyStorageTexture: {
if ((shaderStageVisibility &
@@ -42,11 +43,13 @@
return DAWN_VALIDATION_ERROR(
"write-only storage texture binding is only supported in compute shader");
}
- } break;
+ break;
+ }
case wgpu::BindingType::StorageTexture: {
return DAWN_VALIDATION_ERROR("Read-write storage texture binding is not supported");
- } break;
+ break;
+ }
case wgpu::BindingType::UniformBuffer:
case wgpu::BindingType::ReadonlyStorageBuffer:
@@ -73,7 +76,8 @@
if (!format->supportsStorageUsage) {
return DAWN_VALIDATION_ERROR("The storage texture format is not supported");
}
- } break;
+ break;
+ }
case wgpu::BindingType::StorageBuffer:
case wgpu::BindingType::UniformBuffer:
diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp
index 9cdd4a7..23710cd 100644
--- a/src/dawn_native/CommandEncoder.cpp
+++ b/src/dawn_native/CommandEncoder.cpp
@@ -793,12 +793,14 @@
case Command::BeginComputePass: {
commands->NextCommand<BeginComputePassCmd>();
DAWN_TRY(ValidateComputePass(commands));
- } break;
+ break;
+ }
case Command::BeginRenderPass: {
const BeginRenderPassCmd* cmd = commands->NextCommand<BeginRenderPassCmd>();
DAWN_TRY(ValidateRenderPass(commands, cmd));
- } break;
+ break;
+ }
case Command::CopyBufferToBuffer: {
const CopyBufferToBufferCmd* copy =
@@ -813,7 +815,8 @@
DAWN_TRY(ValidateCanUseAs(copy->source.Get(), wgpu::BufferUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(copy->destination.Get(), wgpu::BufferUsage::CopyDst));
- } break;
+ break;
+ }
case Command::CopyBufferToTexture: {
const CopyBufferToTextureCmd* copy =
@@ -846,7 +849,8 @@
ValidateCanUseAs(copy->source.buffer.Get(), wgpu::BufferUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(copy->destination.texture.Get(),
wgpu::TextureUsage::CopyDst));
- } break;
+ break;
+ }
case Command::CopyTextureToBuffer: {
const CopyTextureToBufferCmd* copy =
@@ -879,7 +883,8 @@
ValidateCanUseAs(copy->source.texture.Get(), wgpu::TextureUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(copy->destination.buffer.Get(),
wgpu::BufferUsage::CopyDst));
- } break;
+ break;
+ }
case Command::CopyTextureToTexture: {
const CopyTextureToTextureCmd* copy =
@@ -904,24 +909,28 @@
ValidateCanUseAs(copy->source.texture.Get(), wgpu::TextureUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(copy->destination.texture.Get(),
wgpu::TextureUsage::CopyDst));
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
const InsertDebugMarkerCmd* cmd = commands->NextCommand<InsertDebugMarkerCmd>();
commands->NextData<char>(cmd->length + 1);
- } break;
+ break;
+ }
case Command::PopDebugGroup: {
commands->NextCommand<PopDebugGroupCmd>();
DAWN_TRY(ValidateCanPopDebugGroup(debugGroupStackSize));
debugGroupStackSize--;
- } break;
+ break;
+ }
case Command::PushDebugGroup: {
const PushDebugGroupCmd* cmd = commands->NextCommand<PushDebugGroupCmd>();
commands->NextData<char>(cmd->length + 1);
debugGroupStackSize++;
- } break;
+ break;
+ }
default:
return DAWN_VALIDATION_ERROR("Command disallowed outside of a pass");
}
diff --git a/src/dawn_native/CommandValidation.cpp b/src/dawn_native/CommandValidation.cpp
index dc7a3cc..4b784d4 100644
--- a/src/dawn_native/CommandValidation.cpp
+++ b/src/dawn_native/CommandValidation.cpp
@@ -37,39 +37,46 @@
case Command::Draw: {
commands->NextCommand<DrawCmd>();
DAWN_TRY(commandBufferState->ValidateCanDraw());
- } break;
+ break;
+ }
case Command::DrawIndexed: {
commands->NextCommand<DrawIndexedCmd>();
DAWN_TRY(commandBufferState->ValidateCanDrawIndexed());
- } break;
+ break;
+ }
case Command::DrawIndirect: {
commands->NextCommand<DrawIndirectCmd>();
DAWN_TRY(commandBufferState->ValidateCanDraw());
- } break;
+ break;
+ }
case Command::DrawIndexedIndirect: {
commands->NextCommand<DrawIndexedIndirectCmd>();
DAWN_TRY(commandBufferState->ValidateCanDrawIndexed());
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
InsertDebugMarkerCmd* cmd = commands->NextCommand<InsertDebugMarkerCmd>();
commands->NextData<char>(cmd->length + 1);
- } break;
+ break;
+ }
case Command::PopDebugGroup: {
commands->NextCommand<PopDebugGroupCmd>();
DAWN_TRY(ValidateCanPopDebugGroup(*debugGroupStackSize));
*debugGroupStackSize -= 1;
- } break;
+ break;
+ }
case Command::PushDebugGroup: {
PushDebugGroupCmd* cmd = commands->NextCommand<PushDebugGroupCmd>();
commands->NextData<char>(cmd->length + 1);
*debugGroupStackSize += 1;
- } break;
+ break;
+ }
case Command::SetRenderPipeline: {
SetRenderPipelineCmd* cmd = commands->NextCommand<SetRenderPipelineCmd>();
@@ -79,7 +86,8 @@
return DAWN_VALIDATION_ERROR("Pipeline attachment state is not compatible");
}
commandBufferState->SetRenderPipeline(pipeline);
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = commands->NextCommand<SetBindGroupCmd>();
@@ -88,17 +96,20 @@
}
commandBufferState->SetBindGroup(cmd->index, cmd->group.Get());
- } break;
+ break;
+ }
case Command::SetIndexBuffer: {
commands->NextCommand<SetIndexBufferCmd>();
commandBufferState->SetIndexBuffer();
- } break;
+ break;
+ }
case Command::SetVertexBuffer: {
SetVertexBufferCmd* cmd = commands->NextCommand<SetVertexBufferCmd>();
commandBufferState->SetVertexBuffer(cmd->slot);
- } break;
+ break;
+ }
default:
return DAWN_VALIDATION_ERROR(disallowedMessage);
@@ -150,7 +161,8 @@
commands->NextCommand<EndRenderPassCmd>();
DAWN_TRY(ValidateFinalDebugGroupStackSize(debugGroupStackSize));
return {};
- } break;
+ break;
+ }
case Command::ExecuteBundles: {
ExecuteBundlesCmd* cmd = commands->NextCommand<ExecuteBundlesCmd>();
@@ -168,23 +180,28 @@
commandBufferState = CommandBufferStateTracker{};
}
- } break;
+ break;
+ }
case Command::SetStencilReference: {
commands->NextCommand<SetStencilReferenceCmd>();
- } break;
+ break;
+ }
case Command::SetBlendColor: {
commands->NextCommand<SetBlendColorCmd>();
- } break;
+ break;
+ }
case Command::SetViewport: {
commands->NextCommand<SetViewportCmd>();
- } break;
+ break;
+ }
case Command::SetScissorRect: {
commands->NextCommand<SetScissorRectCmd>();
- } break;
+ break;
+ }
default:
DAWN_TRY(ValidateRenderBundleCommand(
@@ -208,40 +225,47 @@
commands->NextCommand<EndComputePassCmd>();
DAWN_TRY(ValidateFinalDebugGroupStackSize(debugGroupStackSize));
return {};
- } break;
+ break;
+ }
case Command::Dispatch: {
commands->NextCommand<DispatchCmd>();
DAWN_TRY(commandBufferState.ValidateCanDispatch());
- } break;
+ break;
+ }
case Command::DispatchIndirect: {
commands->NextCommand<DispatchIndirectCmd>();
DAWN_TRY(commandBufferState.ValidateCanDispatch());
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
InsertDebugMarkerCmd* cmd = commands->NextCommand<InsertDebugMarkerCmd>();
commands->NextData<char>(cmd->length + 1);
- } break;
+ break;
+ }
case Command::PopDebugGroup: {
commands->NextCommand<PopDebugGroupCmd>();
DAWN_TRY(ValidateCanPopDebugGroup(debugGroupStackSize));
debugGroupStackSize--;
- } break;
+ break;
+ }
case Command::PushDebugGroup: {
PushDebugGroupCmd* cmd = commands->NextCommand<PushDebugGroupCmd>();
commands->NextData<char>(cmd->length + 1);
debugGroupStackSize++;
- } break;
+ break;
+ }
case Command::SetComputePipeline: {
SetComputePipelineCmd* cmd = commands->NextCommand<SetComputePipelineCmd>();
ComputePipelineBase* pipeline = cmd->pipeline.Get();
commandBufferState.SetComputePipeline(pipeline);
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = commands->NextCommand<SetBindGroupCmd>();
@@ -249,7 +273,8 @@
commands->NextData<uint32_t>(cmd->dynamicOffsetCount);
}
commandBufferState.SetBindGroup(cmd->index, cmd->group.Get());
- } break;
+ break;
+ }
default:
return DAWN_VALIDATION_ERROR("Command disallowed inside a compute pass");
diff --git a/src/dawn_native/Commands.cpp b/src/dawn_native/Commands.cpp
index 3810089..b409810 100644
--- a/src/dawn_native/Commands.cpp
+++ b/src/dawn_native/Commands.cpp
@@ -33,60 +33,74 @@
case Command::BeginComputePass: {
BeginComputePassCmd* begin = commands->NextCommand<BeginComputePassCmd>();
begin->~BeginComputePassCmd();
- } break;
+ break;
+ }
case Command::BeginRenderPass: {
BeginRenderPassCmd* begin = commands->NextCommand<BeginRenderPassCmd>();
begin->~BeginRenderPassCmd();
- } break;
+ break;
+ }
case Command::CopyBufferToBuffer: {
CopyBufferToBufferCmd* copy = commands->NextCommand<CopyBufferToBufferCmd>();
copy->~CopyBufferToBufferCmd();
- } break;
+ break;
+ }
case Command::CopyBufferToTexture: {
CopyBufferToTextureCmd* copy = commands->NextCommand<CopyBufferToTextureCmd>();
copy->~CopyBufferToTextureCmd();
- } break;
+ break;
+ }
case Command::CopyTextureToBuffer: {
CopyTextureToBufferCmd* copy = commands->NextCommand<CopyTextureToBufferCmd>();
copy->~CopyTextureToBufferCmd();
- } break;
+ break;
+ }
case Command::CopyTextureToTexture: {
CopyTextureToTextureCmd* copy =
commands->NextCommand<CopyTextureToTextureCmd>();
copy->~CopyTextureToTextureCmd();
- } break;
+ break;
+ }
case Command::Dispatch: {
DispatchCmd* dispatch = commands->NextCommand<DispatchCmd>();
dispatch->~DispatchCmd();
- } break;
+ break;
+ }
case Command::DispatchIndirect: {
DispatchIndirectCmd* dispatch = commands->NextCommand<DispatchIndirectCmd>();
dispatch->~DispatchIndirectCmd();
- } break;
+ break;
+ }
case Command::Draw: {
DrawCmd* draw = commands->NextCommand<DrawCmd>();
draw->~DrawCmd();
- } break;
+ break;
+ }
case Command::DrawIndexed: {
DrawIndexedCmd* draw = commands->NextCommand<DrawIndexedCmd>();
draw->~DrawIndexedCmd();
- } break;
+ break;
+ }
case Command::DrawIndirect: {
DrawIndirectCmd* draw = commands->NextCommand<DrawIndirectCmd>();
draw->~DrawIndirectCmd();
- } break;
+ break;
+ }
case Command::DrawIndexedIndirect: {
DrawIndexedIndirectCmd* draw = commands->NextCommand<DrawIndexedIndirectCmd>();
draw->~DrawIndexedIndirectCmd();
- } break;
+ break;
+ }
case Command::EndComputePass: {
EndComputePassCmd* cmd = commands->NextCommand<EndComputePassCmd>();
cmd->~EndComputePassCmd();
- } break;
+ break;
+ }
case Command::EndRenderPass: {
EndRenderPassCmd* cmd = commands->NextCommand<EndRenderPassCmd>();
cmd->~EndRenderPassCmd();
- } break;
+ break;
+ }
case Command::ExecuteBundles: {
ExecuteBundlesCmd* cmd = commands->NextCommand<ExecuteBundlesCmd>();
auto bundles = commands->NextData<Ref<RenderBundleBase>>(cmd->count);
@@ -94,60 +108,73 @@
(&bundles[i])->~Ref<RenderBundleBase>();
}
cmd->~ExecuteBundlesCmd();
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
InsertDebugMarkerCmd* cmd = commands->NextCommand<InsertDebugMarkerCmd>();
commands->NextData<char>(cmd->length + 1);
cmd->~InsertDebugMarkerCmd();
- } break;
+ break;
+ }
case Command::PopDebugGroup: {
PopDebugGroupCmd* cmd = commands->NextCommand<PopDebugGroupCmd>();
cmd->~PopDebugGroupCmd();
- } break;
+ break;
+ }
case Command::PushDebugGroup: {
PushDebugGroupCmd* cmd = commands->NextCommand<PushDebugGroupCmd>();
commands->NextData<char>(cmd->length + 1);
cmd->~PushDebugGroupCmd();
- } break;
+ break;
+ }
case Command::SetComputePipeline: {
SetComputePipelineCmd* cmd = commands->NextCommand<SetComputePipelineCmd>();
cmd->~SetComputePipelineCmd();
- } break;
+ break;
+ }
case Command::SetRenderPipeline: {
SetRenderPipelineCmd* cmd = commands->NextCommand<SetRenderPipelineCmd>();
cmd->~SetRenderPipelineCmd();
- } break;
+ break;
+ }
case Command::SetStencilReference: {
SetStencilReferenceCmd* cmd = commands->NextCommand<SetStencilReferenceCmd>();
cmd->~SetStencilReferenceCmd();
- } break;
+ break;
+ }
case Command::SetViewport: {
SetViewportCmd* cmd = commands->NextCommand<SetViewportCmd>();
cmd->~SetViewportCmd();
- } break;
+ break;
+ }
case Command::SetScissorRect: {
SetScissorRectCmd* cmd = commands->NextCommand<SetScissorRectCmd>();
cmd->~SetScissorRectCmd();
- } break;
+ break;
+ }
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = commands->NextCommand<SetBlendColorCmd>();
cmd->~SetBlendColorCmd();
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = commands->NextCommand<SetBindGroupCmd>();
if (cmd->dynamicOffsetCount > 0) {
commands->NextData<uint32_t>(cmd->dynamicOffsetCount);
}
cmd->~SetBindGroupCmd();
- } break;
+ break;
+ }
case Command::SetIndexBuffer: {
SetIndexBufferCmd* cmd = commands->NextCommand<SetIndexBufferCmd>();
cmd->~SetIndexBufferCmd();
- } break;
+ break;
+ }
case Command::SetVertexBuffer: {
SetVertexBufferCmd* cmd = commands->NextCommand<SetVertexBufferCmd>();
cmd->~SetVertexBufferCmd();
- } break;
+ break;
+ }
}
}
commands->DataWasDestroyed();
@@ -214,12 +241,14 @@
case Command::ExecuteBundles: {
auto* cmd = commands->NextCommand<ExecuteBundlesCmd>();
commands->NextData<Ref<RenderBundleBase>>(cmd->count);
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
InsertDebugMarkerCmd* cmd = commands->NextCommand<InsertDebugMarkerCmd>();
commands->NextData<char>(cmd->length + 1);
- } break;
+ break;
+ }
case Command::PopDebugGroup:
commands->NextCommand<PopDebugGroupCmd>();
@@ -228,7 +257,8 @@
case Command::PushDebugGroup: {
PushDebugGroupCmd* cmd = commands->NextCommand<PushDebugGroupCmd>();
commands->NextData<char>(cmd->length + 1);
- } break;
+ break;
+ }
case Command::SetComputePipeline:
commands->NextCommand<SetComputePipelineCmd>();
@@ -259,7 +289,8 @@
if (cmd->dynamicOffsetCount > 0) {
commands->NextData<uint32_t>(cmd->dynamicOffsetCount);
}
- } break;
+ break;
+ }
case Command::SetIndexBuffer:
commands->NextCommand<SetIndexBufferCmd>();
@@ -267,7 +298,8 @@
case Command::SetVertexBuffer: {
commands->NextCommand<SetVertexBufferCmd>();
- } break;
+ break;
+ }
}
}
diff --git a/src/dawn_native/ProgrammablePassEncoder.cpp b/src/dawn_native/ProgrammablePassEncoder.cpp
index 02075e2..5562dcf 100644
--- a/src/dawn_native/ProgrammablePassEncoder.cpp
+++ b/src/dawn_native/ProgrammablePassEncoder.cpp
@@ -37,23 +37,27 @@
case wgpu::BindingType::UniformBuffer: {
BufferBase* buffer = group->GetBindingAsBufferBinding(bindingIndex).buffer;
usageTracker->BufferUsedAs(buffer, wgpu::BufferUsage::Uniform);
- } break;
+ break;
+ }
case wgpu::BindingType::StorageBuffer: {
BufferBase* buffer = group->GetBindingAsBufferBinding(bindingIndex).buffer;
usageTracker->BufferUsedAs(buffer, wgpu::BufferUsage::Storage);
- } break;
+ break;
+ }
case wgpu::BindingType::SampledTexture: {
TextureBase* texture =
group->GetBindingAsTextureView(bindingIndex)->GetTexture();
usageTracker->TextureUsedAs(texture, wgpu::TextureUsage::Sampled);
- } break;
+ break;
+ }
case wgpu::BindingType::ReadonlyStorageBuffer: {
BufferBase* buffer = group->GetBindingAsBufferBinding(bindingIndex).buffer;
usageTracker->BufferUsedAs(buffer, kReadOnlyStorage);
- } break;
+ break;
+ }
case wgpu::BindingType::Sampler:
break;
diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp
index b688f12..0cd9692 100644
--- a/src/dawn_native/ShaderModule.cpp
+++ b/src/dawn_native/ShaderModule.cpp
@@ -396,7 +396,8 @@
ToWGPUTextureViewDimension(binding.texture_dimension);
info->textureComponentType =
ToDawnFormatType(binding.texture_component_type);
- } break;
+ break;
+ }
case wgpu::BindingType::StorageTexture:
case wgpu::BindingType::ReadonlyStorageTexture:
case wgpu::BindingType::WriteonlyStorageTexture: {
@@ -416,7 +417,8 @@
info->storageTextureFormat = storageTextureFormat;
info->textureDimension =
ToWGPUTextureViewDimension(binding.texture_dimension);
- } break;
+ break;
+ }
default:
break;
}
@@ -580,7 +582,8 @@
info->textureComponentType =
SpirvCrossBaseTypeToFormatType(textureComponentType);
info->type = bindingType;
- } break;
+ break;
+ }
case wgpu::BindingType::StorageBuffer: {
// Differentiate between readonly storage bindings and writable ones
// based on the NonWritable decoration
@@ -590,7 +593,8 @@
} else {
info->type = wgpu::BindingType::StorageBuffer;
}
- } break;
+ break;
+ }
case wgpu::BindingType::StorageTexture: {
spirv_cross::Bitset flags = compiler.get_decoration_bitset(resource.id);
if (flags.get(spv::DecorationNonReadable)) {
@@ -619,7 +623,8 @@
info->storageTextureFormat = storageTextureFormat;
info->textureDimension =
SpirvDimToTextureViewDimension(imageType.dim, imageType.arrayed);
- } break;
+ break;
+ }
default:
info->type = bindingType;
}
@@ -784,7 +789,8 @@
if (bindingInfo.textureDimension != moduleInfo.textureDimension) {
return false;
}
- } break;
+ break;
+ }
case wgpu::BindingType::ReadonlyStorageTexture:
case wgpu::BindingType::WriteonlyStorageTexture: {
@@ -796,7 +802,8 @@
if (bindingInfo.textureDimension != moduleInfo.textureDimension) {
return false;
}
- } break;
+ break;
+ }
case wgpu::BindingType::UniformBuffer:
case wgpu::BindingType::ReadonlyStorageBuffer:
diff --git a/src/dawn_native/Surface.cpp b/src/dawn_native/Surface.cpp
index eee9335..382bb71 100644
--- a/src/dawn_native/Surface.cpp
+++ b/src/dawn_native/Surface.cpp
@@ -55,7 +55,8 @@
if (!InheritsFromCAMetalLayer(metalDesc->layer)) {
return DAWN_VALIDATION_ERROR("layer must be a CAMetalLayer");
}
- } break;
+ break;
+ }
#endif // defined(DAWN_ENABLE_BACKEND_METAL)
#if defined(DAWN_PLATFORM_WINDOWS)
@@ -69,7 +70,8 @@
if (IsWindow(static_cast<HWND>(hwndDesc->hwnd)) == 0) {
return DAWN_VALIDATION_ERROR("Invalid HWND");
}
- } break;
+ break;
+ }
#endif // defined(DAWN_PLATFORM_WINDOWS)
#if defined(DAWN_USE_X11)
@@ -93,7 +95,8 @@
if (status == 0) {
return DAWN_VALIDATION_ERROR("Invalid X Window");
}
- } break;
+ break;
+ }
#endif // defined(DAWN_USE_X11)
case wgpu::SType::SurfaceDescriptorFromHTMLCanvasId:
@@ -115,7 +118,8 @@
static_cast<const SurfaceDescriptorFromMetalLayer*>(chainedDescriptor);
mType = Type::MetalLayer;
mMetalLayer = metalDesc->layer;
- } break;
+ break;
+ }
case wgpu::SType::SurfaceDescriptorFromWindowsHWND: {
const SurfaceDescriptorFromWindowsHWND* hwndDesc =
@@ -123,7 +127,8 @@
mType = Type::WindowsHWND;
mHInstance = hwndDesc->hinstance;
mHWND = hwndDesc->hwnd;
- } break;
+ break;
+ }
case wgpu::SType::SurfaceDescriptorFromXlib: {
const SurfaceDescriptorFromXlib* xDesc =
@@ -131,7 +136,8 @@
mType = Type::Xlib;
mXDisplay = xDesc->display;
mXWindow = xDesc->window;
- } break;
+ break;
+ }
default:
UNREACHABLE();
diff --git a/src/dawn_native/d3d12/BindGroupD3D12.cpp b/src/dawn_native/d3d12/BindGroupD3D12.cpp
index 1bbe058..3abae0e 100644
--- a/src/dawn_native/d3d12/BindGroupD3D12.cpp
+++ b/src/dawn_native/d3d12/BindGroupD3D12.cpp
@@ -108,7 +108,8 @@
d3d12Device->CreateConstantBufferView(
&desc, cbvSrvUavDescriptorHeapAllocation.GetCPUHandle(
bindingOffsets[bindingIndex]));
- } break;
+ break;
+ }
case wgpu::BindingType::StorageBuffer: {
BufferBinding binding = GetBindingAsBufferBinding(bindingIndex);
@@ -132,7 +133,8 @@
ToBackend(binding.buffer)->GetD3D12Resource().Get(), nullptr, &desc,
cbvSrvUavDescriptorHeapAllocation.GetCPUHandle(
bindingOffsets[bindingIndex]));
- } break;
+ break;
+ }
case wgpu::BindingType::ReadonlyStorageBuffer: {
BufferBinding binding = GetBindingAsBufferBinding(bindingIndex);
@@ -152,7 +154,8 @@
ToBackend(binding.buffer)->GetD3D12Resource().Get(), &desc,
cbvSrvUavDescriptorHeapAllocation.GetCPUHandle(
bindingOffsets[bindingIndex]));
- } break;
+ break;
+ }
case wgpu::BindingType::SampledTexture: {
auto* view = ToBackend(GetBindingAsTextureView(bindingIndex));
auto& srv = view->GetSRVDescriptor();
@@ -160,14 +163,16 @@
ToBackend(view->GetTexture())->GetD3D12Resource(), &srv,
cbvSrvUavDescriptorHeapAllocation.GetCPUHandle(
bindingOffsets[bindingIndex]));
- } break;
+ break;
+ }
case wgpu::BindingType::Sampler: {
auto* sampler = ToBackend(GetBindingAsSampler(bindingIndex));
auto& samplerDesc = sampler->GetSamplerDescriptor();
d3d12Device->CreateSampler(
&samplerDesc,
samplerDescriptorHeapAllocation.GetCPUHandle(bindingOffsets[bindingIndex]));
- } break;
+ break;
+ }
case wgpu::BindingType::StorageTexture:
case wgpu::BindingType::ReadonlyStorageTexture:
diff --git a/src/dawn_native/d3d12/CommandBufferD3D12.cpp b/src/dawn_native/d3d12/CommandBufferD3D12.cpp
index 646a96e..efa1215 100644
--- a/src/dawn_native/d3d12/CommandBufferD3D12.cpp
+++ b/src/dawn_native/d3d12/CommandBufferD3D12.cpp
@@ -553,7 +553,8 @@
DAWN_TRY(RecordComputePass(commandContext, &bindingTracker));
nextPassNumber++;
- } break;
+ break;
+ }
case Command::BeginRenderPass: {
BeginRenderPassCmd* beginRenderPassCmd =
@@ -568,7 +569,8 @@
passHasUAV));
nextPassNumber++;
- } break;
+ break;
+ }
case Command::CopyBufferToBuffer: {
CopyBufferToBufferCmd* copy = mCommands.NextCommand<CopyBufferToBufferCmd>();
@@ -583,7 +585,8 @@
commandList->CopyBufferRegion(
dstBuffer->GetD3D12Resource().Get(), copy->destinationOffset,
srcBuffer->GetD3D12Resource().Get(), copy->sourceOffset, copy->size);
- } break;
+ break;
+ }
case Command::CopyBufferToTexture: {
CopyBufferToTextureCmd* copy = mCommands.NextCommand<CopyBufferToTextureCmd>();
@@ -626,7 +629,8 @@
info.textureOffset.y, info.textureOffset.z,
&bufferLocation, &sourceRegion);
}
- } break;
+ break;
+ }
case Command::CopyTextureToBuffer: {
CopyTextureToBufferCmd* copy = mCommands.NextCommand<CopyTextureToBufferCmd>();
@@ -664,7 +668,8 @@
info.bufferOffset.y, info.bufferOffset.z,
&textureLocation, &sourceRegion);
}
- } break;
+ break;
+ }
case Command::CopyTextureToTexture: {
CopyTextureToTextureCmd* copy =
@@ -708,9 +713,13 @@
&dstLocation, copy->destination.origin.x, copy->destination.origin.y,
copy->destination.origin.z, &srcLocation, &sourceRegion);
}
- } break;
+ break;
+ }
- default: { UNREACHABLE(); } break;
+ default: {
+ UNREACHABLE();
+ break;
+ }
}
}
@@ -730,7 +739,8 @@
DAWN_TRY(bindingTracker->Apply(commandContext));
commandList->Dispatch(dispatch->x, dispatch->y, dispatch->z);
- } break;
+ break;
+ }
case Command::DispatchIndirect: {
DispatchIndirectCmd* dispatch = mCommands.NextCommand<DispatchIndirectCmd>();
@@ -742,12 +752,14 @@
commandList->ExecuteIndirect(signature.Get(), 1,
buffer->GetD3D12Resource().Get(),
dispatch->indirectOffset, nullptr, 0);
- } break;
+ break;
+ }
case Command::EndComputePass: {
mCommands.NextCommand<EndComputePassCmd>();
return {};
- } break;
+ break;
+ }
case Command::SetComputePipeline: {
SetComputePipelineCmd* cmd = mCommands.NextCommand<SetComputePipelineCmd>();
@@ -760,7 +772,8 @@
bindingTracker->OnSetPipeline(pipeline);
lastLayout = layout;
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = mCommands.NextCommand<SetBindGroupCmd>();
@@ -773,7 +786,8 @@
bindingTracker->OnSetBindGroup(cmd->index, group, cmd->dynamicOffsetCount,
dynamicOffsets);
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
InsertDebugMarkerCmd* cmd = mCommands.NextCommand<InsertDebugMarkerCmd>();
@@ -786,7 +800,8 @@
->GetFunctions()
->pixSetMarkerOnCommandList(commandList, kPIXBlackColor, label);
}
- } break;
+ break;
+ }
case Command::PopDebugGroup: {
mCommands.NextCommand<PopDebugGroupCmd>();
@@ -796,7 +811,8 @@
->GetFunctions()
->pixEndEventOnCommandList(commandList);
}
- } break;
+ break;
+ }
case Command::PushDebugGroup: {
PushDebugGroupCmd* cmd = mCommands.NextCommand<PushDebugGroupCmd>();
@@ -809,9 +825,13 @@
->GetFunctions()
->pixBeginEventOnCommandList(commandList, kPIXBlackColor, label);
}
- } break;
+ break;
+ }
- default: { UNREACHABLE(); } break;
+ default: {
+ UNREACHABLE();
+ break;
+ }
}
}
@@ -993,7 +1013,8 @@
vertexBufferTracker.Apply(commandList, lastPipeline);
commandList->DrawInstanced(draw->vertexCount, draw->instanceCount,
draw->firstVertex, draw->firstInstance);
- } break;
+ break;
+ }
case Command::DrawIndexed: {
DrawIndexedCmd* draw = iter->NextCommand<DrawIndexedCmd>();
@@ -1004,7 +1025,8 @@
commandList->DrawIndexedInstanced(draw->indexCount, draw->instanceCount,
draw->firstIndex, draw->baseVertex,
draw->firstInstance);
- } break;
+ break;
+ }
case Command::DrawIndirect: {
DrawIndirectCmd* draw = iter->NextCommand<DrawIndirectCmd>();
@@ -1017,7 +1039,8 @@
commandList->ExecuteIndirect(signature.Get(), 1,
buffer->GetD3D12Resource().Get(),
draw->indirectOffset, nullptr, 0);
- } break;
+ break;
+ }
case Command::DrawIndexedIndirect: {
DrawIndexedIndirectCmd* draw = iter->NextCommand<DrawIndexedIndirectCmd>();
@@ -1031,7 +1054,8 @@
commandList->ExecuteIndirect(signature.Get(), 1,
buffer->GetD3D12Resource().Get(),
draw->indirectOffset, nullptr, 0);
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
InsertDebugMarkerCmd* cmd = iter->NextCommand<InsertDebugMarkerCmd>();
@@ -1044,7 +1068,8 @@
->GetFunctions()
->pixSetMarkerOnCommandList(commandList, kPIXBlackColor, label);
}
- } break;
+ break;
+ }
case Command::PopDebugGroup: {
iter->NextCommand<PopDebugGroupCmd>();
@@ -1054,7 +1079,8 @@
->GetFunctions()
->pixEndEventOnCommandList(commandList);
}
- } break;
+ break;
+ }
case Command::PushDebugGroup: {
PushDebugGroupCmd* cmd = iter->NextCommand<PushDebugGroupCmd>();
@@ -1067,7 +1093,8 @@
->GetFunctions()
->pixBeginEventOnCommandList(commandList, kPIXBlackColor, label);
}
- } break;
+ break;
+ }
case Command::SetRenderPipeline: {
SetRenderPipelineCmd* cmd = iter->NextCommand<SetRenderPipelineCmd>();
@@ -1083,7 +1110,8 @@
lastPipeline = pipeline;
lastLayout = layout;
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = iter->NextCommand<SetBindGroupCmd>();
@@ -1096,20 +1124,23 @@
bindingTracker->OnSetBindGroup(cmd->index, group, cmd->dynamicOffsetCount,
dynamicOffsets);
- } break;
+ break;
+ }
case Command::SetIndexBuffer: {
SetIndexBufferCmd* cmd = iter->NextCommand<SetIndexBufferCmd>();
indexBufferTracker.OnSetIndexBuffer(ToBackend(cmd->buffer.Get()), cmd->offset);
- } break;
+ break;
+ }
case Command::SetVertexBuffer: {
SetVertexBufferCmd* cmd = iter->NextCommand<SetVertexBufferCmd>();
vertexBufferTracker.OnSetVertexBuffer(cmd->slot, ToBackend(cmd->buffer.Get()),
cmd->offset);
- } break;
+ break;
+ }
default:
UNREACHABLE();
@@ -1129,13 +1160,15 @@
ResolveMultisampledRenderPass(commandContext, renderPass);
}
return {};
- } break;
+ break;
+ }
case Command::SetStencilReference: {
SetStencilReferenceCmd* cmd = mCommands.NextCommand<SetStencilReferenceCmd>();
commandList->OMSetStencilRef(cmd->reference);
- } break;
+ break;
+ }
case Command::SetViewport: {
SetViewportCmd* cmd = mCommands.NextCommand<SetViewportCmd>();
@@ -1148,7 +1181,8 @@
viewport.MaxDepth = cmd->maxDepth;
commandList->RSSetViewports(1, &viewport);
- } break;
+ break;
+ }
case Command::SetScissorRect: {
SetScissorRectCmd* cmd = mCommands.NextCommand<SetScissorRectCmd>();
@@ -1159,12 +1193,14 @@
rect.bottom = cmd->y + cmd->height;
commandList->RSSetScissorRects(1, &rect);
- } break;
+ break;
+ }
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
commandList->OMSetBlendFactor(static_cast<const FLOAT*>(&cmd->color.r));
- } break;
+ break;
+ }
case Command::ExecuteBundles: {
ExecuteBundlesCmd* cmd = mCommands.NextCommand<ExecuteBundlesCmd>();
@@ -1177,9 +1213,13 @@
DAWN_TRY(EncodeRenderBundleCommand(iter, type));
}
}
- } break;
+ break;
+ }
- default: { DAWN_TRY(EncodeRenderBundleCommand(&mCommands, type)); } break;
+ default: {
+ DAWN_TRY(EncodeRenderBundleCommand(&mCommands, type));
+ break;
+ }
}
}
return {};
diff --git a/src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.cpp b/src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.cpp
index 0fd4a64..7faa0de 100644
--- a/src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.cpp
+++ b/src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.cpp
@@ -88,7 +88,8 @@
default:
UNREACHABLE();
}
- } break;
+ break;
+ }
case D3D12_RESOURCE_DIMENSION_TEXTURE1D:
case D3D12_RESOURCE_DIMENSION_TEXTURE2D:
case D3D12_RESOURCE_DIMENSION_TEXTURE3D: {
@@ -100,11 +101,13 @@
} else {
return Default_OnlyNonRenderableOrDepthTextures;
}
- } break;
+ break;
+ }
default:
UNREACHABLE();
}
- } break;
+ break;
+ }
default:
UNREACHABLE();
}
diff --git a/src/dawn_native/metal/CommandBufferMTL.mm b/src/dawn_native/metal/CommandBufferMTL.mm
index 21851cd..dda3f3b 100644
--- a/src/dawn_native/metal/CommandBufferMTL.mm
+++ b/src/dawn_native/metal/CommandBufferMTL.mm
@@ -568,7 +568,8 @@
withRange:NSMakeRange(computeIndex, 1)];
}
- } break;
+ break;
+ }
case wgpu::BindingType::Sampler: {
auto sampler = ToBackend(group->GetBindingAsSampler(bindingIndex));
@@ -584,7 +585,8 @@
[compute setSamplerState:sampler->GetMTLSamplerState()
atIndex:computeIndex];
}
- } break;
+ break;
+ }
case wgpu::BindingType::SampledTexture: {
auto textureView =
@@ -601,7 +603,8 @@
[compute setTexture:textureView->GetMTLTexture()
atIndex:computeIndex];
}
- } break;
+ break;
+ }
case wgpu::BindingType::StorageTexture:
case wgpu::BindingType::ReadonlyStorageTexture:
@@ -706,7 +709,8 @@
EncodeComputePass(commandContext);
nextPassNumber++;
- } break;
+ break;
+ }
case Command::BeginRenderPass: {
BeginRenderPassCmd* cmd = mCommands.NextCommand<BeginRenderPassCmd>();
@@ -719,7 +723,8 @@
EncodeRenderPass(commandContext, descriptor, cmd->width, cmd->height);
nextPassNumber++;
- } break;
+ break;
+ }
case Command::CopyBufferToBuffer: {
CopyBufferToBufferCmd* copy = mCommands.NextCommand<CopyBufferToBufferCmd>();
@@ -730,7 +735,8 @@
toBuffer:ToBackend(copy->destination)->GetMTLBuffer()
destinationOffset:copy->destinationOffset
size:copy->size];
- } break;
+ break;
+ }
case Command::CopyBufferToTexture: {
CopyBufferToTextureCmd* copy = mCommands.NextCommand<CopyBufferToTextureCmd>();
@@ -759,7 +765,8 @@
destinationLevel:dst.mipLevel
destinationOrigin:copyInfo.textureOrigin];
}
- } break;
+ break;
+ }
case Command::CopyTextureToBuffer: {
CopyTextureToBufferCmd* copy = mCommands.NextCommand<CopyTextureToBufferCmd>();
@@ -788,7 +795,8 @@
destinationBytesPerRow:copyInfo.bytesPerRow
destinationBytesPerImage:copyInfo.bytesPerImage];
}
- } break;
+ break;
+ }
case Command::CopyTextureToTexture: {
CopyTextureToTextureCmd* copy =
@@ -810,9 +818,13 @@
destinationSlice:copy->destination.arrayLayer
destinationLevel:copy->destination.mipLevel
destinationOrigin:MakeMTLOrigin(copy->destination.origin)];
- } break;
+ break;
+ }
- default: { UNREACHABLE(); } break;
+ default: {
+ UNREACHABLE();
+ break;
+ }
}
}
@@ -833,7 +845,8 @@
mCommands.NextCommand<EndComputePassCmd>();
commandContext->EndCompute();
return;
- } break;
+ break;
+ }
case Command::Dispatch: {
DispatchCmd* dispatch = mCommands.NextCommand<DispatchCmd>();
@@ -843,7 +856,8 @@
[encoder dispatchThreadgroups:MTLSizeMake(dispatch->x, dispatch->y, dispatch->z)
threadsPerThreadgroup:lastPipeline->GetLocalWorkGroupSize()];
- } break;
+ break;
+ }
case Command::DispatchIndirect: {
DispatchIndirectCmd* dispatch = mCommands.NextCommand<DispatchIndirectCmd>();
@@ -857,7 +871,8 @@
indirectBufferOffset:dispatch->indirectOffset
threadsPerThreadgroup:lastPipeline
->GetLocalWorkGroupSize()];
- } break;
+ break;
+ }
case Command::SetComputePipeline: {
SetComputePipelineCmd* cmd = mCommands.NextCommand<SetComputePipelineCmd>();
@@ -866,7 +881,8 @@
bindGroups.OnSetPipeline(lastPipeline);
lastPipeline->Encode(encoder);
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = mCommands.NextCommand<SetBindGroupCmd>();
@@ -877,7 +893,8 @@
bindGroups.OnSetBindGroup(cmd->index, ToBackend(cmd->group.Get()),
cmd->dynamicOffsetCount, dynamicOffsets);
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
InsertDebugMarkerCmd* cmd = mCommands.NextCommand<InsertDebugMarkerCmd>();
@@ -886,13 +903,15 @@
[encoder insertDebugSignpost:mtlLabel];
[mtlLabel release];
- } break;
+ break;
+ }
case Command::PopDebugGroup: {
mCommands.NextCommand<PopDebugGroupCmd>();
[encoder popDebugGroup];
- } break;
+ break;
+ }
case Command::PushDebugGroup: {
PushDebugGroupCmd* cmd = mCommands.NextCommand<PushDebugGroupCmd>();
@@ -901,9 +920,13 @@
[encoder pushDebugGroup:mtlLabel];
[mtlLabel release];
- } break;
+ break;
+ }
- default: { UNREACHABLE(); } break;
+ default: {
+ UNREACHABLE();
+ break;
+ }
}
}
@@ -1039,7 +1062,8 @@
baseInstance:draw->firstInstance];
}
}
- } break;
+ break;
+ }
case Command::DrawIndexed: {
DrawIndexedCmd* draw = iter->NextCommand<DrawIndexedCmd>();
@@ -1074,7 +1098,8 @@
baseInstance:draw->firstInstance];
}
}
- } break;
+ break;
+ }
case Command::DrawIndirect: {
DrawIndirectCmd* draw = iter->NextCommand<DrawIndirectCmd>();
@@ -1088,7 +1113,8 @@
[encoder drawPrimitives:lastPipeline->GetMTLPrimitiveTopology()
indirectBuffer:indirectBuffer
indirectBufferOffset:draw->indirectOffset];
- } break;
+ break;
+ }
case Command::DrawIndexedIndirect: {
DrawIndirectCmd* draw = iter->NextCommand<DrawIndirectCmd>();
@@ -1105,7 +1131,8 @@
indexBufferOffset:indexBufferBaseOffset
indirectBuffer:indirectBuffer
indirectBufferOffset:draw->indirectOffset];
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
InsertDebugMarkerCmd* cmd = iter->NextCommand<InsertDebugMarkerCmd>();
@@ -1114,13 +1141,15 @@
[encoder insertDebugSignpost:mtlLabel];
[mtlLabel release];
- } break;
+ break;
+ }
case Command::PopDebugGroup: {
iter->NextCommand<PopDebugGroupCmd>();
[encoder popDebugGroup];
- } break;
+ break;
+ }
case Command::PushDebugGroup: {
PushDebugGroupCmd* cmd = iter->NextCommand<PushDebugGroupCmd>();
@@ -1129,7 +1158,8 @@
[encoder pushDebugGroup:mtlLabel];
[mtlLabel release];
- } break;
+ break;
+ }
case Command::SetRenderPipeline: {
SetRenderPipelineCmd* cmd = iter->NextCommand<SetRenderPipelineCmd>();
@@ -1144,7 +1174,8 @@
newPipeline->Encode(encoder);
lastPipeline = newPipeline;
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = iter->NextCommand<SetBindGroupCmd>();
@@ -1155,21 +1186,24 @@
bindGroups.OnSetBindGroup(cmd->index, ToBackend(cmd->group.Get()),
cmd->dynamicOffsetCount, dynamicOffsets);
- } break;
+ break;
+ }
case Command::SetIndexBuffer: {
SetIndexBufferCmd* cmd = iter->NextCommand<SetIndexBufferCmd>();
auto b = ToBackend(cmd->buffer.Get());
indexBuffer = b->GetMTLBuffer();
indexBufferBaseOffset = cmd->offset;
- } break;
+ break;
+ }
case Command::SetVertexBuffer: {
SetVertexBufferCmd* cmd = iter->NextCommand<SetVertexBufferCmd>();
vertexBuffers.OnSetVertexBuffer(cmd->slot, ToBackend(cmd->buffer.Get()),
cmd->offset);
- } break;
+ break;
+ }
default:
UNREACHABLE();
@@ -1184,12 +1218,14 @@
mCommands.NextCommand<EndRenderPassCmd>();
commandContext->EndRender();
return;
- } break;
+ break;
+ }
case Command::SetStencilReference: {
SetStencilReferenceCmd* cmd = mCommands.NextCommand<SetStencilReferenceCmd>();
[encoder setStencilReferenceValue:cmd->reference];
- } break;
+ break;
+ }
case Command::SetViewport: {
SetViewportCmd* cmd = mCommands.NextCommand<SetViewportCmd>();
@@ -1202,7 +1238,8 @@
viewport.zfar = cmd->maxDepth;
[encoder setViewport:viewport];
- } break;
+ break;
+ }
case Command::SetScissorRect: {
SetScissorRectCmd* cmd = mCommands.NextCommand<SetScissorRectCmd>();
@@ -1222,7 +1259,8 @@
}
[encoder setScissorRect:rect];
- } break;
+ break;
+ }
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
@@ -1230,7 +1268,8 @@
green:cmd->color.g
blue:cmd->color.b
alpha:cmd->color.a];
- } break;
+ break;
+ }
case Command::ExecuteBundles: {
ExecuteBundlesCmd* cmd = mCommands.NextCommand<ExecuteBundlesCmd>();
@@ -1243,9 +1282,13 @@
EncodeRenderBundleCommand(iter, type);
}
}
- } break;
+ break;
+ }
- default: { EncodeRenderBundleCommand(&mCommands, type); } break;
+ default: {
+ EncodeRenderBundleCommand(&mCommands, type);
+ break;
+ }
}
}
diff --git a/src/dawn_native/opengl/CommandBufferGL.cpp b/src/dawn_native/opengl/CommandBufferGL.cpp
index 65d41df..97e3460 100644
--- a/src/dawn_native/opengl/CommandBufferGL.cpp
+++ b/src/dawn_native/opengl/CommandBufferGL.cpp
@@ -260,7 +260,8 @@
gl.BindBufferRange(GL_UNIFORM_BUFFER, uboIndex, buffer, offset,
binding.size);
- } break;
+ break;
+ }
case wgpu::BindingType::StorageBuffer:
case wgpu::BindingType::ReadonlyStorageBuffer: {
@@ -276,7 +277,8 @@
gl.BindBufferRange(GL_SHADER_STORAGE_BUFFER, ssboIndex, buffer, offset,
binding.size);
- } break;
+ break;
+ }
case wgpu::BindingType::Sampler: {
Sampler* sampler = ToBackend(group->GetBindingAsSampler(bindingIndex));
@@ -292,7 +294,8 @@
gl.BindSampler(unit.unit, sampler->GetNonFilteringHandle());
}
}
- } break;
+ break;
+ }
case wgpu::BindingType::SampledTexture: {
TextureView* view =
@@ -305,7 +308,8 @@
gl.ActiveTexture(GL_TEXTURE0 + unit);
gl.BindTexture(target, handle);
}
- } break;
+ break;
+ }
case wgpu::BindingType::StorageTexture:
case wgpu::BindingType::ReadonlyStorageTexture:
@@ -435,7 +439,8 @@
ExecuteComputePass();
nextPassNumber++;
- } break;
+ break;
+ }
case Command::BeginRenderPass: {
auto* cmd = mCommands.NextCommand<BeginRenderPassCmd>();
@@ -445,7 +450,8 @@
ExecuteRenderPass(cmd);
nextPassNumber++;
- } break;
+ break;
+ }
case Command::CopyBufferToBuffer: {
CopyBufferToBufferCmd* copy = mCommands.NextCommand<CopyBufferToBufferCmd>();
@@ -458,7 +464,8 @@
gl.BindBuffer(GL_PIXEL_PACK_BUFFER, 0);
gl.BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
- } break;
+ break;
+ }
case Command::CopyBufferToTexture: {
CopyBufferToTextureCmd* copy = mCommands.NextCommand<CopyBufferToTextureCmd>();
@@ -537,7 +544,8 @@
gl.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
gl.BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
- } break;
+ break;
+ }
case Command::CopyTextureToBuffer: {
CopyTextureToBufferCmd* copy = mCommands.NextCommand<CopyTextureToBufferCmd>();
@@ -594,7 +602,8 @@
gl.BindBuffer(GL_PIXEL_PACK_BUFFER, 0);
gl.DeleteFramebuffers(1, &readFBO);
- } break;
+ break;
+ }
case Command::CopyTextureToTexture: {
CopyTextureToTextureCmd* copy =
@@ -623,9 +632,13 @@
dstTexture->GetHandle(), dstTexture->GetGLTarget(),
dst.mipLevel, dst.origin.x, dst.origin.y, dst.arrayLayer,
copySize.width, copySize.height, 1);
- } break;
+ break;
+ }
- default: { UNREACHABLE(); } break;
+ default: {
+ UNREACHABLE();
+ break;
+ }
}
}
}
@@ -641,7 +654,8 @@
case Command::EndComputePass: {
mCommands.NextCommand<EndComputePassCmd>();
return;
- } break;
+ break;
+ }
case Command::Dispatch: {
DispatchCmd* dispatch = mCommands.NextCommand<DispatchCmd>();
@@ -650,7 +664,8 @@
gl.DispatchCompute(dispatch->x, dispatch->y, dispatch->z);
// TODO(cwallez@chromium.org): add barriers to the API
gl.MemoryBarrier(GL_ALL_BARRIER_BITS);
- } break;
+ break;
+ }
case Command::DispatchIndirect: {
DispatchIndirectCmd* dispatch = mCommands.NextCommand<DispatchIndirectCmd>();
@@ -663,7 +678,8 @@
gl.DispatchComputeIndirect(static_cast<GLintptr>(indirectBufferOffset));
// TODO(cwallez@chromium.org): add barriers to the API
gl.MemoryBarrier(GL_ALL_BARRIER_BITS);
- } break;
+ break;
+ }
case Command::SetComputePipeline: {
SetComputePipelineCmd* cmd = mCommands.NextCommand<SetComputePipelineCmd>();
@@ -671,7 +687,8 @@
lastPipeline->ApplyNow();
bindGroupTracker.OnSetPipeline(lastPipeline);
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = mCommands.NextCommand<SetBindGroupCmd>();
@@ -681,7 +698,8 @@
}
bindGroupTracker.OnSetBindGroup(cmd->index, cmd->group.Get(),
cmd->dynamicOffsetCount, dynamicOffsets);
- } break;
+ break;
+ }
case Command::InsertDebugMarker:
case Command::PopDebugGroup:
@@ -689,9 +707,13 @@
// Due to lack of linux driver support for GL_EXT_debug_marker
// extension these functions are skipped.
SkipCommand(&mCommands, type);
- } break;
+ break;
+ }
- default: { UNREACHABLE(); } break;
+ default: {
+ UNREACHABLE();
+ break;
+ }
}
}
@@ -855,7 +877,8 @@
draw->firstVertex, draw->vertexCount,
draw->instanceCount);
}
- } break;
+ break;
+ }
case Command::DrawIndexed: {
DrawIndexedCmd* draw = iter->NextCommand<DrawIndexedCmd>();
@@ -892,7 +915,8 @@
draw->instanceCount);
}
}
- } break;
+ break;
+ }
case Command::DrawIndirect: {
DrawIndirectCmd* draw = iter->NextCommand<DrawIndirectCmd>();
@@ -906,7 +930,8 @@
gl.DrawArraysIndirect(
lastPipeline->GetGLPrimitiveTopology(),
reinterpret_cast<void*>(static_cast<intptr_t>(indirectBufferOffset)));
- } break;
+ break;
+ }
case Command::DrawIndexedIndirect: {
DrawIndexedIndirectCmd* draw = iter->NextCommand<DrawIndexedIndirectCmd>();
@@ -924,7 +949,8 @@
gl.DrawElementsIndirect(
lastPipeline->GetGLPrimitiveTopology(), formatType,
reinterpret_cast<void*>(static_cast<intptr_t>(indirectBufferOffset)));
- } break;
+ break;
+ }
case Command::InsertDebugMarker:
case Command::PopDebugGroup:
@@ -932,7 +958,8 @@
// Due to lack of linux driver support for GL_EXT_debug_marker
// extension these functions are skipped.
SkipCommand(iter, type);
- } break;
+ break;
+ }
case Command::SetRenderPipeline: {
SetRenderPipelineCmd* cmd = iter->NextCommand<SetRenderPipelineCmd>();
@@ -941,7 +968,8 @@
vertexStateBufferBindingTracker.OnSetPipeline(lastPipeline);
bindGroupTracker.OnSetPipeline(lastPipeline);
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = iter->NextCommand<SetBindGroupCmd>();
@@ -951,19 +979,22 @@
}
bindGroupTracker.OnSetBindGroup(cmd->index, cmd->group.Get(),
cmd->dynamicOffsetCount, dynamicOffsets);
- } break;
+ break;
+ }
case Command::SetIndexBuffer: {
SetIndexBufferCmd* cmd = iter->NextCommand<SetIndexBufferCmd>();
indexBufferBaseOffset = cmd->offset;
vertexStateBufferBindingTracker.OnSetIndexBuffer(cmd->buffer.Get());
- } break;
+ break;
+ }
case Command::SetVertexBuffer: {
SetVertexBufferCmd* cmd = iter->NextCommand<SetVertexBufferCmd>();
vertexStateBufferBindingTracker.OnSetVertexBuffer(cmd->slot, cmd->buffer.Get(),
cmd->offset);
- } break;
+ break;
+ }
default:
UNREACHABLE();
@@ -982,28 +1013,33 @@
}
gl.DeleteFramebuffers(1, &fbo);
return;
- } break;
+ break;
+ }
case Command::SetStencilReference: {
SetStencilReferenceCmd* cmd = mCommands.NextCommand<SetStencilReferenceCmd>();
persistentPipelineState.SetStencilReference(gl, cmd->reference);
- } break;
+ break;
+ }
case Command::SetViewport: {
SetViewportCmd* cmd = mCommands.NextCommand<SetViewportCmd>();
gl.ViewportIndexedf(0, cmd->x, cmd->y, cmd->width, cmd->height);
gl.DepthRangef(cmd->minDepth, cmd->maxDepth);
- } break;
+ break;
+ }
case Command::SetScissorRect: {
SetScissorRectCmd* cmd = mCommands.NextCommand<SetScissorRectCmd>();
gl.Scissor(cmd->x, cmd->y, cmd->width, cmd->height);
- } break;
+ break;
+ }
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
gl.BlendColor(cmd->color.r, cmd->color.g, cmd->color.b, cmd->color.a);
- } break;
+ break;
+ }
case Command::ExecuteBundles: {
ExecuteBundlesCmd* cmd = mCommands.NextCommand<ExecuteBundlesCmd>();
@@ -1016,9 +1052,13 @@
DoRenderBundleCommand(iter, type);
}
}
- } break;
+ break;
+ }
- default: { DoRenderBundleCommand(&mCommands, type); } break;
+ default: {
+ DoRenderBundleCommand(&mCommands, type);
+ break;
+ }
}
}
diff --git a/src/dawn_native/opengl/PipelineGL.cpp b/src/dawn_native/opengl/PipelineGL.cpp
index 212ef10..03d2897 100644
--- a/src/dawn_native/opengl/PipelineGL.cpp
+++ b/src/dawn_native/opengl/PipelineGL.cpp
@@ -121,7 +121,8 @@
gl.UniformBlockBinding(mProgram, location,
indices[group][bindingIndex]);
}
- } break;
+ break;
+ }
case wgpu::BindingType::StorageBuffer:
case wgpu::BindingType::ReadonlyStorageBuffer: {
@@ -131,7 +132,8 @@
gl.ShaderStorageBlockBinding(mProgram, location,
indices[group][bindingIndex]);
}
- } break;
+ break;
+ }
case wgpu::BindingType::Sampler:
case wgpu::BindingType::SampledTexture:
diff --git a/src/dawn_native/vulkan/BindGroupVk.cpp b/src/dawn_native/vulkan/BindGroupVk.cpp
index 1f41b3e..018fa05 100644
--- a/src/dawn_native/vulkan/BindGroupVk.cpp
+++ b/src/dawn_native/vulkan/BindGroupVk.cpp
@@ -68,13 +68,15 @@
writeBufferInfo[numWrites].offset = binding.offset;
writeBufferInfo[numWrites].range = binding.size;
write.pBufferInfo = &writeBufferInfo[numWrites];
- } break;
+ break;
+ }
case wgpu::BindingType::Sampler: {
Sampler* sampler = ToBackend(GetBindingAsSampler(bindingIndex));
writeImageInfo[numWrites].sampler = sampler->GetHandle();
write.pImageInfo = &writeImageInfo[numWrites];
- } break;
+ break;
+ }
case wgpu::BindingType::SampledTexture: {
TextureView* view = ToBackend(GetBindingAsTextureView(bindingIndex));
@@ -86,7 +88,8 @@
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
write.pImageInfo = &writeImageInfo[numWrites];
- } break;
+ break;
+ }
case wgpu::BindingType::ReadonlyStorageTexture:
case wgpu::BindingType::WriteonlyStorageTexture: {
@@ -96,7 +99,8 @@
writeImageInfo[numWrites].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
write.pImageInfo = &writeImageInfo[numWrites];
- } break;
+ break;
+ }
default:
UNREACHABLE();
}
diff --git a/src/dawn_native/vulkan/CommandBufferVk.cpp b/src/dawn_native/vulkan/CommandBufferVk.cpp
index 9f892e8..0ea834c 100644
--- a/src/dawn_native/vulkan/CommandBufferVk.cpp
+++ b/src/dawn_native/vulkan/CommandBufferVk.cpp
@@ -403,7 +403,8 @@
VkBuffer srcHandle = srcBuffer->GetHandle();
VkBuffer dstHandle = dstBuffer->GetHandle();
device->fn.CmdCopyBuffer(commands, srcHandle, dstHandle, 1, ®ion);
- } break;
+ break;
+ }
case Command::CopyBufferToTexture: {
CopyBufferToTextureCmd* copy = mCommands.NextCommand<CopyBufferToTextureCmd>();
@@ -437,7 +438,8 @@
device->fn.CmdCopyBufferToImage(commands, srcBuffer, dstImage,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1,
®ion);
- } break;
+ break;
+ }
case Command::CopyTextureToBuffer: {
CopyTextureToBufferCmd* copy = mCommands.NextCommand<CopyTextureToBufferCmd>();
@@ -463,7 +465,8 @@
// The Dawn CopySrc usage is always mapped to GENERAL
device->fn.CmdCopyImageToBuffer(commands, srcImage, VK_IMAGE_LAYOUT_GENERAL,
dstBuffer, 1, ®ion);
- } break;
+ break;
+ }
case Command::CopyTextureToTexture: {
CopyTextureToTextureCmd* copy =
@@ -522,7 +525,8 @@
copy->copySize);
}
- } break;
+ break;
+ }
case Command::BeginRenderPass: {
BeginRenderPassCmd* cmd = mCommands.NextCommand<BeginRenderPassCmd>();
@@ -533,7 +537,8 @@
DAWN_TRY(RecordRenderPass(recordingContext, cmd));
nextPassNumber++;
- } break;
+ break;
+ }
case Command::BeginComputePass: {
mCommands.NextCommand<BeginComputePassCmd>();
@@ -542,9 +547,13 @@
RecordComputePass(recordingContext);
nextPassNumber++;
- } break;
+ break;
+ }
- default: { UNREACHABLE(); } break;
+ default: {
+ UNREACHABLE();
+ break;
+ }
}
}
@@ -563,14 +572,16 @@
case Command::EndComputePass: {
mCommands.NextCommand<EndComputePassCmd>();
return;
- } break;
+ break;
+ }
case Command::Dispatch: {
DispatchCmd* dispatch = mCommands.NextCommand<DispatchCmd>();
descriptorSets.Apply(device, recordingContext, VK_PIPELINE_BIND_POINT_COMPUTE);
device->fn.CmdDispatch(commands, dispatch->x, dispatch->y, dispatch->z);
- } break;
+ break;
+ }
case Command::DispatchIndirect: {
DispatchIndirectCmd* dispatch = mCommands.NextCommand<DispatchIndirectCmd>();
@@ -580,7 +591,8 @@
device->fn.CmdDispatchIndirect(
commands, indirectBuffer,
static_cast<VkDeviceSize>(dispatch->indirectOffset));
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = mCommands.NextCommand<SetBindGroupCmd>();
@@ -593,7 +605,8 @@
descriptorSets.OnSetBindGroup(cmd->index, bindGroup, cmd->dynamicOffsetCount,
dynamicOffsets);
- } break;
+ break;
+ }
case Command::SetComputePipeline: {
SetComputePipelineCmd* cmd = mCommands.NextCommand<SetComputePipelineCmd>();
@@ -602,7 +615,8 @@
device->fn.CmdBindPipeline(commands, VK_PIPELINE_BIND_POINT_COMPUTE,
pipeline->GetHandle());
descriptorSets.OnSetPipeline(pipeline);
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
if (device->GetDeviceInfo().debugMarker) {
@@ -621,7 +635,8 @@
} else {
SkipCommand(&mCommands, Command::InsertDebugMarker);
}
- } break;
+ break;
+ }
case Command::PopDebugGroup: {
if (device->GetDeviceInfo().debugMarker) {
@@ -630,7 +645,8 @@
} else {
SkipCommand(&mCommands, Command::PopDebugGroup);
}
- } break;
+ break;
+ }
case Command::PushDebugGroup: {
if (device->GetDeviceInfo().debugMarker) {
@@ -649,9 +665,13 @@
} else {
SkipCommand(&mCommands, Command::PushDebugGroup);
}
- } break;
+ break;
+ }
- default: { UNREACHABLE(); } break;
+ default: {
+ UNREACHABLE();
+ break;
+ }
}
}
@@ -710,7 +730,8 @@
descriptorSets.Apply(device, recordingContext, VK_PIPELINE_BIND_POINT_GRAPHICS);
device->fn.CmdDraw(commands, draw->vertexCount, draw->instanceCount,
draw->firstVertex, draw->firstInstance);
- } break;
+ break;
+ }
case Command::DrawIndexed: {
DrawIndexedCmd* draw = iter->NextCommand<DrawIndexedCmd>();
@@ -719,7 +740,8 @@
device->fn.CmdDrawIndexed(commands, draw->indexCount, draw->instanceCount,
draw->firstIndex, draw->baseVertex,
draw->firstInstance);
- } break;
+ break;
+ }
case Command::DrawIndirect: {
DrawIndirectCmd* draw = iter->NextCommand<DrawIndirectCmd>();
@@ -729,7 +751,8 @@
device->fn.CmdDrawIndirect(commands, indirectBuffer,
static_cast<VkDeviceSize>(draw->indirectOffset), 1,
0);
- } break;
+ break;
+ }
case Command::DrawIndexedIndirect: {
DrawIndirectCmd* draw = iter->NextCommand<DrawIndirectCmd>();
@@ -739,7 +762,8 @@
device->fn.CmdDrawIndexedIndirect(
commands, indirectBuffer, static_cast<VkDeviceSize>(draw->indirectOffset),
1, 0);
- } break;
+ break;
+ }
case Command::InsertDebugMarker: {
if (device->GetDeviceInfo().debugMarker) {
@@ -758,7 +782,8 @@
} else {
SkipCommand(iter, Command::InsertDebugMarker);
}
- } break;
+ break;
+ }
case Command::PopDebugGroup: {
if (device->GetDeviceInfo().debugMarker) {
@@ -767,7 +792,8 @@
} else {
SkipCommand(iter, Command::PopDebugGroup);
}
- } break;
+ break;
+ }
case Command::PushDebugGroup: {
if (device->GetDeviceInfo().debugMarker) {
@@ -786,7 +812,8 @@
} else {
SkipCommand(iter, Command::PushDebugGroup);
}
- } break;
+ break;
+ }
case Command::SetBindGroup: {
SetBindGroupCmd* cmd = iter->NextCommand<SetBindGroupCmd>();
@@ -798,7 +825,8 @@
descriptorSets.OnSetBindGroup(cmd->index, bindGroup, cmd->dynamicOffsetCount,
dynamicOffsets);
- } break;
+ break;
+ }
case Command::SetIndexBuffer: {
SetIndexBufferCmd* cmd = iter->NextCommand<SetIndexBufferCmd>();
@@ -811,7 +839,8 @@
VulkanIndexType(lastPipeline->GetVertexStateDescriptor()->indexFormat);
device->fn.CmdBindIndexBuffer(
commands, indexBuffer, static_cast<VkDeviceSize>(cmd->offset), indexType);
- } break;
+ break;
+ }
case Command::SetRenderPipeline: {
SetRenderPipelineCmd* cmd = iter->NextCommand<SetRenderPipelineCmd>();
@@ -822,7 +851,8 @@
lastPipeline = pipeline;
descriptorSets.OnSetPipeline(pipeline);
- } break;
+ break;
+ }
case Command::SetVertexBuffer: {
SetVertexBufferCmd* cmd = iter->NextCommand<SetVertexBufferCmd>();
@@ -830,7 +860,8 @@
VkDeviceSize offset = static_cast<VkDeviceSize>(cmd->offset);
device->fn.CmdBindVertexBuffers(commands, cmd->slot, 1, &*buffer, &offset);
- } break;
+ break;
+ }
default:
UNREACHABLE();
@@ -845,7 +876,8 @@
mCommands.NextCommand<EndRenderPassCmd>();
device->fn.CmdEndRenderPass(commands);
return {};
- } break;
+ break;
+ }
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
@@ -856,13 +888,15 @@
cmd->color.a,
};
device->fn.CmdSetBlendConstants(commands, blendConstants);
- } break;
+ break;
+ }
case Command::SetStencilReference: {
SetStencilReferenceCmd* cmd = mCommands.NextCommand<SetStencilReferenceCmd>();
device->fn.CmdSetStencilReference(commands, VK_STENCIL_FRONT_AND_BACK,
cmd->reference);
- } break;
+ break;
+ }
case Command::SetViewport: {
SetViewportCmd* cmd = mCommands.NextCommand<SetViewportCmd>();
@@ -875,7 +909,8 @@
viewport.maxDepth = cmd->maxDepth;
device->fn.CmdSetViewport(commands, 0, 1, &viewport);
- } break;
+ break;
+ }
case Command::SetScissorRect: {
SetScissorRectCmd* cmd = mCommands.NextCommand<SetScissorRectCmd>();
@@ -886,7 +921,8 @@
rect.extent.height = cmd->height;
device->fn.CmdSetScissor(commands, 0, 1, &rect);
- } break;
+ break;
+ }
case Command::ExecuteBundles: {
ExecuteBundlesCmd* cmd = mCommands.NextCommand<ExecuteBundlesCmd>();
@@ -899,9 +935,13 @@
EncodeRenderBundleCommand(iter, type);
}
}
- } break;
+ break;
+ }
- default: { EncodeRenderBundleCommand(&mCommands, type); } break;
+ default: {
+ EncodeRenderBundleCommand(&mCommands, type);
+ break;
+ }
}
}
diff --git a/src/tests/perf_tests/BufferUploadPerf.cpp b/src/tests/perf_tests/BufferUploadPerf.cpp
index 72e7539..5ddf3ad 100644
--- a/src/tests/perf_tests/BufferUploadPerf.cpp
+++ b/src/tests/perf_tests/BufferUploadPerf.cpp
@@ -119,7 +119,8 @@
}
// Make sure all SetSubData's are flushed.
queue.Submit(0, nullptr);
- } break;
+ break;
+ }
case UploadMethod::CreateBufferMapped: {
wgpu::BufferDescriptor desc = {};
@@ -137,7 +138,8 @@
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
- } break;
+ break;
+ }
}
}
diff --git a/src/tests/perf_tests/DrawCallPerf.cpp b/src/tests/perf_tests/DrawCallPerf.cpp
index 6809c03..5e6ba78 100644
--- a/src/tests/perf_tests/DrawCallPerf.cpp
+++ b/src/tests/perf_tests/DrawCallPerf.cpp
@@ -306,7 +306,8 @@
mVertexBuffers[i] = utils::CreateBufferFromData(
device, kVertexData, sizeof(kVertexData), wgpu::BufferUsage::Vertex);
}
- } break;
+ break;
+ }
case VertexBuffer::Dynamic: {
std::vector<char> data(mAlignedVertexDataSize * kNumDraws);
@@ -316,7 +317,8 @@
mVertexBuffers[0] = utils::CreateBufferFromData(device, data.data(), data.size(),
wgpu::BufferUsage::Vertex);
- } break;
+ break;
+ }
}
// Create the bind group layout.
@@ -505,7 +507,8 @@
// Because of the pipeline layout change, we need to rebind bind group index 0.
pass.SetBindGroup(0, mConstantBindGroup);
}
- } break;
+ break;
+ }
}
// Set the vertex buffer, if it changes.
@@ -535,7 +538,8 @@
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
device, mUniformBindGroupLayout, {{0, mUniformBuffers[i], 0, kUniformSize}});
pass.SetBindGroup(uniformBindGroupIndex, bindGroup);
- } break;
+ break;
+ }
case BindGroup::Multiple:
pass.SetBindGroup(uniformBindGroupIndex, mUniformBindGroups[i]);
@@ -544,7 +548,8 @@
case BindGroup::Dynamic: {
uint32_t dynamicOffset = static_cast<uint32_t>(i * mAlignedUniformSize);
pass.SetBindGroup(uniformBindGroupIndex, mUniformBindGroups[0], 1, &dynamicOffset);
- } break;
+ break;
+ }
default:
UNREACHABLE();