Introduced IPixelShader<TPixel> interface, initial working support

このコミットが含まれているのは:
Sergio Pedri committed 2021-05-11 01:54:37 +02:00
1 親 0a0f51bd5f
コミット 49d73b675f
15ファイル変更
+285 -23

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

+20
ファイルの表示
@@ -265,6 +265,26 @@ namespace ComputeSharp.SourceGenerators.Mappings
return typeName.ToHlslIdentifierName();
}
/// <summary>
/// Gets the mapped HLSL-compatible type name for the output texture of a pixel shader.
/// </summary>
/// <param name="typeSymbol">The pixel shader type to map.</param>
/// <returns>The HLSL-compatible type name that can be used in an HLSL shader.</returns>
[Pure]
public static string GetMappedNameForPixelShaderType(INamedTypeSymbol typeSymbol)
{
string genericArgumentName = ((INamedTypeSymbol)typeSymbol.TypeArguments.First()).GetFullMetadataName();
// If the current type is a custom type, format it as needed
if (!KnownHlslTypes.TryGetValue(genericArgumentName, out string? mappedElementType))
{
mappedElementType = genericArgumentName.ToHlslIdentifierName();
}
// Construct the HLSL type name
return $"RWTexture2D<unorm {mappedElementType}>";
}
/// <summary>
/// Gets the mapped HLSL-compatible type name for the input element type symbol.
/// </summary>