Added support for normalized 2D textures
このコミットが含まれているのは:
1 親
050182367f
コミット
aaf8b5cac4
7ファイル変更
+92
-3
検索条件に一致するファイルはありません
@@ -122,7 +122,8 @@ namespace ComputeSharp.SourceGenerators
|
||||
yield return new[] { fieldSymbol.Name, mapping ?? fieldSymbol.Name, typeName };
|
||||
|
||||
// Track the type of items in the current buffer
|
||||
if (HlslKnownTypes.IsTypedResourceType(typeSymbol.GetFullMetadataName()))
|
||||
if (HlslKnownTypes.IsTypedResourceType(typeSymbol.GetFullMetadataName()) &&
|
||||
typeSymbol.TypeArguments.Length == 1)
|
||||
{
|
||||
types.Add((INamedTypeSymbol)typeSymbol.TypeArguments[0]);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
{
|
||||
[$"ComputeSharp.ReadOnlyTexture2D`1.this[{typeof(int).FullName}, {typeof(int).FullName}]"] = "int2",
|
||||
[$"ComputeSharp.ReadWriteTexture2D`1.this[{typeof(int).FullName}, {typeof(int).FullName}]"] = "int2",
|
||||
[$"ComputeSharp.ReadWriteTexture2D`2.this[{typeof(int).FullName}, {typeof(int).FullName}]"] = "int2",
|
||||
[$"ComputeSharp.ReadOnlyTexture3D`1.this[{typeof(int).FullName}, {typeof(int).FullName}, {typeof(int).FullName}]"] = "int3",
|
||||
[$"ComputeSharp.ReadWriteTexture3D`1.this[{typeof(int).FullName}, {typeof(int).FullName}, {typeof(int).FullName}]"] = "int3"
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using ComputeSharp.SourceGenerators.Extensions;
|
||||
using Microsoft.CodeAnalysis;
|
||||
@@ -71,6 +73,7 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
case "ComputeSharp.ReadWriteBuffer`1":
|
||||
case "ComputeSharp.ReadOnlyTexture2D`1":
|
||||
case "ComputeSharp.ReadWriteTexture2D`1":
|
||||
case "ComputeSharp.ReadWriteTexture2D`2":
|
||||
case "ComputeSharp.ReadOnlyTexture3D`1":
|
||||
case "ComputeSharp.ReadWriteTexture3D`1":
|
||||
return true;
|
||||
@@ -107,7 +110,7 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
// Special case for the structured buffer types
|
||||
if (IsTypedResourceType(typeName))
|
||||
{
|
||||
string genericArgumentName = ((INamedTypeSymbol)typeSymbol.TypeArguments[0]).GetFullMetadataName();
|
||||
string genericArgumentName = ((INamedTypeSymbol)typeSymbol.TypeArguments.Last()).GetFullMetadataName();
|
||||
|
||||
// If the current type is a custom type, format it as needed
|
||||
if (!KnownTypes.TryGetValue(genericArgumentName, out string? mapped))
|
||||
@@ -123,6 +126,7 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
"ComputeSharp.ReadWriteBuffer`1" => $"RWStructuredBuffer<{mapped}>",
|
||||
"ComputeSharp.ReadOnlyTexture2D`1" => $"Texture2D<{mapped}>",
|
||||
"ComputeSharp.ReadWriteTexture2D`1" => $"RWTexture2D<{mapped}>",
|
||||
"ComputeSharp.ReadWriteTexture2D`2" => $"RWTexture2D<unorm {mapped}>",
|
||||
"ComputeSharp.ReadOnlyTexture3D`1" => $"Texture3D<{mapped}>",
|
||||
"ComputeSharp.ReadWriteTexture3D`1" => $"RWTexture3D<{mapped}>",
|
||||
_ => throw new ArgumentException()
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする