ComputeSharp icon indicating copy to clipboard operation
ComputeSharp copied to clipboard

ComputeSharp.Sample app builds but throws System.ComponentModel.Win32Exception

Open amonroejj opened this issue 2 years ago • 2 comments

Description (optional)

ComputeSharp.Sample app builds but throws System.ComponentModel.Win32Exception.

Reproduction Steps

  • Using Visual Studio 2022 17.9.4
  • I added "Game development with C++" workload to VS
  • Downloaded the ComputeSharp repo from GitHub as zip file as of 2024-03-20
  • Built ComputeSharp.Sample successfully
  • Stepped in with the debugger
  • Line 9 throws Win32Exception

Expected Behavior

App should run to completion.

Actual Behavior

App cannot run due to Win32Exception.

System info

This section should contain useful info such as:

  • ComputeSharp 2024-03-20
  • Windows 10 19044.4046
  • Integrated graphics (Intel Iris Xe Graphics)
  • Visual Studio 2022 17.9.4

Additional context (optional)

   at System.ComponentModel.Win32ExceptionExtensions.Throw(Int32 hresult) in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp.Core\Polyfills\Win32ExceptionExtensions.cs:line 59
   at System.ComponentModel.Win32ExceptionExtensions.ThrowIfFailed(Win32Exception _, Int32 hresult) in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp.Core\Polyfills\Win32ExceptionExtensions.cs:line 47
   at ComputeSharp.Core.Extensions.HRESULTExtensions.<Assert>g__AssertWithDebugInfo|1_0(Int32 result) in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp\Graphics\Extensions\Interop\HRESULTExtensions.cs:line 50
   at ComputeSharp.Core.Extensions.HRESULTExtensions.Assert(Int32 result) in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp\Graphics\Extensions\Interop\HRESULTExtensions.cs:line 56
   at ComputeSharp.Core.Extensions.HRESULTExtensions.Assert(HRESULT result) in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp\Graphics\Extensions\Interop\HRESULTExtensions.cs:line 23
   at ComputeSharp.Graphics.Helpers.DeviceHelper.EnableDebugMode() in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp\Graphics\Helpers\DeviceHelper.IDXGIFactory6.cs:line 71
   at ComputeSharp.Graphics.Helpers.DeviceHelper.CreateDXGIFactory6(IDXGIFactory6** dxgiFactory6) in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp\Graphics\Helpers\DeviceHelper.IDXGIFactory6.cs:line 32
   at ComputeSharp.Graphics.Helpers.DeviceHelper.TryGetDefaultDevice(ID3D12Device** d3D12Device, IDXGIAdapter** dxgiAdapter, DXGI_ADAPTER_DESC1* dxgiDescription1) in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp\Graphics\Helpers\DeviceHelper.cs:line 61
   at ComputeSharp.Graphics.Helpers.DeviceHelper.GetOrCreateDefaultDevice() in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp\Graphics\Helpers\DeviceHelper.cs:line 40
   at ComputeSharp.Graphics.Helpers.DeviceHelper.<GetDefaultDeviceFromCacheOrCreateInstance>g__InitializeAndAssignDefaultDevice|10_0() in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp\Graphics\Helpers\DeviceHelper.Factory.cs:line 55
   at ComputeSharp.Graphics.Helpers.DeviceHelper.GetDefaultDeviceFromCacheOrCreateInstance() in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp\Graphics\Helpers\DeviceHelper.Factory.cs:line 61
   at ComputeSharp.GraphicsDevice.GetDefault() in C:\Users\monror1\source\repos\ComputeSharp-main\src\ComputeSharp\Graphics\GraphicsDevice.GetDevice.cs:line 43
   at Program.<Main>$(String[] args) in C:\Users\monror1\source\repos\ComputeSharp-main\samples\ComputeSharp.Sample\Program.cs:line 9

amonroejj avatar Mar 20 '24 19:03 amonroejj

I suspect you're missing the debug layer, see here on how to enable it. This error is by design.

Sergio0694 avatar Mar 20 '24 20:03 Sergio0694

Please add this to the "Requirements" section of the Wiki home page https://github.com/Sergio0694/ComputeSharp/wiki#requirements- . Thanks.

amonroejj avatar Mar 20 '24 21:03 amonroejj