diff --git a/Directory.Build.props b/Directory.Build.props
index 7169705b..a90caba2 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -6,5 +6,8 @@
true
Sergio Pedri
Copyright (c) 2021 Sergio Pedri
+
+ https://pkgs.terrafx.dev/index.json;
+
\ No newline at end of file
diff --git a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs
index 833cddf3..8f301650 100644
--- a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs
+++ b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs
@@ -51,7 +51,7 @@ internal unsafe static class Win32ApplicationRunner
{
Win32ApplicationRunner.application = application;
- IntPtr hInstance = Windows.GetModuleHandleW(null);
+ HMODULE hInstance = Windows.GetModuleHandleW(null);
fixed (char* name = Assembly.GetExecutingAssembly().FullName)
fixed (char* windowTitle = application.GetType().ToString())
@@ -61,9 +61,9 @@ internal unsafe static class Win32ApplicationRunner
{
cbSize = (uint)sizeof(WNDCLASSEXW),
style = Windows.CS_HREDRAW | Windows.CS_VREDRAW,
- lpfnWndProc = &WindowProc,
+ lpfnWndProc = (delegate* unmanaged)(delegate* unmanaged)&WindowProc,
hInstance = hInstance,
- hCursor = Windows.LoadCursorW(IntPtr.Zero, Windows.IDC_ARROW),
+ hCursor = Windows.LoadCursorW(HINSTANCE.NULL, Windows.IDC_ARROW),
lpszClassName = (ushort*)name
};
@@ -150,7 +150,7 @@ internal unsafe static class Win32ApplicationRunner
}
// Also listen to Escape and 'Q' to quit
- if (msg.message == Windows.WM_KEYUP && (msg.wParam == Windows.VK_ESCAPE || msg.wParam == 'Q'))
+ if (msg.message == Windows.WM_KEYUP && (msg.wParam == (WPARAM)Windows.VK_ESCAPE || msg.wParam == 'Q'))
{
_ = Windows.DestroyWindow(hwnd);
}
@@ -199,7 +199,7 @@ internal unsafe static class Win32ApplicationRunner
if (isPaused)
{
- Windows.SetCapture(hwnd);
+ Windows.SetCapture((HWND)hwnd);
}
else
{
@@ -253,7 +253,7 @@ internal unsafe static class Win32ApplicationRunner
RECT rect;
_ = Windows.GetCursorPos(&point);
- _ = Windows.GetWindowRect(hwnd, &rect);
+ _ = Windows.GetWindowRect((HWND)hwnd, &rect);
bool isAtTop = Math.Abs(point.y - rect.top) < 12;
bool isAtRight = Math.Abs(point.x - rect.right) < 12;
@@ -300,7 +300,7 @@ internal unsafe static class Win32ApplicationRunner
margins.cyTopHeight = -1;
margins.cyBottomHeight = -1;
- _ = Windows.DwmExtendFrameIntoClientArea(hwnd, &margins);
+ _ = Windows.DwmExtendFrameIntoClientArea((HWND)hwnd, &margins);
return 0;
}
@@ -313,6 +313,6 @@ internal unsafe static class Win32ApplicationRunner
}
}
- return Windows.DefWindowProcW(hwnd, uMsg, wParam, lParam);
+ return Windows.DefWindowProcW((HWND)hwnd, uMsg, wParam, lParam);
}
}
diff --git a/src/ComputeSharp/ComputeSharp.csproj b/src/ComputeSharp/ComputeSharp.csproj
index 05cc80a2..223d3a4e 100644
--- a/src/ComputeSharp/ComputeSharp.csproj
+++ b/src/ComputeSharp/ComputeSharp.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs
index f29c4851..7832dfe0 100644
--- a/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs
+++ b/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs
@@ -5,7 +5,7 @@ using System.Runtime.CompilerServices;
using ComputeSharp.Graphics.Helpers;
#endif
using Microsoft.Toolkit.Diagnostics;
-using HRESULT = System.Int32;
+using TerraFX.Interop;
namespace ComputeSharp.Core.Extensions;
@@ -22,6 +22,17 @@ internal static class HResultExtensions
/// Thrown if represents an error.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Assert(this HRESULT result)
+ {
+ Assert((int)result);
+ }
+
+ ///
+ /// Throws a if represents an error.
+ ///
+ /// The input to check.
+ /// Thrown if represents an error.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void Assert(this int result)
{
#if DEBUG
bool hasErrorsOrWarnings = DeviceHelper.FlushAllID3D12InfoQueueMessagesAndCheckForErrorsOrWarnings();
diff --git a/src/ComputeSharp/Shaders/Translation/ShaderCompiler.cs b/src/ComputeSharp/Shaders/Translation/ShaderCompiler.cs
index 03d22b81..92432853 100644
--- a/src/ComputeSharp/Shaders/Translation/ShaderCompiler.cs
+++ b/src/ComputeSharp/Shaders/Translation/ShaderCompiler.cs
@@ -116,7 +116,7 @@ internal sealed unsafe partial class ShaderCompiler
dxcOperationResult.GetAddressOf()).Assert();
}
- int status;
+ HRESULT status;
dxcOperationResult.Get()->GetStatus(&status).Assert();