Implemented source generator support for interfaces
このコミットが含まれているのは:
1 親
958fa15a11
コミット
2c90b7a92c
4ファイル変更
+61
-7
検索条件に一致するファイルはありません
@@ -50,13 +50,32 @@ namespace ComputeSharp.__Internals
|
||||
/// Validates the given texture for usage with a specified device, and retrieves its GPU descriptor handle.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of values stored in the input texture.</typeparam>
|
||||
/// <param name="texture">The input <see cref="Texture2D{T}"/> instance to check.</param>
|
||||
/// <param name="texture">The input <see cref="ReadOnlyTexture2D{T}"/> instance to check.</param>
|
||||
/// <param name="device">The target <see cref="GraphicsDevice"/> instance in use.</param>
|
||||
/// <returns>The GPU descriptor handle for the texture.</returns>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be called directly by user code")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ulong ValidateAndGetGpuDescriptorHandle<T>(Texture2D<T> texture, GraphicsDevice device)
|
||||
public static ulong ValidateAndGetGpuDescriptorHandle<T>(ReadOnlyTexture2D<T> texture, GraphicsDevice device)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.ThrowIfDisposed();
|
||||
texture.ThrowIfDeviceMismatch(device);
|
||||
|
||||
return Unsafe.As<D3D12_GPU_DESCRIPTOR_HANDLE, ulong>(ref Unsafe.AsRef(in texture.D3D12GpuDescriptorHandle));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates the given texture for usage with a specified device, and retrieves its GPU descriptor handle.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of values stored in the input texture.</typeparam>
|
||||
/// <param name="texture">The input <see cref="ReadWriteTexture2D{T}"/> instance to check.</param>
|
||||
/// <param name="device">The target <see cref="GraphicsDevice"/> instance in use.</param>
|
||||
/// <returns>The GPU descriptor handle for the texture.</returns>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be called directly by user code")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ulong ValidateAndGetGpuDescriptorHandle<T>(ReadWriteTexture2D<T> texture, GraphicsDevice device)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.ThrowIfDisposed();
|
||||
@@ -115,13 +134,32 @@ namespace ComputeSharp.__Internals
|
||||
/// Validates the given texture for usage with a specified device, and retrieves its GPU descriptor handle.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of values stored in the input texture.</typeparam>
|
||||
/// <param name="texture">The input <see cref="Texture3D{T}"/> instance to check.</param>
|
||||
/// <param name="texture">The input <see cref="ReadOnlyTexture3D{T}"/> instance to check.</param>
|
||||
/// <param name="device">The target <see cref="GraphicsDevice"/> instance in use.</param>
|
||||
/// <returns>The GPU descriptor handle for the texture.</returns>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be called directly by user code")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ulong ValidateAndGetGpuDescriptorHandle<T>(Texture3D<T> texture, GraphicsDevice device)
|
||||
public static ulong ValidateAndGetGpuDescriptorHandle<T>(ReadOnlyTexture3D<T> texture, GraphicsDevice device)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.ThrowIfDisposed();
|
||||
texture.ThrowIfDeviceMismatch(device);
|
||||
|
||||
return Unsafe.As<D3D12_GPU_DESCRIPTOR_HANDLE, ulong>(ref Unsafe.AsRef(in texture.D3D12GpuDescriptorHandle));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates the given texture for usage with a specified device, and retrieves its GPU descriptor handle.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of values stored in the input texture.</typeparam>
|
||||
/// <param name="texture">The input <see cref="ReadWriteTexture3D{T}"/> instance to check.</param>
|
||||
/// <param name="device">The target <see cref="GraphicsDevice"/> instance in use.</param>
|
||||
/// <returns>The GPU descriptor handle for the texture.</returns>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be called directly by user code")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ulong ValidateAndGetGpuDescriptorHandle<T>(ReadWriteTexture3D<T> texture, GraphicsDevice device)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.ThrowIfDisposed();
|
||||
|
||||
@@ -79,7 +79,9 @@ namespace ComputeSharp.Shaders.Mappings
|
||||
genericType == typeof(ReadOnlyTexture2D<>) ||
|
||||
genericType == typeof(ReadOnlyTexture2D<,>) ||
|
||||
genericType == typeof(ReadOnlyTexture3D<>) ||
|
||||
genericType == typeof(ReadOnlyTexture3D<,>);
|
||||
genericType == typeof(ReadOnlyTexture3D<,>) ||
|
||||
genericType == typeof(IReadOnlyTexture2D<>) ||
|
||||
genericType == typeof(IReadOnlyTexture3D<>);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -99,7 +101,9 @@ namespace ComputeSharp.Shaders.Mappings
|
||||
genericType == typeof(ReadWriteTexture2D<>) ||
|
||||
genericType == typeof(ReadWriteTexture2D<,>) ||
|
||||
genericType == typeof(ReadWriteTexture3D<>) ||
|
||||
genericType == typeof(ReadWriteTexture3D<,>);
|
||||
genericType == typeof(ReadWriteTexture3D<,>) ||
|
||||
genericType == typeof(IReadWriteTexture2D<>) ||
|
||||
genericType == typeof(IReadWriteTexture3D<>); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,14 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
[$"ComputeSharp.ReadOnlyTexture2D`2.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.IReadOnlyTexture2D`1.this[{typeof(int).FullName}, {typeof(int).FullName}]"] = "int2",
|
||||
[$"ComputeSharp.IReadWriteTexture2D`1.this[{typeof(int).FullName}, {typeof(int).FullName}]"] = "int2",
|
||||
[$"ComputeSharp.ReadOnlyTexture3D`1.this[{typeof(int).FullName}, {typeof(int).FullName}, {typeof(int).FullName}]"] = "int3",
|
||||
[$"ComputeSharp.ReadOnlyTexture3D`2.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",
|
||||
[$"ComputeSharp.ReadWriteTexture3D`2.this[{typeof(int).FullName}, {typeof(int).FullName}, {typeof(int).FullName}]"] = "int3"
|
||||
[$"ComputeSharp.ReadWriteTexture3D`2.this[{typeof(int).FullName}, {typeof(int).FullName}, {typeof(int).FullName}]"] = "int3",
|
||||
[$"ComputeSharp.IReadOnlyTexture3D`1.this[{typeof(int).FullName}, {typeof(int).FullName}, {typeof(int).FullName}]"] = "int3",
|
||||
[$"ComputeSharp.IReadWriteTexture3D`1.this[{typeof(int).FullName}, {typeof(int).FullName}, {typeof(int).FullName}]"] = "int3"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -78,6 +78,10 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
case "ComputeSharp.ReadOnlyTexture3D`2":
|
||||
case "ComputeSharp.ReadWriteTexture3D`1":
|
||||
case "ComputeSharp.ReadWriteTexture3D`2":
|
||||
case "ComputeSharp.IReadOnlyTexture2D`1":
|
||||
case "ComputeSharp.IReadWriteTexture2D`1":
|
||||
case "ComputeSharp.IReadOnlyTexture3D`1":
|
||||
case "ComputeSharp.IReadWriteTexture3D`1":
|
||||
return true;
|
||||
default: return false;
|
||||
};
|
||||
@@ -134,6 +138,10 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
"ComputeSharp.ReadOnlyTexture3D`2" => $"Texture3D<unorm {mapped}>",
|
||||
"ComputeSharp.ReadWriteTexture3D`1" => $"RWTexture3D<{mapped}>",
|
||||
"ComputeSharp.ReadWriteTexture3D`2" => $"RWTexture3D<unorm {mapped}>",
|
||||
"ComputeSharp.IReadOnlyTexture2D`1" => $"Texture2D<unorm {mapped}>",
|
||||
"ComputeSharp.IReadWriteTexture2D`1" => $"RWTexture2D<unorm {mapped}>",
|
||||
"ComputeSharp.IReadOnlyTexture3D`1" => $"Texture3D<unorm {mapped}>",
|
||||
"ComputeSharp.IReadWriteTexture3D`1" => $"RWTexture3D<unorm {mapped}>",
|
||||
_ => throw new ArgumentException()
|
||||
};
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする