Enabled support for 3D textures in shader generator

このコミットが含まれているのは:
Sergio Pedri committed 2020-12-06 00:24:26 +01:00
1 親 f2e93a6c88
コミット 05757e4c12
2ファイル変更
+19 -9

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

@@ -63,7 +63,7 @@ namespace ComputeSharp.Shaders.Mappings
type.GetGenericTypeDefinition() == typeof(ConstantBuffer<>);
/// <summary>
/// Checks whether or not the input type is a <see cref="ReadOnlyBuffer{T}"/> or <see cref="ReadOnlyTexture2D{T}"/> value.
/// Checks whether or not the input type is a known readonly resource type (buffer or texture).
/// </summary>
/// <param name="type">The input <see cref="Type"/> instance to check.</param>
/// <returns>A <see langword="bool"/> indicating whether the input <see cref="Type"/> is a readonly resource type.</returns>
@@ -76,11 +76,12 @@ namespace ComputeSharp.Shaders.Mappings
return
genericType == typeof(ReadOnlyBuffer<>) ||
genericType == typeof(ReadOnlyTexture2D<>);
genericType == typeof(ReadOnlyTexture2D<>) ||
genericType == typeof(ReadOnlyTexture3D<>);
}
/// <summary>
/// Checks whether or not the input type is a <see cref="ReadWriteBuffer{T}"/> or <see cref="ReadWriteTexture2D{T}"/> value.
/// Checks whether or not the input type is a known writeable resource type (buffer or texture).
/// </summary>
/// <param name="type">The input <see cref="Type"/> instance to check.</param>
/// <returns>A <see langword="bool"/> indicating whether the input <see cref="Type"/> is a writeable resource type.</returns>
@@ -93,7 +94,8 @@ namespace ComputeSharp.Shaders.Mappings
return
genericType == typeof(ReadWriteBuffer<>) ||
genericType == typeof(ReadWriteTexture2D<>);
genericType == typeof(ReadWriteTexture2D<>) ||
genericType == typeof(ReadWriteTexture3D<>);
}
}
}
+13 -5
ファイルの表示
@@ -63,11 +63,17 @@ namespace ComputeSharp.SourceGenerators.Mappings
/// <returns>Whether or not <paramref name="typeName"/> represents a typed resource type.</returns>
public static bool IsTypedResourceType(string typeName)
{
return
typeName == "ComputeSharp.ReadOnlyBuffer`1" ||
typeName == "ComputeSharp.ReadWriteBuffer`1" ||
typeName == "ComputeSharp.ReadOnlyTexture2D`1" ||
typeName == "ComputeSharp.ReadWriteTexture2D`1";
switch (typeName)
{
case "ComputeSharp.ReadOnlyBuffer`1":
case "ComputeSharp.ReadWriteBuffer`1":
case "ComputeSharp.ReadOnlyTexture2D`1":
case "ComputeSharp.ReadWriteTexture2D`1":
case "ComputeSharp.ReadOnlyTexture3D`1":
case "ComputeSharp.ReadWriteTexture3D`1":
return true;
default: return false;
};
}
/// <summary>
@@ -102,6 +108,8 @@ namespace ComputeSharp.SourceGenerators.Mappings
"ComputeSharp.ReadWriteBuffer`1" => $"RWStructuredBuffer<{mapped}>",
"ComputeSharp.ReadOnlyTexture2D`1" => $"Texture2D<{mapped}>",
"ComputeSharp.ReadWriteTexture2D`1" => $"RWTexture2D<{mapped}>",
"ComputeSharp.ReadOnlyTexture3D`1" => $"Texture3D<{mapped}>",
"ComputeSharp.ReadWriteTexture3D`1" => $"RWTexture3D<{mapped}>",
_ => throw new ArgumentException()
};
}