Disable dynamic shader compilation support

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-13 12:00:15 +02:00
1 親 3db275a157
コミット 490226aa4d
68ファイル変更
+169 -64

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

+9 -4
ファイルの表示
@@ -1,13 +1,10 @@
using System.Diagnostics;
using System.Linq;
#if NET6_0_OR_GREATER
using System.Runtime.Versioning;
#endif
using ComputeSharp;
using ComputeSharp.Interop;
#if NET6_0_OR_GREATER
[assembly: SupportedOSPlatform("windows6.2")]
#endif
float[] array = Enumerable.Range(1, 100).Select(static i => (float)i).ToArray();
@@ -26,10 +23,18 @@ for (int i = 0; i < array.Length; i++)
Trace.Assert(result[i] == array[i] * 2);
}
// Also get the shader info (this requires DXC to be present)
ShaderInfo shaderInfo = ReflectionServices.GetShaderInfo<MultiplyByTwo>();
// Validate a couple properties as a sanity check
Trace.Assert(shaderInfo.HlslSource is { Length: > 0 });
Trace.Assert(shaderInfo.BoundResourceCount == 2);
/// <summary>
/// A sample kernel that requires dynamic compilation, as it's not precompiled.
/// </summary>
[AutoConstructor]
[EmbeddedBytecode(DispatchAxis.X)]
internal readonly partial struct MultiplyByTwo : IComputeShader
{
public readonly ReadWriteBuffer<float> buffer;