Use cancellation token for D2D shader linking
このコミットが含まれているのは:
1 親
23ef66657d
コミット
963ec0ecb4
2ファイル変更
+22
-2
検索条件に一致するファイルはありません
+2
-1
@@ -205,7 +205,8 @@ partial class D2DPixelShaderDescriptorGenerator
|
||||
using ComPtr<ID3DBlob> d3DBlob = D3DCompiler.Compile(
|
||||
key.HlslSource.AsSpan(),
|
||||
key.ShaderProfile,
|
||||
key.CompileOptions);
|
||||
key.CompileOptions,
|
||||
token);
|
||||
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if SOURCE_GENERATOR
|
||||
using System.Threading;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
using Windows.Win32.Graphics.Direct3D;
|
||||
@@ -34,7 +35,17 @@ internal static unsafe partial class D3DCompiler
|
||||
/// <param name="shaderProfile">The shader profile to use to compile the shader.</param>
|
||||
/// <param name="options">The options to use to compile the shader.</param>
|
||||
/// <returns>The bytecode for the compiled shader.</returns>
|
||||
public static ComPtr<ID3DBlob> Compile(ReadOnlySpan<char> source, D2D1ShaderProfile shaderProfile, D2D1CompileOptions options)
|
||||
public static ComPtr<ID3DBlob> Compile(
|
||||
ReadOnlySpan<char> source,
|
||||
D2D1ShaderProfile shaderProfile,
|
||||
#if SOURCE_GENERATOR
|
||||
#pragma warning disable CS1573
|
||||
D2D1CompileOptions options,
|
||||
CancellationToken token) // The cancellation token used to cancel the operation.
|
||||
#pragma warning restore CS1573
|
||||
#else
|
||||
D2D1CompileOptions options)
|
||||
#endif
|
||||
{
|
||||
int maxLength = Encoding.ASCII.GetMaxByteCount(source.Length);
|
||||
byte[] buffer = ArrayPool<byte>.Shared.Rent(maxLength);
|
||||
@@ -58,6 +69,10 @@ internal static unsafe partial class D3DCompiler
|
||||
|
||||
try
|
||||
{
|
||||
#if SOURCE_GENERATOR
|
||||
token.ThrowIfCancellationRequested();
|
||||
#endif
|
||||
|
||||
// Compile the standalone D2D1 full shader
|
||||
using ComPtr<ID3DBlob> d3DBlobFullShader = Compile(
|
||||
source: buffer.AsSpan(0, writtenBytes),
|
||||
@@ -73,6 +88,10 @@ internal static unsafe partial class D3DCompiler
|
||||
return d3DBlobFullShader.Move();
|
||||
}
|
||||
|
||||
#if SOURCE_GENERATOR
|
||||
token.ThrowIfCancellationRequested();
|
||||
#endif
|
||||
|
||||
// Compile the export function
|
||||
using ComPtr<ID3DBlob> d3DBlobFunction = Compile(
|
||||
source: buffer.AsSpan(0, writtenBytes),
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする