Move D2D reflection code to D2D generator only
このコミットが含まれているのは:
1 親
76752e2e47
コミット
5d58622ddf
5ファイル変更
+41
-74
検索条件に一致するファイルはありません
+6
-2
@@ -205,8 +205,12 @@ partial class D2DPixelShaderDescriptorGenerator
|
||||
using ComPtr<ID3DBlob> dxcBlobBytecode = D3DCompiler.Compile(
|
||||
key.HlslSource.AsSpan(),
|
||||
key.ShaderProfile,
|
||||
key.CompileOptions,
|
||||
out bool requiresDoublePrecisionSupport);
|
||||
key.CompileOptions);
|
||||
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
// Check whether double precision operations are required
|
||||
bool requiresDoublePrecisionSupport = D3DCompiler.IsDoublePrecisionSupportRequired(dxcBlobBytecode.Get());
|
||||
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Graphics.Direct3D;
|
||||
using Windows.Win32.Graphics.Direct3D11;
|
||||
using DirectX = Windows.Win32.PInvoke;
|
||||
|
||||
namespace ComputeSharp.D2D1.Shaders.Translation;
|
||||
|
||||
/// <inheritdoc/>
|
||||
partial class D3DCompiler
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks whether double precision support is required.
|
||||
/// </summary>
|
||||
/// <param name="d3DBlob">The input HLSL bytecode to inspect.</param>
|
||||
/// <returns>Whether double precision support is required for <paramref name="d3DBlob"/>.</returns>
|
||||
public static unsafe bool IsDoublePrecisionSupportRequired(ID3DBlob* d3DBlob)
|
||||
{
|
||||
using ComPtr<ID3D11ShaderReflection> d3D11ShaderReflection = default;
|
||||
|
||||
Guid iidOfID3D11ShaderReflection = ID3D11ShaderReflection.IID_Guid;
|
||||
|
||||
DirectX.D3DReflect(
|
||||
pSrcData: d3DBlob->GetBufferPointer(),
|
||||
SrcDataSize: d3DBlob->GetBufferSize(),
|
||||
pInterface: &iidOfID3D11ShaderReflection,
|
||||
ppReflector: (void**)d3D11ShaderReflection.GetAddressOf()).Assert();
|
||||
|
||||
ulong doublePrecisionFlags = DirectX.D3D_SHADER_REQUIRES_DOUBLES | DirectX.D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS;
|
||||
|
||||
return (d3D11ShaderReflection.Get()->GetRequiresFlags() & doublePrecisionFlags) != 0;
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする