Closed nea closed 8 years ago
I know there is currently no DX12 Template for XAML and that would be ok for me, if there would be another way to get SharpDX with Dx12 working on UWP. Any ideas?
Hey
Having a good night's sleep helped ^^
XAML, UWP and DirectX 12 seems to be a "no-no" for now, as there seems to be no existing template to use (at least from what I read and found on MSDN) and SwapChainPanel is not working correctly (at least for me). So the full Stack (UWP, DX12, XAML) seems to be for DirectX 11 for now. But going for DX12 and UWP w/o XAML seems to work now.
What I did is that I took the DirectX 12 UWP DirectX C++ template (https://msdn.microsoft.com/en-us/library/windows/apps/mt210796.aspx) and translated that to C#. Pretty much just completely straight forward without any optimization.
Additionally (at least for now) grabbing the Handle from the CoreWindow via
[ComImport, Guid("45D64A29-A63E-4CB6-B498-5781D298CB4F")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface ICoreWindowInterop {
IntPtr WindowHandle {
get;
}
bool MessageHandled {
set;
}
}
...
dynamic corewin = window;
var interop = (ICoreWindowInterop)corewin;
var handle = interop.WindowHandle;
to pass it to the SwapChainDescription. Thanks to http://stackoverflow.com/a/34935652/2462586
It is probably not the best/nices/most correct thing to do, especially in this environment, but as I just wanted to have the fun of trying I am more than happy ^^
The rest comes down to your sample (HelloWindow, Run/Update/Render especially mapped to the template). So, now I have a foundation to fool around and try your other samples.
Big thanks for these samples
Sorry for not responding but It seems you have solved and I've learned an usefull trick. Thank you
@nea Could you please see if your DirectX12 UWP XAML SwanchainPanel interop c# (directly ported from c++) could be used in WindowsTemplateStudio?
Hey
First of all thanks for these. Really awesome.
Just out of curiosity I wanted to see if it is possible to get SharpDX with these DX12 samples working in UWP but I am really having issues getting it to work.
I just have a Blank UWP App with its standard MainPage. I added a SwapChainPanel, nearly used your code one to one but face the same error as an older issue regarding initiating a device with "null", but worked out taking the first adapter.
Problem is: Building the SwapChainDescription requires an OutputHandle and this is a problem. I now got a handle of the UWP Window with some InterOp magic and other Stack-Help but even if it starts, nothing gets rendered.
This is not necessarily an issue regarding your tutorials, but as you are already so far, maybe you got an idea what to look at or how to get this combination working.
Working with DX11 initialization in UWP works fine.
Thanks in advance