Fix all GCC 10 warnings

Change-Id: Ibabab265e734a4a421a38ab586e7e11905fa5da1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64740
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2021-09-23 17:34:53 +00:00 committed by Dawn LUCI CQ
parent e0da9ffedd
commit 999cc24209
31 changed files with 106 additions and 26 deletions

View File

@ -14,6 +14,11 @@
#include "dawn_native/wgpu_structs_autogen.h" #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 { namespace dawn_native {
static_assert(sizeof(ChainedStruct) == sizeof(WGPUChainedStruct), static_assert(sizeof(ChainedStruct) == sizeof(WGPUChainedStruct),

View File

@ -23,6 +23,11 @@
#include <cstring> #include <cstring>
#include <limits> #include <limits>
#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. //* 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. //* Outputs an rvalue that's the number of elements a pointer member points to.

View File

@ -17,6 +17,11 @@
#include "webgpu/webgpu_cpp.h" #include "webgpu/webgpu_cpp.h"
{% endif %} {% endif %}
#ifdef __GNUC__
// error: 'offsetof' within non-standard-layout type 'wgpu::XXX' is conditionally-supported
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif
namespace wgpu { namespace wgpu {
{% for type in by_category["enum"] %} {% for type in by_category["enum"] %}
{% set CppType = as_cppType(type.name) %} {% set CppType = as_cppType(type.name) %}

View File

@ -56,8 +56,9 @@ namespace dawn_native {
return {}; return {};
case wgpu::TextureViewDimension::Undefined: case wgpu::TextureViewDimension::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
} // anonymous namespace } // anonymous namespace
@ -179,7 +180,6 @@ namespace dawn_native {
namespace { namespace {
bool operator!=(const BindingInfo& a, const BindingInfo& b) { bool operator!=(const BindingInfo& a, const BindingInfo& b) {
if (a.visibility != b.visibility || a.bindingType != b.bindingType) { if (a.visibility != b.visibility || a.bindingType != b.bindingType) {
return true; return true;
@ -203,6 +203,7 @@ namespace dawn_native {
case BindingInfoType::ExternalTexture: case BindingInfoType::ExternalTexture:
return false; return false;
} }
UNREACHABLE();
} }
bool IsBufferBinding(const BindGroupLayoutEntry& binding) { bool IsBufferBinding(const BindGroupLayoutEntry& binding) {

View File

@ -267,6 +267,7 @@ namespace dawn_native {
case BufferState::Unmapped: case BufferState::Unmapped:
return {}; return {};
} }
UNREACHABLE();
} }
void BufferBase::CallMapCallback(MapRequestID mapID, WGPUBufferMapAsyncStatus status) { void BufferBase::CallMapCallback(MapRequestID mapID, WGPUBufferMapAsyncStatus status) {
@ -549,6 +550,7 @@ namespace dawn_native {
case BufferState::Destroyed: case BufferState::Destroyed:
return false; return false;
} }
UNREACHABLE();
} }
MaybeError BufferBase::ValidateUnmap() const { MaybeError BufferBase::ValidateUnmap() const {
@ -566,6 +568,7 @@ namespace dawn_native {
case BufferState::Destroyed: case BufferState::Destroyed:
return DAWN_VALIDATION_ERROR("Buffer is destroyed"); return DAWN_VALIDATION_ERROR("Buffer is destroyed");
} }
UNREACHABLE();
} }
MaybeError BufferBase::ValidateDestroy() const { MaybeError BufferBase::ValidateDestroy() const {

View File

@ -359,8 +359,9 @@ namespace dawn_native {
return Aspect::Stencil; return Aspect::Stencil;
case wgpu::TextureAspect::Plane0Only: case wgpu::TextureAspect::Plane0Only:
case wgpu::TextureAspect::Plane1Only: case wgpu::TextureAspect::Plane1Only:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
MaybeError ValidateLinearToDepthStencilCopyRestrictions(const ImageCopyTexture& dst) { MaybeError ValidateLinearToDepthStencilCopyRestrictions(const ImageCopyTexture& dst) {

View File

@ -77,8 +77,9 @@ namespace dawn_native {
case wgpu::BackendType::D3D11: case wgpu::BackendType::D3D11:
case wgpu::BackendType::WebGPU: case wgpu::BackendType::WebGPU:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
DeviceType Adapter::GetDeviceType() const { DeviceType Adapter::GetDeviceType() const {
@ -92,6 +93,7 @@ namespace dawn_native {
case wgpu::AdapterType::Unknown: case wgpu::AdapterType::Unknown:
return DeviceType::Unknown; return DeviceType::Unknown;
} }
UNREACHABLE();
} }
const PCIInfo& Adapter::GetPCIInfo() const { const PCIInfo& Adapter::GetPCIInfo() const {

View File

@ -29,6 +29,7 @@ namespace dawn_native {
case wgpu::ErrorFilter::OutOfMemory: case wgpu::ErrorFilter::OutOfMemory:
return wgpu::ErrorType::OutOfMemory; return wgpu::ErrorType::OutOfMemory;
} }
UNREACHABLE();
} }
} // namespace } // namespace

View File

@ -37,6 +37,7 @@ namespace dawn_native {
case wgpu::TextureComponentType::DepthComparison: case wgpu::TextureComponentType::DepthComparison:
return SampleTypeBit::Depth; return SampleTypeBit::Depth;
} }
UNREACHABLE();
} }
SampleTypeBit SampleTypeToSampleTypeBit(wgpu::TextureSampleType sampleType) { SampleTypeBit SampleTypeToSampleTypeBit(wgpu::TextureSampleType sampleType) {

View File

@ -372,8 +372,9 @@ namespace dawn_native {
case wgpu::IndexFormat::Uint32: case wgpu::IndexFormat::Uint32:
return sizeof(uint32_t); return sizeof(uint32_t);
case wgpu::IndexFormat::Undefined: case wgpu::IndexFormat::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
bool IsStripPrimitiveTopology(wgpu::PrimitiveTopology primitiveTopology) { bool IsStripPrimitiveTopology(wgpu::PrimitiveTopology primitiveTopology) {

View File

@ -117,6 +117,7 @@ namespace dawn_native {
case wgpu::VertexStepMode::Instance: case wgpu::VertexStepMode::Instance:
return tint::transform::VertexStepMode::kInstance; return tint::transform::VertexStepMode::kInstance;
} }
UNREACHABLE();
} }
ResultOrError<SingleShaderStage> TintPipelineStageToShaderStage( ResultOrError<SingleShaderStage> TintPipelineStageToShaderStage(
@ -129,8 +130,9 @@ namespace dawn_native {
case tint::ast::PipelineStage::kCompute: case tint::ast::PipelineStage::kCompute:
return SingleShaderStage::Compute; return SingleShaderStage::Compute;
case tint::ast::PipelineStage::kNone: case tint::ast::PipelineStage::kNone:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
BindingInfoType TintResourceTypeToBindingInfoType( BindingInfoType TintResourceTypeToBindingInfoType(
@ -236,6 +238,7 @@ namespace dawn_native {
case tint::inspector::ResourceBinding::ImageFormat::kNone: case tint::inspector::ResourceBinding::ImageFormat::kNone:
return wgpu::TextureFormat::Undefined; return wgpu::TextureFormat::Undefined;
} }
UNREACHABLE();
} }
wgpu::TextureViewDimension TintTextureDimensionToTextureViewDimension( wgpu::TextureViewDimension TintTextureDimensionToTextureViewDimension(
@ -256,6 +259,7 @@ namespace dawn_native {
case tint::inspector::ResourceBinding::TextureDimension::kNone: case tint::inspector::ResourceBinding::TextureDimension::kNone:
return wgpu::TextureViewDimension::Undefined; return wgpu::TextureViewDimension::Undefined;
} }
UNREACHABLE();
} }
SampleTypeBit TintSampledKindToSampleTypeBit( SampleTypeBit TintSampledKindToSampleTypeBit(
@ -270,6 +274,7 @@ namespace dawn_native {
case tint::inspector::ResourceBinding::SampledKind::kUnknown: case tint::inspector::ResourceBinding::SampledKind::kUnknown:
return SampleTypeBit::None; return SampleTypeBit::None;
} }
UNREACHABLE();
} }
ResultOrError<wgpu::TextureComponentType> TintComponentTypeToTextureComponentType( ResultOrError<wgpu::TextureComponentType> TintComponentTypeToTextureComponentType(
@ -285,6 +290,7 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR( return DAWN_VALIDATION_ERROR(
"Attempted to convert 'Unknown' component type from Tint"); "Attempted to convert 'Unknown' component type from Tint");
} }
UNREACHABLE();
} }
ResultOrError<VertexFormatBaseType> TintComponentTypeToVertexFormatBaseType( ResultOrError<VertexFormatBaseType> TintComponentTypeToVertexFormatBaseType(
@ -300,6 +306,7 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR( return DAWN_VALIDATION_ERROR(
"Attempted to convert 'Unknown' component type from Tint"); "Attempted to convert 'Unknown' component type from Tint");
} }
UNREACHABLE();
} }
ResultOrError<wgpu::BufferBindingType> TintResourceTypeToBufferBindingType( ResultOrError<wgpu::BufferBindingType> TintResourceTypeToBufferBindingType(
@ -314,6 +321,7 @@ namespace dawn_native {
default: default:
return DAWN_VALIDATION_ERROR("Attempted to convert non-buffer resource type"); return DAWN_VALIDATION_ERROR("Attempted to convert non-buffer resource type");
} }
UNREACHABLE();
} }
ResultOrError<wgpu::StorageTextureAccess> TintResourceTypeToStorageTextureAccess( ResultOrError<wgpu::StorageTextureAccess> TintResourceTypeToStorageTextureAccess(
@ -325,6 +333,7 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR( return DAWN_VALIDATION_ERROR(
"Attempted to convert non-storage texture resource type"); "Attempted to convert non-storage texture resource type");
} }
UNREACHABLE();
} }
ResultOrError<InterStageComponentType> TintComponentTypeToInterStageComponentType( ResultOrError<InterStageComponentType> TintComponentTypeToInterStageComponentType(
@ -340,6 +349,7 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR( return DAWN_VALIDATION_ERROR(
"Attempted to convert 'Unknown' component type from Tint"); "Attempted to convert 'Unknown' component type from Tint");
} }
UNREACHABLE();
} }
ResultOrError<uint32_t> TintCompositionTypeToInterStageComponentCount( ResultOrError<uint32_t> TintCompositionTypeToInterStageComponentCount(
@ -357,6 +367,7 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR( return DAWN_VALIDATION_ERROR(
"Attempt to convert 'Unknown' composition type from Tint"); "Attempt to convert 'Unknown' composition type from Tint");
} }
UNREACHABLE();
} }
ResultOrError<InterpolationType> TintInterpolationTypeToInterpolationType( ResultOrError<InterpolationType> TintInterpolationTypeToInterpolationType(
@ -372,6 +383,7 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR( return DAWN_VALIDATION_ERROR(
"Attempted to convert 'Unknown' interpolation type from Tint"); "Attempted to convert 'Unknown' interpolation type from Tint");
} }
UNREACHABLE();
} }
ResultOrError<InterpolationSampling> TintInterpolationSamplingToInterpolationSamplingType( ResultOrError<InterpolationSampling> TintInterpolationSamplingToInterpolationSamplingType(
@ -389,6 +401,7 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR( return DAWN_VALIDATION_ERROR(
"Attempted to convert 'Unknown' interpolation sampling type from Tint"); "Attempted to convert 'Unknown' interpolation sampling type from Tint");
} }
UNREACHABLE();
} }
ResultOrError<tint::Program> ParseWGSL(const tint::Source::File* file, ResultOrError<tint::Program> ParseWGSL(const tint::Source::File* file,

View File

@ -59,6 +59,7 @@ namespace dawn_native {
case wgpu::TextureAspect::Plane1Only: case wgpu::TextureAspect::Plane1Only:
return format.aspects & Aspect::Plane1; return format.aspects & Aspect::Plane1;
} }
UNREACHABLE();
} }
uint8_t GetAspectIndex(Aspect aspect) { uint8_t GetAspectIndex(Aspect aspect) {

View File

@ -62,8 +62,9 @@ namespace dawn_native {
case wgpu::TextureViewDimension::e1D: case wgpu::TextureViewDimension::e1D:
case wgpu::TextureViewDimension::Undefined: case wgpu::TextureViewDimension::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
// TODO(crbug.com/dawn/814): Implement for 1D texture. // TODO(crbug.com/dawn/814): Implement for 1D texture.
@ -83,8 +84,9 @@ namespace dawn_native {
case wgpu::TextureViewDimension::e1D: case wgpu::TextureViewDimension::e1D:
case wgpu::TextureViewDimension::Undefined: case wgpu::TextureViewDimension::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
bool IsTextureSizeValidForTextureViewDimension( bool IsTextureSizeValidForTextureViewDimension(
@ -101,8 +103,9 @@ namespace dawn_native {
case wgpu::TextureViewDimension::e1D: case wgpu::TextureViewDimension::e1D:
case wgpu::TextureViewDimension::Undefined: case wgpu::TextureViewDimension::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
MaybeError ValidateSampleCount(const TextureDescriptor* descriptor, MaybeError ValidateSampleCount(const TextureDescriptor* descriptor,

View File

@ -45,8 +45,9 @@ namespace dawn_native { namespace opengl {
case wgpu::IndexFormat::Uint32: case wgpu::IndexFormat::Uint32:
return GL_UNSIGNED_INT; return GL_UNSIGNED_INT;
case wgpu::IndexFormat::Undefined: case wgpu::IndexFormat::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
GLenum VertexFormatType(wgpu::VertexFormat format) { GLenum VertexFormatType(wgpu::VertexFormat format) {

View File

@ -40,6 +40,7 @@ namespace dawn_native { namespace opengl {
case SingleShaderStage::Compute: case SingleShaderStage::Compute:
return GL_COMPUTE_SHADER; return GL_COMPUTE_SHADER;
} }
UNREACHABLE();
} }
} // namespace } // namespace

View File

@ -36,6 +36,7 @@ namespace dawn_native { namespace opengl {
case wgpu::PrimitiveTopology::TriangleStrip: case wgpu::PrimitiveTopology::TriangleStrip:
return GL_TRIANGLE_STRIP; return GL_TRIANGLE_STRIP;
} }
UNREACHABLE();
} }
void ApplyFrontFaceAndCulling(const OpenGLFunctions& gl, void ApplyFrontFaceAndCulling(const OpenGLFunctions& gl,
@ -85,6 +86,7 @@ namespace dawn_native { namespace opengl {
case wgpu::BlendFactor::OneMinusConstant: case wgpu::BlendFactor::OneMinusConstant:
return alpha ? GL_ONE_MINUS_CONSTANT_ALPHA : GL_ONE_MINUS_CONSTANT_COLOR; return alpha ? GL_ONE_MINUS_CONSTANT_ALPHA : GL_ONE_MINUS_CONSTANT_COLOR;
} }
UNREACHABLE();
} }
GLenum GLBlendMode(wgpu::BlendOperation operation) { GLenum GLBlendMode(wgpu::BlendOperation operation) {
@ -100,6 +102,7 @@ namespace dawn_native { namespace opengl {
case wgpu::BlendOperation::Max: case wgpu::BlendOperation::Max:
return GL_MAX; return GL_MAX;
} }
UNREACHABLE();
} }
void ApplyColorState(const OpenGLFunctions& gl, void ApplyColorState(const OpenGLFunctions& gl,
@ -166,6 +169,7 @@ namespace dawn_native { namespace opengl {
case wgpu::StencilOperation::DecrementWrap: case wgpu::StencilOperation::DecrementWrap:
return GL_DECR_WRAP; return GL_DECR_WRAP;
} }
UNREACHABLE();
} }
void ApplyDepthStencilState(const OpenGLFunctions& gl, void ApplyDepthStencilState(const OpenGLFunctions& gl,

View File

@ -28,6 +28,7 @@ namespace dawn_native { namespace opengl {
case wgpu::FilterMode::Linear: case wgpu::FilterMode::Linear:
return GL_LINEAR; return GL_LINEAR;
} }
UNREACHABLE();
} }
GLenum MinFilterMode(wgpu::FilterMode minFilter, wgpu::FilterMode mipMapFilter) { GLenum MinFilterMode(wgpu::FilterMode minFilter, wgpu::FilterMode mipMapFilter) {
@ -47,6 +48,7 @@ namespace dawn_native { namespace opengl {
return GL_LINEAR_MIPMAP_LINEAR; return GL_LINEAR_MIPMAP_LINEAR;
} }
} }
UNREACHABLE();
} }
GLenum WrapMode(wgpu::AddressMode mode) { GLenum WrapMode(wgpu::AddressMode mode) {
@ -58,6 +60,7 @@ namespace dawn_native { namespace opengl {
case wgpu::AddressMode::ClampToEdge: case wgpu::AddressMode::ClampToEdge:
return GL_CLAMP_TO_EDGE; return GL_CLAMP_TO_EDGE;
} }
UNREACHABLE();
} }
} // namespace } // namespace

View File

@ -25,6 +25,7 @@ namespace dawn_native {
case SingleShaderStage::Compute: case SingleShaderStage::Compute:
return spv::ExecutionModelGLCompute; return spv::ExecutionModelGLCompute;
} }
UNREACHABLE();
} }
SingleShaderStage ExecutionModelToShaderStage(spv::ExecutionModel model) { SingleShaderStage ExecutionModelToShaderStage(spv::ExecutionModel model) {

View File

@ -44,8 +44,9 @@ namespace dawn_native { namespace opengl {
return GL_TEXTURE_3D; return GL_TEXTURE_3D;
case wgpu::TextureDimension::e1D: case wgpu::TextureDimension::e1D:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
GLenum TargetForTextureViewDimension(wgpu::TextureViewDimension dimension, GLenum TargetForTextureViewDimension(wgpu::TextureViewDimension dimension,
@ -69,8 +70,9 @@ namespace dawn_native { namespace opengl {
case wgpu::TextureViewDimension::e1D: case wgpu::TextureViewDimension::e1D:
case wgpu::TextureViewDimension::Undefined: case wgpu::TextureViewDimension::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
GLuint GenTexture(const OpenGLFunctions& gl) { GLuint GenTexture(const OpenGLFunctions& gl) {

View File

@ -38,8 +38,9 @@ namespace dawn_native { namespace opengl {
return GL_ALWAYS; return GL_ALWAYS;
case wgpu::CompareFunction::Undefined: case wgpu::CompareFunction::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
GLint GetStencilMaskFromStencilFormat(wgpu::TextureFormat depthStencilFormat) { GLint GetStencilMaskFromStencilFormat(wgpu::TextureFormat depthStencilFormat) {

View File

@ -73,6 +73,7 @@ namespace dawn_native { namespace vulkan {
case BindingInfoType::StorageTexture: case BindingInfoType::StorageTexture:
return VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; return VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
} }
UNREACHABLE();
} }
// static // static

View File

@ -49,8 +49,9 @@ namespace dawn_native { namespace vulkan {
case wgpu::IndexFormat::Uint32: case wgpu::IndexFormat::Uint32:
return VK_INDEX_TYPE_UINT32; return VK_INDEX_TYPE_UINT32;
case wgpu::IndexFormat::Undefined: case wgpu::IndexFormat::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
bool HasSameTextureCopyExtent(const TextureCopy& srcCopy, bool HasSameTextureCopyExtent(const TextureCopy& srcCopy,

View File

@ -31,6 +31,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::QueryType::Timestamp: case wgpu::QueryType::Timestamp:
return VK_QUERY_TYPE_TIMESTAMP; return VK_QUERY_TYPE_TIMESTAMP;
} }
UNREACHABLE();
} }
VkQueryPipelineStatisticFlags VulkanQueryPipelineStatisticFlags( VkQueryPipelineStatisticFlags VulkanQueryPipelineStatisticFlags(

View File

@ -30,6 +30,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::LoadOp::Clear: case wgpu::LoadOp::Clear:
return VK_ATTACHMENT_LOAD_OP_CLEAR; return VK_ATTACHMENT_LOAD_OP_CLEAR;
} }
UNREACHABLE();
} }
} // anonymous namespace } // anonymous namespace

View File

@ -34,6 +34,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::VertexStepMode::Instance: case wgpu::VertexStepMode::Instance:
return VK_VERTEX_INPUT_RATE_INSTANCE; return VK_VERTEX_INPUT_RATE_INSTANCE;
} }
UNREACHABLE();
} }
VkFormat VulkanVertexFormat(wgpu::VertexFormat format) { VkFormat VulkanVertexFormat(wgpu::VertexFormat format) {
@ -116,6 +117,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::PrimitiveTopology::TriangleStrip: case wgpu::PrimitiveTopology::TriangleStrip:
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
} }
UNREACHABLE();
} }
bool ShouldEnablePrimitiveRestart(wgpu::PrimitiveTopology topology) { bool ShouldEnablePrimitiveRestart(wgpu::PrimitiveTopology topology) {
@ -130,6 +132,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::PrimitiveTopology::TriangleStrip: case wgpu::PrimitiveTopology::TriangleStrip:
return true; return true;
} }
UNREACHABLE();
} }
VkFrontFace VulkanFrontFace(wgpu::FrontFace face) { VkFrontFace VulkanFrontFace(wgpu::FrontFace face) {
@ -139,6 +142,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::FrontFace::CW: case wgpu::FrontFace::CW:
return VK_FRONT_FACE_CLOCKWISE; return VK_FRONT_FACE_CLOCKWISE;
} }
UNREACHABLE();
} }
VkCullModeFlagBits VulkanCullMode(wgpu::CullMode mode) { VkCullModeFlagBits VulkanCullMode(wgpu::CullMode mode) {
@ -150,6 +154,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::CullMode::Back: case wgpu::CullMode::Back:
return VK_CULL_MODE_BACK_BIT; return VK_CULL_MODE_BACK_BIT;
} }
UNREACHABLE();
} }
VkBlendFactor VulkanBlendFactor(wgpu::BlendFactor factor) { VkBlendFactor VulkanBlendFactor(wgpu::BlendFactor factor) {
@ -181,6 +186,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::BlendFactor::OneMinusConstant: case wgpu::BlendFactor::OneMinusConstant:
return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR; return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR;
} }
UNREACHABLE();
} }
VkBlendOp VulkanBlendOperation(wgpu::BlendOperation operation) { VkBlendOp VulkanBlendOperation(wgpu::BlendOperation operation) {
@ -196,6 +202,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::BlendOperation::Max: case wgpu::BlendOperation::Max:
return VK_BLEND_OP_MAX; return VK_BLEND_OP_MAX;
} }
UNREACHABLE();
} }
VkColorComponentFlags VulkanColorWriteMask(wgpu::ColorWriteMask mask, VkColorComponentFlags VulkanColorWriteMask(wgpu::ColorWriteMask mask,
@ -267,6 +274,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::StencilOperation::DecrementWrap: case wgpu::StencilOperation::DecrementWrap:
return VK_STENCIL_OP_DECREMENT_AND_WRAP; return VK_STENCIL_OP_DECREMENT_AND_WRAP;
} }
UNREACHABLE();
} }
VkPipelineDepthStencilStateCreateInfo ComputeDepthStencilDesc( VkPipelineDepthStencilStateCreateInfo ComputeDepthStencilDesc(

View File

@ -31,6 +31,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::AddressMode::ClampToEdge: case wgpu::AddressMode::ClampToEdge:
return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
} }
UNREACHABLE();
} }
VkFilter VulkanSamplerFilter(wgpu::FilterMode filter) { VkFilter VulkanSamplerFilter(wgpu::FilterMode filter) {
@ -40,6 +41,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::FilterMode::Nearest: case wgpu::FilterMode::Nearest:
return VK_FILTER_NEAREST; return VK_FILTER_NEAREST;
} }
UNREACHABLE();
} }
VkSamplerMipmapMode VulkanMipMapMode(wgpu::FilterMode filter) { VkSamplerMipmapMode VulkanMipMapMode(wgpu::FilterMode filter) {
@ -49,6 +51,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::FilterMode::Nearest: case wgpu::FilterMode::Nearest:
return VK_SAMPLER_MIPMAP_MODE_NEAREST; return VK_SAMPLER_MIPMAP_MODE_NEAREST;
} }
UNREACHABLE();
} }
} // anonymous namespace } // anonymous namespace

