Standardize the use of UNREACHABLE in switches.
A lot of our switches over enum values use the following pattern: default: UNREACHABLE(); return foo; This is problematic because when adding a new value to one of the WebGPU enums, there is no compilation error for switches that are missing it. Currently we're supposed to write code and tests and fix UNREACHABLEs when we see them. Instead we should strive to have most switches on enums to be complete and explicitily tag unreachable values as UNREACHABLE. Some switches might still want to use default: UNREACHABLE() if only a couple values need to be handled out of very many. In this CL we go through all the UNRAECHABLEs and change them if need be. Also an ErrorQueue class is added to avoid having QueueBase::SubmitImpl just be UNREACHABLE (and force overriding instead). Bug: dawn:527 Change-Id: I33dfb4703104912cc5f001f9faf907a61324de68 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28501 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
parent
a46737c0aa
commit
eec9edfd57
src
dawn_native
BindGroup.cppBuffer.cppCommandBuffer.cppCommandEncoder.cppDawnNative.cppErrorScope.cppFormat.cppQueue.cppQueue.hRenderPipeline.cppSpirvUtils.cppTexture.cpp
d3d12
CommandBufferD3D12.cppQuerySetD3D12.cppRenderPassBuilderD3D12.cppRenderPipelineD3D12.cppResourceAllocatorManagerD3D12.cppSamplerD3D12.cppTextureD3D12.cppUtilsD3D12.cpp
metal
opengl
CommandBufferGL.cppCommandBufferGL.hPipelineGL.cppRenderPipelineGL.cppSamplerGL.cppTextureGL.cppUtilsGL.cpp
vulkan
utils
|
@ -159,6 +159,7 @@ namespace dawn_native {
|
|||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
@ -57,17 +57,14 @@ namespace dawn_native {
|
|||
private:
|
||||
bool IsCPUWritableAtCreation() const override {
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
|
||||
MaybeError MapAtCreationImpl() override {
|
||||
UNREACHABLE();
|
||||
return {};
|
||||
}
|
||||
|
||||
MaybeError MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) override {
|
||||
UNREACHABLE();
|
||||
return {};
|
||||
}
|
||||
void* GetMappedPointerImpl() override {
|
||||
return mFakeMappedData.get();
|
||||
|
@ -212,8 +209,6 @@ namespace dawn_native {
|
|||
return DAWN_VALIDATION_ERROR("Buffer used in a submit while mapped");
|
||||
case BufferState::Unmapped:
|
||||
return {};
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -480,9 +475,6 @@ namespace dawn_native {
|
|||
case BufferState::Unmapped:
|
||||
case BufferState::Destroyed:
|
||||
return false;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -503,8 +495,6 @@ namespace dawn_native {
|
|||
return {};
|
||||
case BufferState::Destroyed:
|
||||
return DAWN_VALIDATION_ERROR("Buffer is destroyed");
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,10 +121,6 @@ namespace dawn_native {
|
|||
case wgpu::StoreOp::Clear:
|
||||
view->GetTexture()->SetIsSubresourceContentInitialized(false, range);
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,8 +127,6 @@ namespace dawn_native {
|
|||
case wgpu::TextureAspect::StencilOnly:
|
||||
ASSERT(format.aspects & Aspect::Stencil);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
if (depthSelected) {
|
||||
|
@ -141,9 +139,9 @@ namespace dawn_native {
|
|||
break;
|
||||
case wgpu::TextureFormat::Depth32Float:
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,9 @@ namespace dawn_native {
|
|||
return BackendType::OpenGL;
|
||||
case wgpu::BackendType::Vulkan:
|
||||
return BackendType::Vulkan;
|
||||
default:
|
||||
|
||||
case wgpu::BackendType::D3D11:
|
||||
case wgpu::BackendType::OpenGLES:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +82,6 @@ namespace dawn_native {
|
|||
return DeviceType::CPU;
|
||||
case wgpu::AdapterType::Unknown:
|
||||
return DeviceType::Unknown;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,6 @@ namespace dawn_native {
|
|||
break;
|
||||
|
||||
case wgpu::ErrorType::NoError:
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ namespace dawn_native {
|
|||
case wgpu::TextureComponentType::Sint:
|
||||
case wgpu::TextureComponentType::Uint:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
// Check that Type correctly mirrors TextureComponentType except for "Other".
|
||||
static_assert(static_cast<Type>(wgpu::TextureComponentType::Float) == Type::Float, "");
|
||||
|
@ -49,7 +47,8 @@ namespace dawn_native {
|
|||
case Type::Sint:
|
||||
case Type::Uint:
|
||||
break;
|
||||
default:
|
||||
|
||||
case Type::Other:
|
||||
UNREACHABLE();
|
||||
}
|
||||
// Check that Type correctly mirrors TextureComponentType except for "Other".
|
||||
|
@ -105,10 +104,6 @@ namespace dawn_native {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,9 +131,9 @@ namespace dawn_native {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
case Aspect::None:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,21 @@ namespace dawn_native {
|
|||
|
||||
return uploadHandle;
|
||||
}
|
||||
|
||||
class ErrorQueue : public QueueBase {
|
||||
public:
|
||||
ErrorQueue(DeviceBase* device) : QueueBase(device, ObjectBase::kError) {
|
||||
}
|
||||
|
||||
private:
|
||||
MaybeError SubmitImpl(uint32_t commandCount,
|
||||
CommandBufferBase* const* commands) override {
|
||||
UNREACHABLE();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// QueueBase
|
||||
|
||||
QueueBase::QueueBase(DeviceBase* device) : ObjectBase(device) {
|
||||
|
@ -130,12 +144,7 @@ namespace dawn_native {
|
|||
|
||||
// static
|
||||
QueueBase* QueueBase::MakeError(DeviceBase* device) {
|
||||
return new QueueBase(device, ObjectBase::kError);
|
||||
}
|
||||
|
||||
MaybeError QueueBase::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
||||
UNREACHABLE();
|
||||
return {};
|
||||
return new ErrorQueue(device);
|
||||
}
|
||||
|
||||
void QueueBase::Submit(uint32_t commandCount, CommandBufferBase* const* commands) {
|
||||
|
|
|
@ -25,8 +25,6 @@ namespace dawn_native {
|
|||
|
||||
class QueueBase : public ObjectBase {
|
||||
public:
|
||||
QueueBase(DeviceBase* device);
|
||||
|
||||
static QueueBase* MakeError(DeviceBase* device);
|
||||
|
||||
// Dawn API
|
||||
|
@ -40,9 +38,11 @@ namespace dawn_native {
|
|||
const TextureDataLayout* dataLayout,
|
||||
const Extent3D* writeSize);
|
||||
|
||||
private:
|
||||
protected:
|
||||
QueueBase(DeviceBase* device);
|
||||
QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag);
|
||||
|
||||
private:
|
||||
MaybeError WriteBufferInternal(BufferBase* buffer,
|
||||
uint64_t bufferOffset,
|
||||
const void* data,
|
||||
|
@ -53,7 +53,8 @@ namespace dawn_native {
|
|||
const TextureDataLayout* dataLayout,
|
||||
const Extent3D* writeSize);
|
||||
|
||||
virtual MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands);
|
||||
virtual MaybeError SubmitImpl(uint32_t commandCount,
|
||||
CommandBufferBase* const* commands) = 0;
|
||||
virtual MaybeError WriteBufferImpl(BufferBase* buffer,
|
||||
uint64_t bufferOffset,
|
||||
const void* data,
|
||||
|
|
|
@ -205,7 +205,7 @@ namespace dawn_native {
|
|||
return sizeof(uint16_t);
|
||||
case wgpu::IndexFormat::Uint32:
|
||||
return sizeof(uint32_t);
|
||||
default:
|
||||
case wgpu::IndexFormat::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -246,8 +246,6 @@ namespace dawn_native {
|
|||
case wgpu::VertexFormat::UInt:
|
||||
case wgpu::VertexFormat::Int:
|
||||
return 1;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,8 +285,6 @@ namespace dawn_native {
|
|||
case wgpu::VertexFormat::Int3:
|
||||
case wgpu::VertexFormat::Int4:
|
||||
return sizeof(int32_t);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@ namespace dawn_native {
|
|||
return spv::ExecutionModelFragment;
|
||||
case SingleShaderStage::Compute:
|
||||
return spv::ExecutionModelGLCompute;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +60,6 @@ namespace dawn_native {
|
|||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return wgpu::TextureViewDimension::Undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +144,6 @@ namespace dawn_native {
|
|||
return Format::Type::Uint;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return Format::Type::Other;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,11 @@ namespace dawn_native {
|
|||
case wgpu::TextureViewDimension::Cube:
|
||||
case wgpu::TextureViewDimension::CubeArray:
|
||||
return textureDimension == wgpu::TextureDimension::e2D;
|
||||
default:
|
||||
|
||||
case wgpu::TextureViewDimension::e1D:
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
case wgpu::TextureViewDimension::Undefined:
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,9 +68,11 @@ namespace dawn_native {
|
|||
return textureViewArrayLayer == 6u;
|
||||
case wgpu::TextureViewDimension::CubeArray:
|
||||
return textureViewArrayLayer % 6 == 0;
|
||||
default:
|
||||
|
||||
case wgpu::TextureViewDimension::e1D:
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
case wgpu::TextureViewDimension::Undefined:
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,9 +86,11 @@ namespace dawn_native {
|
|||
case wgpu::TextureViewDimension::e2D:
|
||||
case wgpu::TextureViewDimension::e2DArray:
|
||||
return true;
|
||||
default:
|
||||
|
||||
case wgpu::TextureViewDimension::e1D:
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
case wgpu::TextureViewDimension::Undefined:
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,9 +322,6 @@ namespace dawn_native {
|
|||
case wgpu::TextureDimension::e3D:
|
||||
desc.dimension = wgpu::TextureViewDimension::e3D;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,9 +364,6 @@ namespace dawn_native {
|
|||
case wgpu::TextureAspect::StencilOnly:
|
||||
ASSERT(format.aspects & Aspect::Stencil);
|
||||
return Aspect::Stencil;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return DXGI_FORMAT_R16_UINT;
|
||||
case wgpu::IndexFormat::Uint32:
|
||||
return DXGI_FORMAT_R32_UINT;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,8 +65,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_QUERY_TYPE_PIPELINE_STATISTICS;
|
||||
case wgpu::QueryType::Timestamp:
|
||||
return D3D12_QUERY_TYPE_TIMESTAMP;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,7 +385,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
case wgpu::BindingType::ReadonlyStorageTexture:
|
||||
case wgpu::BindingType::WriteonlyStorageTexture:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -954,10 +949,9 @@ namespace dawn_native { namespace d3d12 {
|
|||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1072,10 +1066,8 @@ namespace dawn_native { namespace d3d12 {
|
|||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS;
|
||||
case wgpu::QueryType::Timestamp:
|
||||
return D3D12_QUERY_HEAP_TYPE_TIMESTAMP;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
|
|
@ -30,8 +30,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR;
|
||||
case wgpu::LoadOp::Load:
|
||||
return D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,8 +39,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_DISCARD;
|
||||
case wgpu::StoreOp::Store:
|
||||
return D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,8 +91,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return DXGI_FORMAT_R32G32B32_SINT;
|
||||
case wgpu::VertexFormat::Int4:
|
||||
return DXGI_FORMAT_R32G32B32A32_SINT;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,8 +100,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA;
|
||||
case wgpu::InputStepMode::Instance:
|
||||
return D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,8 +115,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case wgpu::PrimitiveTopology::TriangleStrip:
|
||||
return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,8 +129,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
case wgpu::PrimitiveTopology::TriangleList:
|
||||
case wgpu::PrimitiveTopology::TriangleStrip:
|
||||
return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,8 +140,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_CULL_MODE_FRONT;
|
||||
case wgpu::CullMode::Back:
|
||||
return D3D12_CULL_MODE_BACK;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,8 +171,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_BLEND_BLEND_FACTOR;
|
||||
case wgpu::BlendFactor::OneMinusBlendColor:
|
||||
return D3D12_BLEND_INV_BLEND_FACTOR;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,8 +186,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_BLEND_OP_MIN;
|
||||
case wgpu::BlendOperation::Max:
|
||||
return D3D12_BLEND_OP_MAX;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,8 +238,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_STENCIL_OP_INCR;
|
||||
case wgpu::StencilOperation::DecrementWrap:
|
||||
return D3D12_STENCIL_OP_DECR;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
case Upload_OnlyBuffers:
|
||||
case Upload_AllBuffersAndTextures:
|
||||
return D3D12_HEAP_TYPE_UPLOAD;
|
||||
default:
|
||||
case EnumCount:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES;
|
||||
case Default_OnlyRenderableOrDepthTextures:
|
||||
return D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES;
|
||||
default:
|
||||
case EnumCount:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_TEXTURE_ADDRESS_MODE_MIRROR;
|
||||
case wgpu::AddressMode::ClampToEdge:
|
||||
return D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
@ -44,9 +42,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
case wgpu::FilterMode::Linear:
|
||||
minFilter = D3D12_FILTER_TYPE_LINEAR;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
D3D12_FILTER_TYPE magFilter;
|
||||
|
@ -57,9 +52,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
case wgpu::FilterMode::Linear:
|
||||
magFilter = D3D12_FILTER_TYPE_LINEAR;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
D3D12_FILTER_TYPE mipmapFilter;
|
||||
|
@ -70,9 +62,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
case wgpu::FilterMode::Linear:
|
||||
mipmapFilter = D3D12_FILTER_TYPE_LINEAR;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
D3D12_FILTER_REDUCTION_TYPE reduction =
|
||||
|
|
|
@ -96,7 +96,9 @@ namespace dawn_native { namespace d3d12 {
|
|||
switch (dimension) {
|
||||
case wgpu::TextureDimension::e2D:
|
||||
return D3D12_RESOURCE_DIMENSION_TEXTURE2D;
|
||||
default:
|
||||
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +201,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
case wgpu::TextureFormat::BC7RGBAUnormSrgb:
|
||||
return DXGI_FORMAT_BC7_TYPELESS;
|
||||
|
||||
default:
|
||||
case wgpu::TextureFormat::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +323,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
case wgpu::TextureFormat::BC7RGBAUnormSrgb:
|
||||
return DXGI_FORMAT_BC7_UNORM_SRGB;
|
||||
|
||||
default:
|
||||
case wgpu::TextureFormat::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -552,7 +554,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
return DXGI_FORMAT_R8_UINT;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return GetD3D12Format();
|
||||
}
|
||||
default:
|
||||
ASSERT(HasOneBit(GetFormat().aspects));
|
||||
|
@ -888,7 +889,6 @@ namespace dawn_native { namespace d3d12 {
|
|||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1050,6 +1050,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
ASSERT(texture->GetDimension() == wgpu::TextureDimension::e2D);
|
||||
mSrvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DMS;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -1077,7 +1078,10 @@ namespace dawn_native { namespace d3d12 {
|
|||
mSrvDesc.TextureCubeArray.MipLevels = descriptor->mipLevelCount;
|
||||
mSrvDesc.TextureCubeArray.ResourceMinLODClamp = 0;
|
||||
break;
|
||||
default:
|
||||
|
||||
case wgpu::TextureViewDimension::e1D:
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
case wgpu::TextureViewDimension::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ namespace dawn_native { namespace d3d12 {
|
|||
return D3D12_COMPARISON_FUNC_NOT_EQUAL;
|
||||
case wgpu::CompareFunction::Always:
|
||||
return D3D12_COMPARISON_FUNC_ALWAYS;
|
||||
default:
|
||||
|
||||
case wgpu::CompareFunction::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace dawn_native { namespace metal {
|
|||
return MTLIndexTypeUInt16;
|
||||
case wgpu::IndexFormat::Uint32:
|
||||
return MTLIndexTypeUInt32;
|
||||
default:
|
||||
case wgpu::IndexFormat::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -74,10 +74,6 @@ namespace dawn_native { namespace metal {
|
|||
case wgpu::LoadOp::Load:
|
||||
descriptor.colorAttachments[i].loadAction = MTLLoadActionLoad;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
descriptor.colorAttachments[i].texture =
|
||||
|
@ -107,10 +103,6 @@ namespace dawn_native { namespace metal {
|
|||
case wgpu::StoreOp::Clear:
|
||||
descriptor.colorAttachments[i].storeAction = MTLStoreActionDontCare;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,10 +126,6 @@ namespace dawn_native { namespace metal {
|
|||
case wgpu::StoreOp::Clear:
|
||||
descriptor.depthAttachment.storeAction = MTLStoreActionDontCare;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (attachmentInfo.depthLoadOp) {
|
||||
|
@ -149,10 +137,6 @@ namespace dawn_native { namespace metal {
|
|||
case wgpu::LoadOp::Load:
|
||||
descriptor.depthAttachment.loadAction = MTLLoadActionLoad;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,10 +153,6 @@ namespace dawn_native { namespace metal {
|
|||
case wgpu::StoreOp::Clear:
|
||||
descriptor.stencilAttachment.storeAction = MTLStoreActionDontCare;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (attachmentInfo.stencilLoadOp) {
|
||||
|
@ -184,10 +164,6 @@ namespace dawn_native { namespace metal {
|
|||
case wgpu::LoadOp::Load:
|
||||
descriptor.stencilAttachment.loadAction = MTLLoadActionLoad;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -797,10 +773,8 @@ namespace dawn_native { namespace metal {
|
|||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,9 +63,11 @@ namespace dawn_native { namespace metal {
|
|||
return MTLTextureTypeCube;
|
||||
case wgpu::TextureViewDimension::CubeArray:
|
||||
return MTLTextureTypeCubeArray;
|
||||
default:
|
||||
|
||||
case wgpu::TextureViewDimension::e1D:
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
case wgpu::TextureViewDimension::Undefined:
|
||||
UNREACHABLE();
|
||||
return MTLTextureType2D;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,7 +318,8 @@ namespace dawn_native { namespace metal {
|
|||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
@ -430,7 +433,6 @@ namespace dawn_native { namespace metal {
|
|||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ namespace dawn_native { namespace metal {
|
|||
return MTLCompareFunctionEqual;
|
||||
case wgpu::CompareFunction::Always:
|
||||
return MTLCompareFunctionAlways;
|
||||
default:
|
||||
|
||||
case wgpu::CompareFunction::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_UNSIGNED_SHORT;
|
||||
case wgpu::IndexFormat::Uint32:
|
||||
return GL_UNSIGNED_INT;
|
||||
default:
|
||||
case wgpu::IndexFormat::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -87,8 +87,6 @@ namespace dawn_native { namespace opengl {
|
|||
case wgpu::VertexFormat::Int3:
|
||||
case wgpu::VertexFormat::Int4:
|
||||
return GL_INT;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,9 +326,9 @@ namespace dawn_native { namespace opengl {
|
|||
case wgpu::BindingType::WriteonlyStorageTexture:
|
||||
access = GL_WRITE_ONLY;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
// OpenGL ES only supports either binding a layer or the entire texture
|
||||
|
@ -466,7 +464,7 @@ namespace dawn_native { namespace opengl {
|
|||
case Command::BeginComputePass: {
|
||||
mCommands.NextCommand<BeginComputePassCmd>();
|
||||
TransitionForPass(passResourceUsages[nextPassNumber]);
|
||||
ExecuteComputePass();
|
||||
DAWN_TRY(ExecuteComputePass());
|
||||
|
||||
nextPassNumber++;
|
||||
break;
|
||||
|
@ -477,7 +475,7 @@ namespace dawn_native { namespace opengl {
|
|||
TransitionForPass(passResourceUsages[nextPassNumber]);
|
||||
|
||||
LazyClearRenderPassAttachments(cmd);
|
||||
ExecuteRenderPass(cmd);
|
||||
DAWN_TRY(ExecuteRenderPass(cmd));
|
||||
|
||||
nextPassNumber++;
|
||||
break;
|
||||
|
@ -581,7 +579,8 @@ namespace dawn_native { namespace opengl {
|
|||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -649,9 +648,9 @@ namespace dawn_native { namespace opengl {
|
|||
glFormat = GL_STENCIL_INDEX;
|
||||
glType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
default:
|
||||
|
||||
case Aspect::None:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t* offset =
|
||||
|
@ -680,7 +679,8 @@ namespace dawn_native { namespace opengl {
|
|||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
@ -730,9 +730,7 @@ namespace dawn_native { namespace opengl {
|
|||
}
|
||||
|
||||
case Command::WriteTimestamp: {
|
||||
// WriteTimestamp is not supported on OpenGL
|
||||
UNREACHABLE();
|
||||
break;
|
||||
return DAWN_UNIMPLEMENTED_ERROR("WriteTimestamp unimplemented");
|
||||
}
|
||||
|
||||
case Command::InsertDebugMarker:
|
||||
|
@ -744,17 +742,15 @@ namespace dawn_native { namespace opengl {
|
|||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void CommandBuffer::ExecuteComputePass() {
|
||||
MaybeError CommandBuffer::ExecuteComputePass() {
|
||||
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
|
||||
ComputePipeline* lastPipeline = nullptr;
|
||||
BindGroupTracker bindGroupTracker = {};
|
||||
|
@ -764,7 +760,7 @@ namespace dawn_native { namespace opengl {
|
|||
switch (type) {
|
||||
case Command::EndComputePass: {
|
||||
mCommands.NextCommand<EndComputePassCmd>();
|
||||
return;
|
||||
return {};
|
||||
}
|
||||
|
||||
case Command::Dispatch: {
|
||||
|
@ -821,15 +817,11 @@ namespace dawn_native { namespace opengl {
|
|||
}
|
||||
|
||||
case Command::WriteTimestamp: {
|
||||
// WriteTimestamp is not supported on OpenGL
|
||||
UNREACHABLE();
|
||||
break;
|
||||
return DAWN_UNIMPLEMENTED_ERROR("WriteTimestamp unimplemented");
|
||||
}
|
||||
|
||||
default: {
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -837,7 +829,7 @@ namespace dawn_native { namespace opengl {
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void CommandBuffer::ExecuteRenderPass(BeginRenderPassCmd* renderPass) {
|
||||
MaybeError CommandBuffer::ExecuteRenderPass(BeginRenderPassCmd* renderPass) {
|
||||
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
|
||||
GLuint fbo = 0;
|
||||
|
||||
|
@ -1159,7 +1151,7 @@ namespace dawn_native { namespace opengl {
|
|||
ResolveMultisampledRenderTargets(gl, renderPass);
|
||||
}
|
||||
gl.DeleteFramebuffers(1, &fbo);
|
||||
return;
|
||||
return {};
|
||||
}
|
||||
|
||||
case Command::SetStencilReference: {
|
||||
|
@ -1202,11 +1194,8 @@ namespace dawn_native { namespace opengl {
|
|||
break;
|
||||
}
|
||||
|
||||
case Command::WriteTimestamp: {
|
||||
// WriteTimestamp is not supported on OpenGL
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
case Command::WriteTimestamp:
|
||||
return DAWN_UNIMPLEMENTED_ERROR("WriteTimestamp unimplemented");
|
||||
|
||||
default: {
|
||||
DoRenderBundleCommand(&mCommands, type);
|
||||
|
|
|
@ -32,8 +32,8 @@ namespace dawn_native { namespace opengl {
|
|||
MaybeError Execute();
|
||||
|
||||
private:
|
||||
void ExecuteComputePass();
|
||||
void ExecuteRenderPass(BeginRenderPassCmd* renderPass);
|
||||
MaybeError ExecuteComputePass();
|
||||
MaybeError ExecuteRenderPass(BeginRenderPassCmd* renderPass);
|
||||
};
|
||||
|
||||
}} // namespace dawn_native::opengl
|
||||
|
|
|
@ -37,8 +37,6 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_FRAGMENT_SHADER;
|
||||
case SingleShaderStage::Compute:
|
||||
return GL_COMPUTE_SHADER;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,6 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_TRIANGLES;
|
||||
case wgpu::PrimitiveTopology::TriangleStrip:
|
||||
return GL_TRIANGLE_STRIP;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,8 +84,6 @@ namespace dawn_native { namespace opengl {
|
|||
return alpha ? GL_CONSTANT_ALPHA : GL_CONSTANT_COLOR;
|
||||
case wgpu::BlendFactor::OneMinusBlendColor:
|
||||
return alpha ? GL_ONE_MINUS_CONSTANT_ALPHA : GL_ONE_MINUS_CONSTANT_COLOR;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,8 +99,6 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_MIN;
|
||||
case wgpu::BlendOperation::Max:
|
||||
return GL_MAX;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,8 +143,6 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_INCR_WRAP;
|
||||
case wgpu::StencilOperation::DecrementWrap:
|
||||
return GL_DECR_WRAP;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,8 +241,6 @@ namespace dawn_native { namespace opengl {
|
|||
case wgpu::InputStepMode::Instance:
|
||||
gl.VertexAttribDivisor(glAttrib, 1);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_NEAREST;
|
||||
case wgpu::FilterMode::Linear:
|
||||
return GL_LINEAR;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,8 +38,6 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_NEAREST_MIPMAP_NEAREST;
|
||||
case wgpu::FilterMode::Linear:
|
||||
return GL_NEAREST_MIPMAP_LINEAR;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
case wgpu::FilterMode::Linear:
|
||||
switch (mipMapFilter) {
|
||||
|
@ -49,11 +45,7 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_LINEAR_MIPMAP_NEAREST;
|
||||
case wgpu::FilterMode::Linear:
|
||||
return GL_LINEAR_MIPMAP_LINEAR;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,8 +57,6 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_MIRRORED_REPEAT;
|
||||
case wgpu::AddressMode::ClampToEdge:
|
||||
return GL_CLAMP_TO_EDGE;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ namespace dawn_native { namespace opengl {
|
|||
}
|
||||
}
|
||||
|
||||
default:
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
return GL_TEXTURE_2D;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,9 +62,11 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_TEXTURE_CUBE_MAP;
|
||||
case wgpu::TextureViewDimension::CubeArray:
|
||||
return GL_TEXTURE_CUBE_MAP_ARRAY;
|
||||
default:
|
||||
|
||||
case wgpu::TextureViewDimension::e1D:
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
case wgpu::TextureViewDimension::Undefined:
|
||||
UNREACHABLE();
|
||||
return GL_TEXTURE_2D;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +143,9 @@ namespace dawn_native { namespace opengl {
|
|||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
@ -279,7 +283,8 @@ namespace dawn_native { namespace opengl {
|
|||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +391,8 @@ namespace dawn_native { namespace opengl {
|
|||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_EQUAL;
|
||||
case wgpu::CompareFunction::Always:
|
||||
return GL_ALWAYS;
|
||||
default:
|
||||
|
||||
case wgpu::CompareFunction::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +46,7 @@ namespace dawn_native { namespace opengl {
|
|||
switch (depthStencilFormat) {
|
||||
case wgpu::TextureFormat::Depth24PlusStencil8:
|
||||
return 0xFF;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_INDEX_TYPE_UINT16;
|
||||
case wgpu::IndexFormat::Uint32:
|
||||
return VK_INDEX_TYPE_UINT32;
|
||||
default:
|
||||
case wgpu::IndexFormat::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -820,10 +820,8 @@ namespace dawn_native { namespace vulkan {
|
|||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
UNREACHABLE();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -946,10 +944,8 @@ namespace dawn_native { namespace vulkan {
|
|||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace dawn_native { namespace vulkan {
|
|||
// the decision if it is not applicable.
|
||||
ApplyDepth24PlusS8Toggle();
|
||||
|
||||
return DeviceBase::Initialize(new Queue(this));
|
||||
return DeviceBase::Initialize(Queue::Create(this));
|
||||
}
|
||||
|
||||
Device::~Device() {
|
||||
|
|
|
@ -30,8 +30,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_QUERY_TYPE_PIPELINE_STATISTICS;
|
||||
case wgpu::QueryType::Timestamp:
|
||||
return VK_QUERY_TYPE_TIMESTAMP;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,9 +56,6 @@ namespace dawn_native { namespace vulkan {
|
|||
pipelineStatistics |=
|
||||
VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@ namespace dawn_native { namespace vulkan {
|
|||
return new Queue(device);
|
||||
}
|
||||
|
||||
Queue::Queue(Device* device) : QueueBase(device) {
|
||||
}
|
||||
|
||||
Queue::~Queue() {
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace dawn_native { namespace vulkan {
|
|||
static Queue* Create(Device* device);
|
||||
|
||||
private:
|
||||
Queue(Device* device);
|
||||
~Queue() override;
|
||||
using QueueBase::QueueBase;
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||
case wgpu::LoadOp::Clear:
|
||||
return VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
|
|
@ -33,8 +33,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_VERTEX_INPUT_RATE_VERTEX;
|
||||
case wgpu::InputStepMode::Instance:
|
||||
return VK_VERTEX_INPUT_RATE_INSTANCE;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,8 +98,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_FORMAT_R32G32B32_SINT;
|
||||
case wgpu::VertexFormat::Int4:
|
||||
return VK_FORMAT_R32G32B32A32_SINT;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,8 +113,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
case wgpu::PrimitiveTopology::TriangleStrip:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,8 +127,6 @@ namespace dawn_native { namespace vulkan {
|
|||
case wgpu::PrimitiveTopology::LineStrip:
|
||||
case wgpu::PrimitiveTopology::TriangleStrip:
|
||||
return true;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,8 +136,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||
case wgpu::FrontFace::CW:
|
||||
return VK_FRONT_FACE_CLOCKWISE;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,8 +147,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_CULL_MODE_FRONT_BIT;
|
||||
case wgpu::CullMode::Back:
|
||||
return VK_CULL_MODE_BACK_BIT;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,8 +178,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_BLEND_FACTOR_CONSTANT_COLOR;
|
||||
case wgpu::BlendFactor::OneMinusBlendColor:
|
||||
return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,8 +193,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_BLEND_OP_MIN;
|
||||
case wgpu::BlendOperation::Max:
|
||||
return VK_BLEND_OP_MAX;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,8 +253,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_STENCIL_OP_INCREMENT_AND_WRAP;
|
||||
case wgpu::StencilOperation::DecrementWrap:
|
||||
return VK_STENCIL_OP_DECREMENT_AND_WRAP;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT;
|
||||
case wgpu::AddressMode::ClampToEdge:
|
||||
return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,8 +39,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_FILTER_LINEAR;
|
||||
case wgpu::FilterMode::Nearest:
|
||||
return VK_FILTER_NEAREST;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,8 +48,6 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_SAMPLER_MIPMAP_MODE_LINEAR;
|
||||
case wgpu::FilterMode::Nearest:
|
||||
return VK_SAMPLER_MIPMAP_MODE_NEAREST;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
|
|
@ -45,7 +45,10 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_IMAGE_VIEW_TYPE_CUBE;
|
||||
case wgpu::TextureViewDimension::CubeArray:
|
||||
return VK_IMAGE_VIEW_TYPE_CUBE_ARRAY;
|
||||
default:
|
||||
|
||||
case wgpu::TextureViewDimension::e1D:
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
case wgpu::TextureViewDimension::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +138,8 @@ namespace dawn_native { namespace vulkan {
|
|||
}
|
||||
case kPresentTextureUsage:
|
||||
return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
||||
default:
|
||||
|
||||
case wgpu::TextureUsage::None:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -237,9 +241,9 @@ namespace dawn_native { namespace vulkan {
|
|||
info->arrayLayers = size.depth;
|
||||
break;
|
||||
|
||||
default:
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,7 +373,7 @@ namespace dawn_native { namespace vulkan {
|
|||
case wgpu::TextureFormat::BC7RGBAUnormSrgb:
|
||||
return VK_FORMAT_BC7_SRGB_BLOCK;
|
||||
|
||||
default:
|
||||
case wgpu::TextureFormat::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -714,9 +718,6 @@ namespace dawn_native { namespace vulkan {
|
|||
case wgpu::TextureAspect::StencilOnly:
|
||||
ASSERT(GetFormat().aspects & Aspect::Stencil);
|
||||
return VulkanAspectMask(Aspect::Stencil);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1057,7 +1058,8 @@ namespace dawn_native { namespace vulkan {
|
|||
clearColorValue.uint32[2] = uClearColor;
|
||||
clearColorValue.uint32[3] = uClearColor;
|
||||
break;
|
||||
default:
|
||||
|
||||
case Format::Type::Other:
|
||||
UNREACHABLE();
|
||||
}
|
||||
device->fn.CmdClearColorImage(recordingContext->commandBuffer, GetHandle(),
|
||||
|
|
|
@ -40,7 +40,8 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_COMPARE_OP_NOT_EQUAL;
|
||||
case wgpu::CompareFunction::Always:
|
||||
return VK_COMPARE_OP_ALWAYS;
|
||||
default:
|
||||
|
||||
case wgpu::CompareFunction::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -59,9 +60,8 @@ namespace dawn_native { namespace vulkan {
|
|||
case Aspect::Stencil:
|
||||
flags |= VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
break;
|
||||
default:
|
||||
case Aspect::None:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
|
@ -133,9 +133,9 @@ namespace dawn_native { namespace vulkan {
|
|||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
return region;
|
||||
|
|
|
@ -113,9 +113,8 @@ namespace dawn_native { namespace vulkan {
|
|||
hasDependencies = HasDep(InstanceExt::Surface);
|
||||
break;
|
||||
|
||||
default:
|
||||
case InstanceExt::EnumCount:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
trimmedSet.Set(ext, hasDependencies && advertisedExts.Has(ext));
|
||||
|
@ -297,9 +296,8 @@ namespace dawn_native { namespace vulkan {
|
|||
hasDependencies = icdVersion >= VulkanVersion_1_1;
|
||||
break;
|
||||
|
||||
default:
|
||||
case DeviceExt::EnumCount:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
trimmedSet.Set(ext, hasDependencies && advertisedExts.Has(ext));
|
||||
|
|
|
@ -58,9 +58,9 @@ namespace utils {
|
|||
case wgpu::TextureFormat::RGBA16Sint:
|
||||
case wgpu::TextureFormat::RGBA32Sint:
|
||||
return "i";
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,6 +83,7 @@ namespace utils {
|
|||
case wgpu::TextureFormat::RGBA32Sint:
|
||||
case wgpu::TextureFormat::RGBA32Float:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -158,9 +159,7 @@ namespace utils {
|
|||
case wgpu::TextureFormat::Depth24Plus:
|
||||
case wgpu::TextureFormat::Depth24PlusStencil8:
|
||||
case wgpu::TextureFormat::Undefined:
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0u;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,9 +223,7 @@ namespace utils {
|
|||
return 4u;
|
||||
|
||||
case wgpu::TextureFormat::Undefined:
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0u;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,9 +287,7 @@ namespace utils {
|
|||
return 4u;
|
||||
|
||||
case wgpu::TextureFormat::Undefined:
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0u;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,7 +381,6 @@ namespace utils {
|
|||
case wgpu::TextureFormat::Depth24PlusStencil8:
|
||||
case wgpu::TextureFormat::Undefined:
|
||||
UNREACHABLE();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
} // namespace utils
|
||||
|
|
Loading…
Reference in New Issue