NFC: Fix switch with missing default case in DxilShaderModel.cpp (#6288)

This missing default case statement would cause build break when
compiling with additional warning settings, such as /W4 /WX in VC++.

Fixes #6287.
This commit is contained in:
Tex Riddell 2024-02-12 17:42:59 -08:00 коммит произвёл GitHub
Родитель 30f45bcf0f
Коммит 627e400dea
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -230,6 +230,9 @@ enum class ShaderKind {
Last_1_8 = Node, Last_1_8 = Node,
LastValid = Last_1_8, LastValid = Last_1_8,
}; };
static_assert((unsigned)DXIL::ShaderKind::LastValid + 1 ==
(unsigned)DXIL::ShaderKind::Invalid,
"otherwise, enum needs updating.");
// clang-format off // clang-format off
// Python lines need to be not formatted. // Python lines need to be not formatted.

Просмотреть файл

@ -504,9 +504,23 @@ bool ShaderModel::AllowDerivatives(DXIL::ShaderKind sk) const {
case DXIL::ShaderKind::Amplification: case DXIL::ShaderKind::Amplification:
case DXIL::ShaderKind::Mesh: case DXIL::ShaderKind::Mesh:
return IsSM66Plus(); return IsSM66Plus();
} case DXIL::ShaderKind::Vertex:
case DXIL::ShaderKind::Geometry:
case DXIL::ShaderKind::Hull:
case DXIL::ShaderKind::Domain:
case DXIL::ShaderKind::RayGeneration:
case DXIL::ShaderKind::Intersection:
case DXIL::ShaderKind::AnyHit:
case DXIL::ShaderKind::ClosestHit:
case DXIL::ShaderKind::Miss:
case DXIL::ShaderKind::Callable:
case DXIL::ShaderKind::Invalid:
return false; return false;
} }
static_assert(DXIL::ShaderKind::LastValid == DXIL::ShaderKind::Node,
"otherwise, switch needs to be updated.");
llvm_unreachable("unknown ShaderKind");
}
typedef ShaderModel SM; typedef ShaderModel SM;
typedef Semantic SE; typedef Semantic SE;