gagaddji2
This commit is contained in:
parent
378b018d82
commit
c96ce10ec2
|
|
@ -124,17 +124,28 @@ public sealed partial class MainWindow : Window
|
||||||
var scale = (float)RenderSurface.CompositionScaleX;
|
var scale = (float)RenderSurface.CompositionScaleX;
|
||||||
var width = (float)RenderSurface.ActualWidth;
|
var width = (float)RenderSurface.ActualWidth;
|
||||||
var height = (float)RenderSurface.ActualHeight;
|
var height = (float)RenderSurface.ActualHeight;
|
||||||
if (width <= 0 || height <= 0 || scale <= 0) return;
|
App.Log($"CreateNativeHandle: w={width} h={height} scale={scale}");
|
||||||
|
if (width <= 0 || height <= 0 || scale <= 0)
|
||||||
|
{
|
||||||
|
App.Log("CreateNativeHandle: skipped (panel not laid out yet)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// wgpu's dx12 backend wants an ISwapChainPanelNative*, not the raw IUnknown.
|
|
||||||
var iid = typeof(ISwapChainPanelNative).GUID;
|
var iid = typeof(ISwapChainPanelNative).GUID;
|
||||||
var unknown = Marshal.GetIUnknownForObject(RenderSurface);
|
var unknown = Marshal.GetIUnknownForObject(RenderSurface);
|
||||||
IntPtr native = IntPtr.Zero;
|
IntPtr native = IntPtr.Zero;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int hr = Marshal.QueryInterface(unknown, in iid, out native);
|
int hr = Marshal.QueryInterface(unknown, in iid, out native);
|
||||||
|
App.Log($"QueryInterface hr=0x{hr:X} native=0x{native.ToInt64():X}");
|
||||||
if (hr < 0 || native == IntPtr.Zero) return;
|
if (hr < 0 || native == IntPtr.Zero) return;
|
||||||
_handle = LayersNative.layers_create_from_swap_chain_panel(native, width, height, scale);
|
_handle = LayersNative.layers_create_from_swap_chain_panel(native, width, height, scale);
|
||||||
|
App.Log($"layers_create_from_swap_chain_panel -> 0x{_handle.ToInt64():X}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
App.Log($"CreateNativeHandle threw: {ex}");
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ public static class Program
|
||||||
{
|
{
|
||||||
WinRT.ComWrappersSupport.InitializeComWrappers();
|
WinRT.ComWrappersSupport.InitializeComWrappers();
|
||||||
App.Log("ComWrappers initialised");
|
App.Log("ComWrappers initialised");
|
||||||
Application.Start(_ =>
|
Application.Start(p =>
|
||||||
{
|
{
|
||||||
App.Log("Application.Start callback enter");
|
App.Log("Application.Start callback enter");
|
||||||
var ctx = new DispatcherQueueSynchronizationContext(DispatcherQueue.GetForCurrentThread());
|
var ctx = new DispatcherQueueSynchronizationContext(DispatcherQueue.GetForCurrentThread());
|
||||||
SynchronizationContext.SetSynchronizationContext(ctx);
|
SynchronizationContext.SetSynchronizationContext(ctx);
|
||||||
App.Log("SyncContext set — creating App");
|
App.Log("SyncContext set — creating App");
|
||||||
_ = new App();
|
var app = new App();
|
||||||
App.Log("App instance created");
|
App.Log($"App instance created ({app.GetType().Name})");
|
||||||
});
|
});
|
||||||
App.Log("Application.Start returned");
|
App.Log("Application.Start returned");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue