From 8fca4a21b7bc22323c4987dbe484d56b8757e71e Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Mon, 10 Jul 2017 21:48:12 -0400 Subject: [PATCH] Use UNREACHABLE in more places --- src/backend/CommandBufferStateTracker.cpp | 2 +- src/backend/ShaderModule.cpp | 3 +-- src/backend/d3d12/PipelineD3D12.cpp | 2 +- src/backend/d3d12/ResourceAllocator.cpp | 2 +- src/backend/metal/PipelineMTL.mm | 3 +-- src/backend/opengl/OpenGLBackend.cpp | 3 +-- src/tests/NXTTest.cpp | 6 ++---- 7 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/backend/CommandBufferStateTracker.cpp b/src/backend/CommandBufferStateTracker.cpp index 9f1e10a64c..d2de413b75 100644 --- a/src/backend/CommandBufferStateTracker.cpp +++ b/src/backend/CommandBufferStateTracker.cpp @@ -477,7 +477,7 @@ namespace backend { case nxt::BindingType::UniformBuffer: case nxt::BindingType::StorageBuffer: { - nxt::BufferUsageBit requiredUsage; + nxt::BufferUsageBit requiredUsage = nxt::BufferUsageBit::None; switch (type) { case nxt::BindingType::UniformBuffer: requiredUsage = nxt::BufferUsageBit::Uniform; diff --git a/src/backend/ShaderModule.cpp b/src/backend/ShaderModule.cpp index a119931a1c..eb8fda152f 100644 --- a/src/backend/ShaderModule.cpp +++ b/src/backend/ShaderModule.cpp @@ -43,8 +43,7 @@ namespace backend { executionModel = nxt::ShaderStage::Compute; break; default: - ASSERT(false); - break; + UNREACHABLE(); } // Extract push constants diff --git a/src/backend/d3d12/PipelineD3D12.cpp b/src/backend/d3d12/PipelineD3D12.cpp index 5a07fb2a4a..35242d0073 100644 --- a/src/backend/d3d12/PipelineD3D12.cpp +++ b/src/backend/d3d12/PipelineD3D12.cpp @@ -92,7 +92,7 @@ namespace d3d12 { compileTarget = "ps_5_1"; break; case nxt::ShaderStage::Compute: - ASSERT(false); + UNREACHABLE(); break; } diff --git a/src/backend/d3d12/ResourceAllocator.cpp b/src/backend/d3d12/ResourceAllocator.cpp index f7f5e5f23d..cbad3996ac 100644 --- a/src/backend/d3d12/ResourceAllocator.cpp +++ b/src/backend/d3d12/ResourceAllocator.cpp @@ -61,7 +61,7 @@ namespace d3d12 { heapProperties = &kReadbackHeapProperties; break; default: - ASSERT(false); + UNREACHABLE(); } ComPtr resource; diff --git a/src/backend/metal/PipelineMTL.mm b/src/backend/metal/PipelineMTL.mm index 6f77a4b0bb..5eb025ab5b 100644 --- a/src/backend/metal/PipelineMTL.mm +++ b/src/backend/metal/PipelineMTL.mm @@ -63,8 +63,7 @@ namespace metal { descriptor.fragmentFunction = function; break; case nxt::ShaderStage::Compute: - ASSERT(false); - break; + UNREACHABLE(); } } diff --git a/src/backend/opengl/OpenGLBackend.cpp b/src/backend/opengl/OpenGLBackend.cpp index c9a3715efb..687b9c3c92 100644 --- a/src/backend/opengl/OpenGLBackend.cpp +++ b/src/backend/opengl/OpenGLBackend.cpp @@ -174,8 +174,7 @@ namespace opengl { glVertexAttribDivisor(location, 1); break; default: - ASSERT(false); - break; + UNREACHABLE(); } } } diff --git a/src/tests/NXTTest.cpp b/src/tests/NXTTest.cpp index 8b43d4b55b..05935a9699 100644 --- a/src/tests/NXTTest.cpp +++ b/src/tests/NXTTest.cpp @@ -32,8 +32,7 @@ namespace { case VulkanBackend: return utils::BackendType::Vulkan; default: - NXT_ASSERT(false); - return utils::BackendType::Null; + UNREACHABLE(); } } @@ -48,8 +47,7 @@ namespace { case VulkanBackend: return "Vulkan"; default: - NXT_ASSERT(false); - return ""; + UNREACHABLE(); } }