diff --git a/generator/templates/dawn_native/wgpu_structs.cpp b/generator/templates/dawn_native/wgpu_structs.cpp index 83f24eea43..642cb13220 100644 --- a/generator/templates/dawn_native/wgpu_structs.cpp +++ b/generator/templates/dawn_native/wgpu_structs.cpp @@ -14,6 +14,11 @@ #include "dawn_native/wgpu_structs_autogen.h" +#ifdef __GNUC__ +// error: 'offsetof' within non-standard-layout type 'wgpu::XXX' is conditionally-supported +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif + namespace dawn_native { static_assert(sizeof(ChainedStruct) == sizeof(WGPUChainedStruct), diff --git a/generator/templates/dawn_wire/WireCmd.cpp b/generator/templates/dawn_wire/WireCmd.cpp index c9dc5e2ceb..4b9bd9bd7a 100644 --- a/generator/templates/dawn_wire/WireCmd.cpp +++ b/generator/templates/dawn_wire/WireCmd.cpp @@ -23,6 +23,11 @@ #include #include +#ifdef __GNUC__ +// error: 'offsetof' within non-standard-layout type 'wgpu::XXX' is conditionally-supported +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif + //* Helper macros so that the main [de]serialization functions can be written in a generic manner. //* Outputs an rvalue that's the number of elements a pointer member points to. diff --git a/generator/templates/webgpu_cpp.cpp b/generator/templates/webgpu_cpp.cpp index 7f5dd59975..43a534c773 100644 --- a/generator/templates/webgpu_cpp.cpp +++ b/generator/templates/webgpu_cpp.cpp @@ -17,6 +17,11 @@ #include "webgpu/webgpu_cpp.h" {% endif %} +#ifdef __GNUC__ +// error: 'offsetof' within non-standard-layout type 'wgpu::XXX' is conditionally-supported +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif + namespace wgpu { {% for type in by_category["enum"] %} {% set CppType = as_cppType(type.name) %} diff --git a/src/dawn_native/BindGroupLayout.cpp b/src/dawn_native/BindGroupLayout.cpp index 84f40504ce..34c8482711 100644 --- a/src/dawn_native/BindGroupLayout.cpp +++ b/src/dawn_native/BindGroupLayout.cpp @@ -56,8 +56,9 @@ namespace dawn_native { return {}; case wgpu::TextureViewDimension::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } } // anonymous namespace @@ -179,7 +180,6 @@ namespace dawn_native { namespace { - bool operator!=(const BindingInfo& a, const BindingInfo& b) { if (a.visibility != b.visibility || a.bindingType != b.bindingType) { return true; @@ -203,6 +203,7 @@ namespace dawn_native { case BindingInfoType::ExternalTexture: return false; } + UNREACHABLE(); } bool IsBufferBinding(const BindGroupLayoutEntry& binding) { diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp index bd7064839d..8b90173ff4 100644 --- a/src/dawn_native/Buffer.cpp +++ b/src/dawn_native/Buffer.cpp @@ -267,6 +267,7 @@ namespace dawn_native { case BufferState::Unmapped: return {}; } + UNREACHABLE(); } void BufferBase::CallMapCallback(MapRequestID mapID, WGPUBufferMapAsyncStatus status) { @@ -549,6 +550,7 @@ namespace dawn_native { case BufferState::Destroyed: return false; } + UNREACHABLE(); } MaybeError BufferBase::ValidateUnmap() const { @@ -566,6 +568,7 @@ namespace dawn_native { case BufferState::Destroyed: return DAWN_VALIDATION_ERROR("Buffer is destroyed"); } + UNREACHABLE(); } MaybeError BufferBase::ValidateDestroy() const { diff --git a/src/dawn_native/CommandValidation.cpp b/src/dawn_native/CommandValidation.cpp index 93f4278202..70cd082367 100644 --- a/src/dawn_native/CommandValidation.cpp +++ b/src/dawn_native/CommandValidation.cpp @@ -359,8 +359,9 @@ namespace dawn_native { return Aspect::Stencil; case wgpu::TextureAspect::Plane0Only: case wgpu::TextureAspect::Plane1Only: - UNREACHABLE(); + break; } + UNREACHABLE(); } MaybeError ValidateLinearToDepthStencilCopyRestrictions(const ImageCopyTexture& dst) { diff --git a/src/dawn_native/DawnNative.cpp b/src/dawn_native/DawnNative.cpp index 172ece936f..06c21c3de4 100644 --- a/src/dawn_native/DawnNative.cpp +++ b/src/dawn_native/DawnNative.cpp @@ -77,8 +77,9 @@ namespace dawn_native { case wgpu::BackendType::D3D11: case wgpu::BackendType::WebGPU: - UNREACHABLE(); + break; } + UNREACHABLE(); } DeviceType Adapter::GetDeviceType() const { @@ -92,6 +93,7 @@ namespace dawn_native { case wgpu::AdapterType::Unknown: return DeviceType::Unknown; } + UNREACHABLE(); } const PCIInfo& Adapter::GetPCIInfo() const { diff --git a/src/dawn_native/ErrorScope.cpp b/src/dawn_native/ErrorScope.cpp index 01c88ed573..d021de113a 100644 --- a/src/dawn_native/ErrorScope.cpp +++ b/src/dawn_native/ErrorScope.cpp @@ -29,6 +29,7 @@ namespace dawn_native { case wgpu::ErrorFilter::OutOfMemory: return wgpu::ErrorType::OutOfMemory; } + UNREACHABLE(); } } // namespace diff --git a/src/dawn_native/Format.cpp b/src/dawn_native/Format.cpp index 68bd87fd6f..f61c6308d8 100644 --- a/src/dawn_native/Format.cpp +++ b/src/dawn_native/Format.cpp @@ -37,6 +37,7 @@ namespace dawn_native { case wgpu::TextureComponentType::DepthComparison: return SampleTypeBit::Depth; } + UNREACHABLE(); } SampleTypeBit SampleTypeToSampleTypeBit(wgpu::TextureSampleType sampleType) { diff --git a/src/dawn_native/RenderPipeline.cpp b/src/dawn_native/RenderPipeline.cpp index 7bdfd0a893..79b8002193 100644 --- a/src/dawn_native/RenderPipeline.cpp +++ b/src/dawn_native/RenderPipeline.cpp @@ -372,8 +372,9 @@ namespace dawn_native { case wgpu::IndexFormat::Uint32: return sizeof(uint32_t); case wgpu::IndexFormat::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } bool IsStripPrimitiveTopology(wgpu::PrimitiveTopology primitiveTopology) { diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index d4f11524ad..56f61e0c9c 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -117,6 +117,7 @@ namespace dawn_native { case wgpu::VertexStepMode::Instance: return tint::transform::VertexStepMode::kInstance; } + UNREACHABLE(); } ResultOrError TintPipelineStageToShaderStage( @@ -129,8 +130,9 @@ namespace dawn_native { case tint::ast::PipelineStage::kCompute: return SingleShaderStage::Compute; case tint::ast::PipelineStage::kNone: - UNREACHABLE(); + break; } + UNREACHABLE(); } BindingInfoType TintResourceTypeToBindingInfoType( @@ -236,6 +238,7 @@ namespace dawn_native { case tint::inspector::ResourceBinding::ImageFormat::kNone: return wgpu::TextureFormat::Undefined; } + UNREACHABLE(); } wgpu::TextureViewDimension TintTextureDimensionToTextureViewDimension( @@ -256,6 +259,7 @@ namespace dawn_native { case tint::inspector::ResourceBinding::TextureDimension::kNone: return wgpu::TextureViewDimension::Undefined; } + UNREACHABLE(); } SampleTypeBit TintSampledKindToSampleTypeBit( @@ -270,6 +274,7 @@ namespace dawn_native { case tint::inspector::ResourceBinding::SampledKind::kUnknown: return SampleTypeBit::None; } + UNREACHABLE(); } ResultOrError TintComponentTypeToTextureComponentType( @@ -285,6 +290,7 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR( "Attempted to convert 'Unknown' component type from Tint"); } + UNREACHABLE(); } ResultOrError TintComponentTypeToVertexFormatBaseType( @@ -300,6 +306,7 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR( "Attempted to convert 'Unknown' component type from Tint"); } + UNREACHABLE(); } ResultOrError TintResourceTypeToBufferBindingType( @@ -314,6 +321,7 @@ namespace dawn_native { default: return DAWN_VALIDATION_ERROR("Attempted to convert non-buffer resource type"); } + UNREACHABLE(); } ResultOrError TintResourceTypeToStorageTextureAccess( @@ -325,6 +333,7 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR( "Attempted to convert non-storage texture resource type"); } + UNREACHABLE(); } ResultOrError TintComponentTypeToInterStageComponentType( @@ -340,6 +349,7 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR( "Attempted to convert 'Unknown' component type from Tint"); } + UNREACHABLE(); } ResultOrError TintCompositionTypeToInterStageComponentCount( @@ -357,6 +367,7 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR( "Attempt to convert 'Unknown' composition type from Tint"); } + UNREACHABLE(); } ResultOrError TintInterpolationTypeToInterpolationType( @@ -372,6 +383,7 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR( "Attempted to convert 'Unknown' interpolation type from Tint"); } + UNREACHABLE(); } ResultOrError TintInterpolationSamplingToInterpolationSamplingType( @@ -389,6 +401,7 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR( "Attempted to convert 'Unknown' interpolation sampling type from Tint"); } + UNREACHABLE(); } ResultOrError ParseWGSL(const tint::Source::File* file, diff --git a/src/dawn_native/Subresource.cpp b/src/dawn_native/Subresource.cpp index 99b42cb52a..ff0bd53fd1 100644 --- a/src/dawn_native/Subresource.cpp +++ b/src/dawn_native/Subresource.cpp @@ -59,6 +59,7 @@ namespace dawn_native { case wgpu::TextureAspect::Plane1Only: return format.aspects & Aspect::Plane1; } + UNREACHABLE(); } uint8_t GetAspectIndex(Aspect aspect) { diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp index 0194772663..e5c18c75d1 100644 --- a/src/dawn_native/Texture.cpp +++ b/src/dawn_native/Texture.cpp @@ -62,8 +62,9 @@ namespace dawn_native { case wgpu::TextureViewDimension::e1D: case wgpu::TextureViewDimension::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } // TODO(crbug.com/dawn/814): Implement for 1D texture. @@ -83,8 +84,9 @@ namespace dawn_native { case wgpu::TextureViewDimension::e1D: case wgpu::TextureViewDimension::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } bool IsTextureSizeValidForTextureViewDimension( @@ -101,8 +103,9 @@ namespace dawn_native { case wgpu::TextureViewDimension::e1D: case wgpu::TextureViewDimension::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } MaybeError ValidateSampleCount(const TextureDescriptor* descriptor, diff --git a/src/dawn_native/opengl/CommandBufferGL.cpp b/src/dawn_native/opengl/CommandBufferGL.cpp index f4bb61fa86..788eb9e275 100644 --- a/src/dawn_native/opengl/CommandBufferGL.cpp +++ b/src/dawn_native/opengl/CommandBufferGL.cpp @@ -45,8 +45,9 @@ namespace dawn_native { namespace opengl { case wgpu::IndexFormat::Uint32: return GL_UNSIGNED_INT; case wgpu::IndexFormat::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } GLenum VertexFormatType(wgpu::VertexFormat format) { diff --git a/src/dawn_native/opengl/PipelineGL.cpp b/src/dawn_native/opengl/PipelineGL.cpp index 4541e651f7..8ec9d61c82 100644 --- a/src/dawn_native/opengl/PipelineGL.cpp +++ b/src/dawn_native/opengl/PipelineGL.cpp @@ -40,6 +40,7 @@ namespace dawn_native { namespace opengl { case SingleShaderStage::Compute: return GL_COMPUTE_SHADER; } + UNREACHABLE(); } } // namespace diff --git a/src/dawn_native/opengl/RenderPipelineGL.cpp b/src/dawn_native/opengl/RenderPipelineGL.cpp index 45d998603a..d5d84096e4 100644 --- a/src/dawn_native/opengl/RenderPipelineGL.cpp +++ b/src/dawn_native/opengl/RenderPipelineGL.cpp @@ -36,6 +36,7 @@ namespace dawn_native { namespace opengl { case wgpu::PrimitiveTopology::TriangleStrip: return GL_TRIANGLE_STRIP; } + UNREACHABLE(); } void ApplyFrontFaceAndCulling(const OpenGLFunctions& gl, @@ -85,6 +86,7 @@ namespace dawn_native { namespace opengl { case wgpu::BlendFactor::OneMinusConstant: return alpha ? GL_ONE_MINUS_CONSTANT_ALPHA : GL_ONE_MINUS_CONSTANT_COLOR; } + UNREACHABLE(); } GLenum GLBlendMode(wgpu::BlendOperation operation) { @@ -100,6 +102,7 @@ namespace dawn_native { namespace opengl { case wgpu::BlendOperation::Max: return GL_MAX; } + UNREACHABLE(); } void ApplyColorState(const OpenGLFunctions& gl, @@ -166,6 +169,7 @@ namespace dawn_native { namespace opengl { case wgpu::StencilOperation::DecrementWrap: return GL_DECR_WRAP; } + UNREACHABLE(); } void ApplyDepthStencilState(const OpenGLFunctions& gl, diff --git a/src/dawn_native/opengl/SamplerGL.cpp b/src/dawn_native/opengl/SamplerGL.cpp index 32aa56f620..81fdd46da2 100644 --- a/src/dawn_native/opengl/SamplerGL.cpp +++ b/src/dawn_native/opengl/SamplerGL.cpp @@ -28,6 +28,7 @@ namespace dawn_native { namespace opengl { case wgpu::FilterMode::Linear: return GL_LINEAR; } + UNREACHABLE(); } GLenum MinFilterMode(wgpu::FilterMode minFilter, wgpu::FilterMode mipMapFilter) { @@ -47,6 +48,7 @@ namespace dawn_native { namespace opengl { return GL_LINEAR_MIPMAP_LINEAR; } } + UNREACHABLE(); } GLenum WrapMode(wgpu::AddressMode mode) { @@ -58,6 +60,7 @@ namespace dawn_native { namespace opengl { case wgpu::AddressMode::ClampToEdge: return GL_CLAMP_TO_EDGE; } + UNREACHABLE(); } } // namespace diff --git a/src/dawn_native/opengl/SpirvUtils.cpp b/src/dawn_native/opengl/SpirvUtils.cpp index a274300b31..6ce41ca7be 100644 --- a/src/dawn_native/opengl/SpirvUtils.cpp +++ b/src/dawn_native/opengl/SpirvUtils.cpp @@ -25,6 +25,7 @@ namespace dawn_native { case SingleShaderStage::Compute: return spv::ExecutionModelGLCompute; } + UNREACHABLE(); } SingleShaderStage ExecutionModelToShaderStage(spv::ExecutionModel model) { diff --git a/src/dawn_native/opengl/TextureGL.cpp b/src/dawn_native/opengl/TextureGL.cpp index 1f40f96c19..f8f76bf65d 100644 --- a/src/dawn_native/opengl/TextureGL.cpp +++ b/src/dawn_native/opengl/TextureGL.cpp @@ -44,8 +44,9 @@ namespace dawn_native { namespace opengl { return GL_TEXTURE_3D; case wgpu::TextureDimension::e1D: - UNREACHABLE(); + break; } + UNREACHABLE(); } GLenum TargetForTextureViewDimension(wgpu::TextureViewDimension dimension, @@ -69,8 +70,9 @@ namespace dawn_native { namespace opengl { case wgpu::TextureViewDimension::e1D: case wgpu::TextureViewDimension::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } GLuint GenTexture(const OpenGLFunctions& gl) { diff --git a/src/dawn_native/opengl/UtilsGL.cpp b/src/dawn_native/opengl/UtilsGL.cpp index 804df662f1..413336b5e6 100644 --- a/src/dawn_native/opengl/UtilsGL.cpp +++ b/src/dawn_native/opengl/UtilsGL.cpp @@ -38,8 +38,9 @@ namespace dawn_native { namespace opengl { return GL_ALWAYS; case wgpu::CompareFunction::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } GLint GetStencilMaskFromStencilFormat(wgpu::TextureFormat depthStencilFormat) { diff --git a/src/dawn_native/vulkan/BindGroupLayoutVk.cpp b/src/dawn_native/vulkan/BindGroupLayoutVk.cpp index 53e636c604..b4647582e9 100644 --- a/src/dawn_native/vulkan/BindGroupLayoutVk.cpp +++ b/src/dawn_native/vulkan/BindGroupLayoutVk.cpp @@ -73,6 +73,7 @@ namespace dawn_native { namespace vulkan { case BindingInfoType::StorageTexture: return VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; } + UNREACHABLE(); } // static diff --git a/src/dawn_native/vulkan/CommandBufferVk.cpp b/src/dawn_native/vulkan/CommandBufferVk.cpp index 36f6a39997..a987a8442f 100644 --- a/src/dawn_native/vulkan/CommandBufferVk.cpp +++ b/src/dawn_native/vulkan/CommandBufferVk.cpp @@ -49,8 +49,9 @@ namespace dawn_native { namespace vulkan { case wgpu::IndexFormat::Uint32: return VK_INDEX_TYPE_UINT32; case wgpu::IndexFormat::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } bool HasSameTextureCopyExtent(const TextureCopy& srcCopy, diff --git a/src/dawn_native/vulkan/QuerySetVk.cpp b/src/dawn_native/vulkan/QuerySetVk.cpp index fe24980d70..ba60c3dc7c 100644 --- a/src/dawn_native/vulkan/QuerySetVk.cpp +++ b/src/dawn_native/vulkan/QuerySetVk.cpp @@ -31,6 +31,7 @@ namespace dawn_native { namespace vulkan { case wgpu::QueryType::Timestamp: return VK_QUERY_TYPE_TIMESTAMP; } + UNREACHABLE(); } VkQueryPipelineStatisticFlags VulkanQueryPipelineStatisticFlags( diff --git a/src/dawn_native/vulkan/RenderPassCache.cpp b/src/dawn_native/vulkan/RenderPassCache.cpp index 1bafac2088..ed2bc42c25 100644 --- a/src/dawn_native/vulkan/RenderPassCache.cpp +++ b/src/dawn_native/vulkan/RenderPassCache.cpp @@ -30,6 +30,7 @@ namespace dawn_native { namespace vulkan { case wgpu::LoadOp::Clear: return VK_ATTACHMENT_LOAD_OP_CLEAR; } + UNREACHABLE(); } } // anonymous namespace diff --git a/src/dawn_native/vulkan/RenderPipelineVk.cpp b/src/dawn_native/vulkan/RenderPipelineVk.cpp index 2ece1f23aa..7276cc43a1 100644 --- a/src/dawn_native/vulkan/RenderPipelineVk.cpp +++ b/src/dawn_native/vulkan/RenderPipelineVk.cpp @@ -34,6 +34,7 @@ namespace dawn_native { namespace vulkan { case wgpu::VertexStepMode::Instance: return VK_VERTEX_INPUT_RATE_INSTANCE; } + UNREACHABLE(); } VkFormat VulkanVertexFormat(wgpu::VertexFormat format) { @@ -116,6 +117,7 @@ namespace dawn_native { namespace vulkan { case wgpu::PrimitiveTopology::TriangleStrip: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; } + UNREACHABLE(); } bool ShouldEnablePrimitiveRestart(wgpu::PrimitiveTopology topology) { @@ -130,6 +132,7 @@ namespace dawn_native { namespace vulkan { case wgpu::PrimitiveTopology::TriangleStrip: return true; } + UNREACHABLE(); } VkFrontFace VulkanFrontFace(wgpu::FrontFace face) { @@ -139,6 +142,7 @@ namespace dawn_native { namespace vulkan { case wgpu::FrontFace::CW: return VK_FRONT_FACE_CLOCKWISE; } + UNREACHABLE(); } VkCullModeFlagBits VulkanCullMode(wgpu::CullMode mode) { @@ -150,6 +154,7 @@ namespace dawn_native { namespace vulkan { case wgpu::CullMode::Back: return VK_CULL_MODE_BACK_BIT; } + UNREACHABLE(); } VkBlendFactor VulkanBlendFactor(wgpu::BlendFactor factor) { @@ -181,6 +186,7 @@ namespace dawn_native { namespace vulkan { case wgpu::BlendFactor::OneMinusConstant: return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR; } + UNREACHABLE(); } VkBlendOp VulkanBlendOperation(wgpu::BlendOperation operation) { @@ -196,6 +202,7 @@ namespace dawn_native { namespace vulkan { case wgpu::BlendOperation::Max: return VK_BLEND_OP_MAX; } + UNREACHABLE(); } VkColorComponentFlags VulkanColorWriteMask(wgpu::ColorWriteMask mask, @@ -267,6 +274,7 @@ namespace dawn_native { namespace vulkan { case wgpu::StencilOperation::DecrementWrap: return VK_STENCIL_OP_DECREMENT_AND_WRAP; } + UNREACHABLE(); } VkPipelineDepthStencilStateCreateInfo ComputeDepthStencilDesc( diff --git a/src/dawn_native/vulkan/SamplerVk.cpp b/src/dawn_native/vulkan/SamplerVk.cpp index c5e852b5e9..c056515a5c 100644 --- a/src/dawn_native/vulkan/SamplerVk.cpp +++ b/src/dawn_native/vulkan/SamplerVk.cpp @@ -31,6 +31,7 @@ namespace dawn_native { namespace vulkan { case wgpu::AddressMode::ClampToEdge: return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; } + UNREACHABLE(); } VkFilter VulkanSamplerFilter(wgpu::FilterMode filter) { @@ -40,6 +41,7 @@ namespace dawn_native { namespace vulkan { case wgpu::FilterMode::Nearest: return VK_FILTER_NEAREST; } + UNREACHABLE(); } VkSamplerMipmapMode VulkanMipMapMode(wgpu::FilterMode filter) { @@ -49,6 +51,7 @@ namespace dawn_native { namespace vulkan { case wgpu::FilterMode::Nearest: return VK_SAMPLER_MIPMAP_MODE_NEAREST; } + UNREACHABLE(); } } // anonymous namespace diff --git a/src/dawn_native/vulkan/SwapChainVk.cpp b/src/dawn_native/vulkan/SwapChainVk.cpp index 933f7b4d99..c0f856fca3 100644 --- a/src/dawn_native/vulkan/SwapChainVk.cpp +++ b/src/dawn_native/vulkan/SwapChainVk.cpp @@ -194,6 +194,7 @@ namespace dawn_native { namespace vulkan { case wgpu::PresentMode::Mailbox: return VK_PRESENT_MODE_MAILBOX_KHR; } + UNREACHABLE(); } uint32_t MinImageCountForPresentMode(VkPresentModeKHR mode) { @@ -204,8 +205,9 @@ namespace dawn_native { namespace vulkan { case VK_PRESENT_MODE_MAILBOX_KHR: return 3; default: - UNREACHABLE(); + break; } + UNREACHABLE(); } } // anonymous namespace diff --git a/src/dawn_native/vulkan/TextureVk.cpp b/src/dawn_native/vulkan/TextureVk.cpp index 0cef6f0de1..70fbeee776 100644 --- a/src/dawn_native/vulkan/TextureVk.cpp +++ b/src/dawn_native/vulkan/TextureVk.cpp @@ -51,8 +51,9 @@ namespace dawn_native { namespace vulkan { case wgpu::TextureViewDimension::e1D: case wgpu::TextureViewDimension::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } // Computes which vulkan access type could be required for the given Dawn usage. @@ -419,8 +420,9 @@ namespace dawn_native { namespace vulkan { // TODO(dawn:570): implement depth16unorm case wgpu::TextureFormat::Depth16Unorm: case wgpu::TextureFormat::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } // Converts the Dawn usage flags to Vulkan usage flags. Also needs the format to choose @@ -508,8 +510,9 @@ namespace dawn_native { namespace vulkan { return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; case wgpu::TextureUsage::None: - UNREACHABLE(); + break; } + UNREACHABLE(); } VkSampleCountFlagBits VulkanSampleCount(uint32_t sampleCount) { @@ -518,9 +521,8 @@ namespace dawn_native { namespace vulkan { return VK_SAMPLE_COUNT_1_BIT; case 4: return VK_SAMPLE_COUNT_4_BIT; - default: - UNREACHABLE(); } + UNREACHABLE(); } MaybeError ValidateVulkanImageCanBeWrapped(const DeviceBase*, @@ -853,8 +855,9 @@ namespace dawn_native { namespace vulkan { return VulkanAspectMask(Aspect::Stencil); case wgpu::TextureAspect::Plane0Only: case wgpu::TextureAspect::Plane1Only: - UNREACHABLE(); + break; } + UNREACHABLE(); } void Texture::TweakTransitionForExternalUsage(CommandRecordingContext* recordingContext, diff --git a/src/dawn_native/vulkan/UtilsVulkan.cpp b/src/dawn_native/vulkan/UtilsVulkan.cpp index fd7a4ae8df..b04c0a4fe1 100644 --- a/src/dawn_native/vulkan/UtilsVulkan.cpp +++ b/src/dawn_native/vulkan/UtilsVulkan.cpp @@ -44,8 +44,9 @@ namespace dawn_native { namespace vulkan { return VK_COMPARE_OP_ALWAYS; case wgpu::CompareFunction::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } // Convert Dawn texture aspects to Vulkan texture aspect flags diff --git a/src/utils/TestUtils.cpp b/src/utils/TestUtils.cpp index 8f359abe57..d55a8c2f60 100644 --- a/src/utils/TestUtils.cpp +++ b/src/utils/TestUtils.cpp @@ -173,8 +173,9 @@ namespace utils { case wgpu::VertexFormat::Sint32x4: return 16; case wgpu::VertexFormat::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } } // namespace utils diff --git a/src/utils/TextureUtils.cpp b/src/utils/TextureUtils.cpp index 2747fa2c3c..aaa808e5b7 100644 --- a/src/utils/TextureUtils.cpp +++ b/src/utils/TextureUtils.cpp @@ -241,8 +241,9 @@ namespace utils { // TODO(dawn:570): implement depth16unorm case wgpu::TextureFormat::Depth16Unorm: case wgpu::TextureFormat::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } uint32_t GetTextureFormatBlockWidth(wgpu::TextureFormat textureFormat) { @@ -357,8 +358,9 @@ namespace utils { // TODO(dawn:570): implement depth16unorm case wgpu::TextureFormat::Depth16Unorm: case wgpu::TextureFormat::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } uint32_t GetTextureFormatBlockHeight(wgpu::TextureFormat textureFormat) { @@ -473,8 +475,9 @@ namespace utils { // TODO(dawn:570): implement depth16unorm case wgpu::TextureFormat::Depth16Unorm: case wgpu::TextureFormat::Undefined: - UNREACHABLE(); + break; } + UNREACHABLE(); } const char* GetWGSLColorTextureComponentType(wgpu::TextureFormat textureFormat) {