Add double precision support check to DX12 generator
このコミットが含まれているのは:
1 親
35bc8ce649
コミット
9bad2e99db
7ファイル変更
+39
-15
検索条件に一致するファイルはありません
@@ -6,6 +6,8 @@ using System.Threading;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
using Windows.Win32.Graphics.Direct3D.Dxc;
|
||||
using Windows.Win32.Graphics.Direct3D12;
|
||||
using DirectX = Windows.Win32.PInvoke;
|
||||
|
||||
namespace ComputeSharp.SourceGenerators.Dxc;
|
||||
|
||||
@@ -247,6 +249,31 @@ internal sealed unsafe class DxcShaderCompiler
|
||||
return dxcBlobBytecode.Move();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether double precision support is required.
|
||||
/// </summary>
|
||||
/// <param name="dxcBlob">The input HLSL bytecode to inspect.</param>
|
||||
/// <returns>Whether double precision support is required for <paramref name="dxcBlob"/>.</returns>
|
||||
public bool IsDoublePrecisionSupportRequired(IDxcBlob* dxcBlob)
|
||||
{
|
||||
using ComPtr<ID3D12ShaderReflection> d3D12ShaderReflection = default;
|
||||
|
||||
Guid iidOfID3D12ShaderReflection = ID3D12ShaderReflection.IID_Guid;
|
||||
|
||||
DxcBuffer dxcBuffer = default;
|
||||
dxcBuffer.Ptr = dxcBlob->GetBufferPointer();
|
||||
dxcBuffer.Size = dxcBlob->GetBufferSize();
|
||||
|
||||
this.dxcUtils.Get()->CreateReflection(
|
||||
&dxcBuffer,
|
||||
&iidOfID3D12ShaderReflection,
|
||||
(void**)d3D12ShaderReflection.GetAddressOf()).Assert();
|
||||
|
||||
const ulong doublePrecisionFlags = DirectX.D3D_SHADER_REQUIRES_DOUBLES | DirectX.D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS;
|
||||
|
||||
return (d3D12ShaderReflection.Get()->GetRequiresFlags() & doublePrecisionFlags) != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws an exception when a shader compilation fails.
|
||||
/// </summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする