Prevent bool fields in custom struct types in shaders

These are not allowed due to alignment reasons
このコミットが含まれているのは:
Sergio Pedri committed 2022-08-27 16:50:22 +02:00
1 親 f68d56fcec
コミット 1e3611a060
4ファイル変更
+44 -4

検索条件に一致するファイルはありません

+8
ファイルの表示
@@ -218,6 +218,14 @@ internal static partial class HlslKnownTypes
// Local function to recursively gather nested types
static void ExploreTypes(INamedTypeSymbol type, HashSet<INamedTypeSymbol> customTypes, HashSet<INamedTypeSymbol> invalidTypes)
{
// Explicitly prevent bool from being a field in a custom struct
if (type.SpecialType == SpecialType.System_Boolean)
{
invalidTypes.Add(type);
return;
}
if (KnownHlslTypes.ContainsKey(type.GetFullMetadataName())) return;
// Check if the type is unsupported