View File

@ -194,6 +194,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::PresentMode::Mailbox: case wgpu::PresentMode::Mailbox:
return VK_PRESENT_MODE_MAILBOX_KHR; return VK_PRESENT_MODE_MAILBOX_KHR;
} }
UNREACHABLE();
} }
uint32_t MinImageCountForPresentMode(VkPresentModeKHR mode) { uint32_t MinImageCountForPresentMode(VkPresentModeKHR mode) {
@ -204,8 +205,9 @@ namespace dawn_native { namespace vulkan {
case VK_PRESENT_MODE_MAILBOX_KHR: case VK_PRESENT_MODE_MAILBOX_KHR:
return 3; return 3;
default: default:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
} // anonymous namespace } // anonymous namespace

View File

@ -51,8 +51,9 @@ namespace dawn_native { namespace vulkan {
case wgpu::TextureViewDimension::e1D: case wgpu::TextureViewDimension::e1D:
case wgpu::TextureViewDimension::Undefined: case wgpu::TextureViewDimension::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
// Computes which vulkan access type could be required for the given Dawn usage. // 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 // TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm: case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
// Converts the Dawn usage flags to Vulkan usage flags. Also needs the format to choose // 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; return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
case wgpu::TextureUsage::None: case wgpu::TextureUsage::None:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
VkSampleCountFlagBits VulkanSampleCount(uint32_t sampleCount) { VkSampleCountFlagBits VulkanSampleCount(uint32_t sampleCount) {
@ -518,9 +521,8 @@ namespace dawn_native { namespace vulkan {
return VK_SAMPLE_COUNT_1_BIT; return VK_SAMPLE_COUNT_1_BIT;
case 4: case 4:
return VK_SAMPLE_COUNT_4_BIT; return VK_SAMPLE_COUNT_4_BIT;
default:
UNREACHABLE();
} }
UNREACHABLE();
} }
MaybeError ValidateVulkanImageCanBeWrapped(const DeviceBase*, MaybeError ValidateVulkanImageCanBeWrapped(const DeviceBase*,
@ -853,8 +855,9 @@ namespace dawn_native { namespace vulkan {
return VulkanAspectMask(Aspect::Stencil); return VulkanAspectMask(Aspect::Stencil);
case wgpu::TextureAspect::Plane0Only: case wgpu::TextureAspect::Plane0Only:
case wgpu::TextureAspect::Plane1Only: case wgpu::TextureAspect::Plane1Only:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
void Texture::TweakTransitionForExternalUsage(CommandRecordingContext* recordingContext, void Texture::TweakTransitionForExternalUsage(CommandRecordingContext* recordingContext,

View File

@ -44,8 +44,9 @@ namespace dawn_native { namespace vulkan {
return VK_COMPARE_OP_ALWAYS; return VK_COMPARE_OP_ALWAYS;
case wgpu::CompareFunction::Undefined: case wgpu::CompareFunction::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
// Convert Dawn texture aspects to Vulkan texture aspect flags // Convert Dawn texture aspects to Vulkan texture aspect flags

View File

@ -173,8 +173,9 @@ namespace utils {
case wgpu::VertexFormat::Sint32x4: case wgpu::VertexFormat::Sint32x4:
return 16; return 16;
case wgpu::VertexFormat::Undefined: case wgpu::VertexFormat::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
} // namespace utils } // namespace utils

View File

@ -241,8 +241,9 @@ namespace utils {
// TODO(dawn:570): implement depth16unorm // TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm: case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
uint32_t GetTextureFormatBlockWidth(wgpu::TextureFormat textureFormat) { uint32_t GetTextureFormatBlockWidth(wgpu::TextureFormat textureFormat) {
@ -357,8 +358,9 @@ namespace utils {
// TODO(dawn:570): implement depth16unorm // TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm: case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
uint32_t GetTextureFormatBlockHeight(wgpu::TextureFormat textureFormat) { uint32_t GetTextureFormatBlockHeight(wgpu::TextureFormat textureFormat) {
@ -473,8 +475,9 @@ namespace utils {
// TODO(dawn:570): implement depth16unorm // TODO(dawn:570): implement depth16unorm
case wgpu::TextureFormat::Depth16Unorm: case wgpu::TextureFormat::Depth16Unorm:
case wgpu::TextureFormat::Undefined: case wgpu::TextureFormat::Undefined:
UNREACHABLE(); break;
} }
UNREACHABLE();
} }
const char* GetWGSLColorTextureComponentType(wgpu::TextureFormat textureFormat) { const char* GetWGSLColorTextureComponentType(wgpu::TextureFormat textureFormat) {