Fix MSVC warnings on enum class switches

This commit is contained in:
Corentin Wallez
2017-07-10 20:31:47 -04:00
committed by Corentin Wallez
parent 6fb3aebf0c
commit 96acaef95e
15 changed files with 80 additions and 3 deletions

View File

@@ -27,6 +27,8 @@ namespace backend {
return sizeof(uint16_t);
case nxt::IndexFormat::Uint32:
return sizeof(uint32_t);
default:
UNREACHABLE();
}
}
@@ -40,6 +42,8 @@ namespace backend {
return 2;
case nxt::VertexFormat::FloatR32:
return 1;
default:
UNREACHABLE();
}
}
@@ -50,6 +54,8 @@ namespace backend {
case nxt::VertexFormat::FloatR32G32:
case nxt::VertexFormat::FloatR32:
return VertexFormatNumComponents(format) * sizeof(float);
default:
UNREACHABLE();
}
}

View File

@@ -23,6 +23,8 @@ namespace backend {
switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm:
return 4;
default:
UNREACHABLE();
}
}
@@ -97,6 +99,8 @@ namespace backend {
switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm:
return false;
default:
UNREACHABLE();
}
}

View File

@@ -38,6 +38,8 @@ namespace d3d12 {
return DXGI_FORMAT_R16_UINT;
case nxt::IndexFormat::Uint32:
return DXGI_FORMAT_R32_UINT;
default:
UNREACHABLE();
}
}

View File

@@ -27,6 +27,8 @@ namespace d3d12 {
return DXGI_FORMAT_R32G32_FLOAT;
case nxt::VertexFormat::FloatR32:
return DXGI_FORMAT_R32_FLOAT;
default:
UNREACHABLE();
}
}
@@ -36,6 +38,8 @@ namespace d3d12 {
return D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA;
case nxt::InputStepMode::Instance:
return D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA;
default:
UNREACHABLE();
}
}

View File

@@ -66,6 +66,8 @@ namespace d3d12 {
switch (dimension) {
case nxt::TextureDimension::e2D:
return D3D12_RESOURCE_DIMENSION_TEXTURE2D;
default:
UNREACHABLE();
}
}
@@ -73,6 +75,8 @@ namespace d3d12 {
switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm:
return DXGI_FORMAT_R8G8B8A8_UNORM;
default:
UNREACHABLE();
}
}
}

View File

@@ -41,6 +41,8 @@ namespace opengl {
return GL_UNSIGNED_SHORT;
case nxt::IndexFormat::Uint32:
return GL_UNSIGNED_INT;
default:
UNREACHABLE();
}
}
@@ -51,6 +53,8 @@ namespace opengl {
case nxt::VertexFormat::FloatR32G32:
case nxt::VertexFormat::FloatR32:
return GL_FLOAT;
default:
UNREACHABLE();
}
}

View File

@@ -16,6 +16,7 @@
#include "backend/opengl/OpenGLBackend.h"
#include "backend/opengl/PersistentPipelineStateGL.h"
#include "common/Assert.h"
namespace backend {
namespace opengl {
@@ -39,6 +40,8 @@ namespace opengl {
return GL_EQUAL;
case nxt::CompareFunction::Always:
return GL_ALWAYS;
default:
UNREACHABLE();
}
}
@@ -60,6 +63,8 @@ namespace opengl {
return GL_INCR_WRAP;
case nxt::StencilOperation::DecrementWrap:
return GL_DECR_WRAP;
default:
UNREACHABLE();
}
}
}

View File

@@ -36,6 +36,8 @@ namespace opengl {
return GL_FRAGMENT_SHADER;
case nxt::ShaderStage::Compute:
return GL_COMPUTE_SHADER;
default:
UNREACHABLE();
}
}

View File

@@ -14,6 +14,8 @@
#include "backend/opengl/SamplerGL.h"
#include "common/Assert.h"
namespace backend {
namespace opengl {
@@ -24,6 +26,8 @@ namespace opengl {
return GL_NEAREST;
case nxt::FilterMode::Linear:
return GL_LINEAR;
default:
UNREACHABLE();
}
}
@@ -35,6 +39,8 @@ namespace opengl {
return GL_NEAREST_MIPMAP_NEAREST;
case nxt::FilterMode::Linear:
return GL_NEAREST_MIPMAP_LINEAR;
default:
UNREACHABLE();
}
case nxt::FilterMode::Linear:
switch (mipMapFilter) {
@@ -42,7 +48,11 @@ namespace opengl {
return GL_LINEAR_MIPMAP_NEAREST;
case nxt::FilterMode::Linear:
return GL_LINEAR_MIPMAP_LINEAR;
default:
UNREACHABLE();
}
default:
UNREACHABLE();
}
}
}

View File

@@ -14,6 +14,8 @@
#include "backend/opengl/TextureGL.h"
#include "common/Assert.h"
#include <algorithm>
#include <vector>
@@ -26,6 +28,8 @@ namespace opengl {
switch (dimension) {
case nxt::TextureDimension::e2D:
return GL_TEXTURE_2D;
default:
UNREACHABLE();
}
}
@@ -33,6 +37,8 @@ namespace opengl {
switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm:
return {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE};
default:
UNREACHABLE();
}
}