Fix handling of Bool/bool types in shader rewriter

このコミットが含まれているのは:
Sergio Pedri committed 2022-08-27 23:04:12 +02:00
1 親 4db6360924
コミット 581eb40ed1
1ファイル変更
+10
+10
ファイルの表示
@@ -67,6 +67,7 @@ internal static partial class HlslKnownTypes
Dictionary<string, string> knownTypes = new()
{
[typeof(bool).FullName] = "bool",
[typeof(Bool).FullName] = "bool",
[typeof(int).FullName] = "int",
[typeof(uint).FullName] = "uint",
[typeof(float).FullName] = "float",
@@ -256,6 +257,15 @@ internal static partial class HlslKnownTypes
// Explore all input types and their nested types
foreach (INamedTypeSymbol type in discoveredTypes)
{
// Special case for bool types. These types are blocked if they appear as fields in custom struct types,
// but are otherwise allowed. For instance, it is fine to use them in captured values for a shader (as
// the dispatch data loader will perform the correct marshalling) as well as in locals/parameters. This
// branch prevents crawling a processed type if it's just bool at the top level (ie. not a custom struct).
if (type.SpecialType == SpecialType.System_Boolean)
{
continue;
}
ExploreTypes(type, customTypes, invalidTypes2);
}