From e6c194bdd9d8a0d723eff7f134e82411795f14d0 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 11 May 2024 22:40:49 +0200 Subject: [PATCH] Disable CsWin32 friendly overloads --- .../Dxc/DxcShaderCompiler.cs | 24 ++++++++++++------- .../NativeMethods.json | 3 +++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/ComputeSharp.SourceGenerators/Dxc/DxcShaderCompiler.cs b/src/ComputeSharp.SourceGenerators/Dxc/DxcShaderCompiler.cs index 875d1a7d..ca67c5bd 100644 --- a/src/ComputeSharp.SourceGenerators/Dxc/DxcShaderCompiler.cs +++ b/src/ComputeSharp.SourceGenerators/Dxc/DxcShaderCompiler.cs @@ -42,15 +42,23 @@ internal sealed unsafe class DxcShaderCompiler using ComPtr dxcCompiler = default; using ComPtr dxcUtils = default; - DirectX.DxcCreateInstance( - DirectX.CLSID_DxcCompiler, - IDxcCompiler3.IID_Guid, - out *(void**)dxcCompiler.GetAddressOf()).Assert(); + fixed (Guid* pDxcCompiler = &DirectX.CLSID_DxcCompiler) + fixed (Guid* pDxcCompiler3 = &IDxcCompiler3.IID_Guid) + { + DirectX.DxcCreateInstance( + pDxcCompiler, + pDxcCompiler3, + (void**)dxcCompiler.GetAddressOf()).Assert(); + } - DirectX.DxcCreateInstance( - DirectX.CLSID_DxcLibrary, - IDxcUtils.IID_Guid, - out *(void**)dxcUtils.GetAddressOf()).Assert(); + fixed (Guid* pDxcLibrary = &DirectX.CLSID_DxcLibrary) + fixed (Guid* pDxcUtils = &IDxcUtils.IID_Guid) + { + DirectX.DxcCreateInstance( + pDxcLibrary, + pDxcUtils, + (void**)dxcUtils.GetAddressOf()).Assert(); + } this.dxcCompiler3 = new ComPtr(dxcCompiler.Get()); this.dxcUtils = new ComPtr(dxcUtils.Get()); diff --git a/src/ComputeSharp.SourceGenerators/NativeMethods.json b/src/ComputeSharp.SourceGenerators/NativeMethods.json index f491f43c..b327dc15 100644 --- a/src/ComputeSharp.SourceGenerators/NativeMethods.json +++ b/src/ComputeSharp.SourceGenerators/NativeMethods.json @@ -6,5 +6,8 @@ "preserveSigMethods": [ "*" ] + }, + "friendlyOverloads": { + "enabled": false } } \ No newline at end of file