Removed FX static using directives

このコミットが含まれているのは:
Sergio Pedri committed 2021-10-30 15:11:44 +02:00
1 親 d5e3114f7c
コミット 4d07edcd7c
22ファイル変更
+192 -211

検索条件に一致するファイルはありません

+9 -10
ファイルの表示
@@ -1,7 +1,6 @@
using System;
using ComputeSharp.Interop;
using TerraFX.Interop;
using FX = TerraFX.Interop.Windows;
namespace ComputeSharp.SwapChain.Backend;
@@ -88,7 +87,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
// Get the underlying ID3D12Device in use
fixed (ID3D12Device** d3D12Device = this.d3D12Device)
{
_ = InteropServices.TryGetID3D12Device(Gpu.Default, FX.__uuidof<ID3D12Device>(), (void**)d3D12Device);
_ = InteropServices.TryGetID3D12Device(Gpu.Default, Windows.__uuidof<ID3D12Device>(), (void**)d3D12Device);
}
// Create the direct command queue to use
@@ -102,7 +101,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
_ = d3D12Device.Get()->CreateCommandQueue(
&d3D12CommandQueueDesc,
FX.__uuidof<ID3D12CommandQueue>(),
Windows.__uuidof<ID3D12CommandQueue>(),
(void**)d3D12CommandQueue);
}
@@ -112,7 +111,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
_ = this.d3D12Device.Get()->CreateFence(
0,
D3D12_FENCE_FLAGS.D3D12_FENCE_FLAG_NONE,
FX.__uuidof<ID3D12Fence>(),
Windows.__uuidof<ID3D12Fence>(),
(void**)d3D12Fence);
}
@@ -121,7 +120,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
{
using ComPtr<IDXGIFactory2> dxgiFactory2 = default;
_ = FX.CreateDXGIFactory2(FX.DXGI_CREATE_FACTORY_DEBUG, FX.__uuidof<IDXGIFactory2>(), (void**)dxgiFactory2.GetAddressOf());
_ = Windows.CreateDXGIFactory2(Windows.DXGI_CREATE_FACTORY_DEBUG, Windows.__uuidof<IDXGIFactory2>(), (void**)dxgiFactory2.GetAddressOf());
DXGI_SWAP_CHAIN_DESC1 dxgiSwapChainDesc1 = default;
dxgiSwapChainDesc1.AlphaMode = DXGI_ALPHA_MODE.DXGI_ALPHA_MODE_IGNORE;
@@ -149,7 +148,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
{
this.d3D12Device.Get()->CreateCommandAllocator(
D3D12_COMMAND_LIST_TYPE.D3D12_COMMAND_LIST_TYPE_DIRECT,
FX.__uuidof<ID3D12CommandAllocator>(),
Windows.__uuidof<ID3D12CommandAllocator>(),
(void**)d3D12CommandAllocator);
}
@@ -161,7 +160,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
D3D12_COMMAND_LIST_TYPE.D3D12_COMMAND_LIST_TYPE_DIRECT,
d3D12CommandAllocator,
null,
FX.__uuidof<ID3D12GraphicsCommandList>(),
Windows.__uuidof<ID3D12GraphicsCommandList>(),
(void**)d3D12GraphicsCommandList);
}
@@ -206,8 +205,8 @@ internal sealed class SwapChainApplication<T> : Win32Application
fixed (ID3D12Resource** d3D12Resource0 = this.d3D12Resource0)
fixed (ID3D12Resource** d3D12Resource1 = this.d3D12Resource1)
{
_ = dxgiSwapChain1.Get()->GetBuffer(0, FX.__uuidof<ID3D12Resource>(), (void**)d3D12Resource0);
_ = dxgiSwapChain1.Get()->GetBuffer(1, FX.__uuidof<ID3D12Resource>(), (void**)d3D12Resource1);
_ = dxgiSwapChain1.Get()->GetBuffer(0, Windows.__uuidof<ID3D12Resource>(), (void**)d3D12Resource0);
_ = dxgiSwapChain1.Get()->GetBuffer(1, Windows.__uuidof<ID3D12Resource>(), (void**)d3D12Resource1);
}
this.texture?.Dispose();
@@ -236,7 +235,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
using ComPtr<ID3D12Resource> d3D12Resource = default;
// Get the underlying ID3D12Resource pointer for the texture
_ = InteropServices.TryGetID3D12Resource(this.texture!, FX.__uuidof<ID3D12Resource>(), (void**)d3D12Resource.GetAddressOf());
_ = InteropServices.TryGetID3D12Resource(this.texture!, Windows.__uuidof<ID3D12Resource>(), (void**)d3D12Resource.GetAddressOf());
// Get the target back buffer to update
ID3D12Resource* d3D12ResourceBackBuffer = this.currentBufferIndex switch
+46 -47
ファイルの表示
@@ -5,7 +5,6 @@ using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using TerraFX.Interop;
using FX = TerraFX.Interop.Windows;
namespace ComputeSharp.SwapChain.Backend;
@@ -52,7 +51,7 @@ internal unsafe static class Win32ApplicationRunner
{
Win32ApplicationRunner.application = application;
IntPtr hInstance = FX.GetModuleHandleW(null);
IntPtr hInstance = Windows.GetModuleHandleW(null);
fixed (char* name = Assembly.GetExecutingAssembly().FullName)
fixed (char* windowTitle = application.GetType().ToString())
@@ -61,33 +60,33 @@ internal unsafe static class Win32ApplicationRunner
WNDCLASSEXW windowClassEx = new()
{
cbSize = (uint)sizeof(WNDCLASSEXW),
style = FX.CS_HREDRAW | FX.CS_VREDRAW,
style = Windows.CS_HREDRAW | Windows.CS_VREDRAW,
lpfnWndProc = &WindowProc,
hInstance = hInstance,
hCursor = FX.LoadCursorW(IntPtr.Zero, FX.MAKEINTRESOURCE(32512)),
hCursor = Windows.LoadCursorW(IntPtr.Zero, Windows.MAKEINTRESOURCE(32512)),
lpszClassName = (ushort*)name
};
// Register the window class
_ = FX.RegisterClassExW(&windowClassEx);
_ = Windows.RegisterClassExW(&windowClassEx);
Rectangle windowRect = new(0, 0, 1280, 720);
// Set the target window size
_ = FX.AdjustWindowRect((RECT*)&windowRect, FX.WS_OVERLAPPEDWINDOW, FX.FALSE);
_ = Windows.AdjustWindowRect((RECT*)&windowRect, Windows.WS_OVERLAPPEDWINDOW, Windows.FALSE);
uint
height = (uint)(windowRect.Bottom - windowRect.Top),
width = (uint)(windowRect.Right - windowRect.Left);
// Create the window and store a handle to it
hwnd = FX.CreateWindowExW(
hwnd = Windows.CreateWindowExW(
0,
windowClassEx.lpszClassName,
(ushort*)windowTitle,
FX.WS_OVERLAPPEDWINDOW,
FX.CW_USEDEFAULT,
FX.CW_USEDEFAULT,
Windows.WS_OVERLAPPEDWINDOW,
Windows.CW_USEDEFAULT,
Windows.CW_USEDEFAULT,
(int)width,
(int)height,
HWND.NULL,
@@ -102,14 +101,14 @@ internal unsafe static class Win32ApplicationRunner
margins.cyTopHeight = -1;
margins.cyBottomHeight = -1;
_ = FX.DwmExtendFrameIntoClientArea(hwnd, &margins);
_ = Windows.DwmExtendFrameIntoClientArea(hwnd, &margins);
}
// Initialize the application
application.OnInitialize(hwnd);
// Display the window
_ = FX.ShowWindow(hwnd, FX.SW_SHOWDEFAULT);
_ = Windows.ShowWindow(hwnd, Windows.SW_SHOWDEFAULT);
MSG msg = default;
@@ -140,12 +139,12 @@ internal unsafe static class Win32ApplicationRunner
renderThread.Start((application, tokenSource.Token));
// Process any messages in the queue
while (msg.message != FX.WM_QUIT)
while (msg.message != Windows.WM_QUIT)
{
if (FX.PeekMessageW(&msg, HWND.NULL, 0, 0, FX.PM_REMOVE) != 0)
if (Windows.PeekMessageW(&msg, HWND.NULL, 0, 0, Windows.PM_REMOVE) != 0)
{
_ = FX.TranslateMessage(&msg);
_ = FX.DispatchMessageW(&msg);
_ = Windows.TranslateMessage(&msg);
_ = Windows.DispatchMessageW(&msg);
}
else if (isPaused)
{
@@ -175,9 +174,9 @@ internal unsafe static class Win32ApplicationRunner
switch (uMsg)
{
// Change the paused state on window activation
case FX.WM_ACTIVATE:
case Windows.WM_ACTIVATE:
{
if (FX.LOWORD(wParam) == FX.WA_INACTIVE)
if (Windows.LOWORD(wParam) == Windows.WA_INACTIVE)
{
isPaused = true;
}
@@ -189,18 +188,18 @@ internal unsafe static class Win32ApplicationRunner
}
// Change the paused state when ESC is pressed
case FX.WM_KEYDOWN:
case Windows.WM_KEYDOWN:
{
if ((ConsoleKey)wParam == ConsoleKey.Escape)
{
if (isPaused)
{
FX.SetCapture(hwnd);
Windows.SetCapture(hwnd);
}
else
{
FX.ReleaseCapture();
Windows.ReleaseCapture();
}
isPaused = !isPaused;
@@ -210,7 +209,7 @@ internal unsafe static class Win32ApplicationRunner
}
// Window resize started
case FX.WM_ENTERSIZEMOVE:
case Windows.WM_ENTERSIZEMOVE:
{
isResizing = true;
@@ -218,7 +217,7 @@ internal unsafe static class Win32ApplicationRunner
}
// Window resize completed
case FX.WM_EXITSIZEMOVE:
case Windows.WM_EXITSIZEMOVE:
{
isResizing = false;
application.OnResize();
@@ -227,9 +226,9 @@ internal unsafe static class Win32ApplicationRunner
}
// Size update
case FX.WM_SIZE:
case Windows.WM_SIZE:
{
if (!isResizing && wParam != FX.SIZE_MINIMIZED)
if (!isResizing && wParam != Windows.SIZE_MINIMIZED)
{
application.OnResize();
}
@@ -238,19 +237,19 @@ internal unsafe static class Win32ApplicationRunner
}
// Size and position of the window (needed to enable the borderless mode)
case FX.WM_NCCALCSIZE:
case Windows.WM_NCCALCSIZE:
{
return 0;
}
// Enable dragging the window
case FX.WM_NCHITTEST:
case Windows.WM_NCHITTEST:
{
POINT point;
RECT rect;
_ = FX.GetCursorPos(&point);
_ = FX.GetWindowRect(hwnd, &rect);
_ = Windows.GetCursorPos(&point);
_ = Windows.GetWindowRect(hwnd, &rect);
bool
isAtTop = Math.Abs(point.y - rect.top) < 12,
@@ -260,37 +259,37 @@ internal unsafe static class Win32ApplicationRunner
if (isAtTop)
{
if (isAtRight) return FX.HTTOPRIGHT;
if (isAtLeft) return FX.HTTOPLEFT;
return FX.HTTOP;
if (isAtRight) return Windows.HTTOPRIGHT;
if (isAtLeft) return Windows.HTTOPLEFT;
return Windows.HTTOP;
}
if (isAtRight)
{
if (isAtTop) return FX.HTTOPRIGHT;
if (isAtBottom) return FX.HTBOTTOMRIGHT;
return FX.HTRIGHT;
if (isAtTop) return Windows.HTTOPRIGHT;
if (isAtBottom) return Windows.HTBOTTOMRIGHT;
return Windows.HTRIGHT;
}
if (isAtBottom)
{
if (isAtRight) return FX.HTBOTTOMRIGHT;
if (isAtLeft) return FX.HTBOTTOMLEFT;
return FX.HTBOTTOM;
if (isAtRight) return Windows.HTBOTTOMRIGHT;
if (isAtLeft) return Windows.HTBOTTOMLEFT;
return Windows.HTBOTTOM;
}
if (isAtLeft)
{
if (isAtTop) return FX.HTTOPLEFT;
if (isAtBottom) return FX.HTBOTTOMLEFT;
return FX.HTLEFT;
if (isAtTop) return Windows.HTTOPLEFT;
if (isAtBottom) return Windows.HTBOTTOMLEFT;
return Windows.HTLEFT;
}
return FX.HTCAPTION;
return Windows.HTCAPTION;
}
// Restore the drop shadow
case FX.WM_DWMCOMPOSITIONCHANGED:
case Windows.WM_DWMCOMPOSITIONCHANGED:
{
MARGINS margins = default;
margins.cxLeftWidth = -1;
@@ -298,19 +297,19 @@ internal unsafe static class Win32ApplicationRunner
margins.cyTopHeight = -1;
margins.cyBottomHeight = -1;
_ = FX.DwmExtendFrameIntoClientArea(hwnd, &margins);
_ = Windows.DwmExtendFrameIntoClientArea(hwnd, &margins);
return 0;
}
// Shutdown
case FX.WM_DESTROY:
case Windows.WM_DESTROY:
{
FX.PostQuitMessage(0);
Windows.PostQuitMessage(0);
return 0;
}
}
return FX.DefWindowProcW(hwnd, uMsg, wParam, lParam);
return Windows.DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
}