Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling logging on Windows warns leaked D3D12 objects #2051

Open
LPGhatguy opened this issue Oct 10, 2021 · 3 comments
Open

Enabling logging on Windows warns leaked D3D12 objects #2051

LPGhatguy opened this issue Oct 10, 2021 · 3 comments
Labels
help required We need community help to make this happen. type: enhancement New feature or request

Comments

@LPGhatguy
Copy link
Contributor

Description
Running any wgpu program on Windows with logging enabled results in several lines of warnings from the d3d12 backend, even if it is not in use.

Repro steps

RUST_LOG=info cargo r --package wgpu --example hello-triangle

Expected vs observed behavior
Clearly describe what you get, and how it goes across your expectations.

Extra materials
Log output on my machine:

[2021-10-10T01:05:52Z INFO  wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "NVIDIA GeForce RTX 3070", vendor: 4318, device: 9352, device_type: DiscreteGpu, backend: Vulkan }
[2021-10-10T01:05:52Z INFO  wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
        Inserted device layer VK_LAYER_KHRONOS_validation (C:\VulkanSDK\1.2.182.0\Bin\.\VkLayer_khronos_validation.dll)
[2021-10-10T01:05:52Z INFO  wgpu_hal::vulkan::instance]         objects: (type: INSTANCE, hndl: 0x1b918f2b4a0, name: ?)
[2021-10-10T01:05:52Z INFO  wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
        Inserted device layer VK_LAYER_NV_optimus (C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_19c79fb6254e3b11\.\nvoglv64.dll)
[2021-10-10T01:05:52Z INFO  wgpu_hal::vulkan::instance]         objects: (type: INSTANCE, hndl: 0x1b918f2b4a0, name: ?)
[2021-10-10T01:05:52Z INFO  wgpu_hal::vulkan::adapter] Private capabilities: PrivateCapabilities { flip_y_requires_shift: true, imageless_framebuffers: true, image_view_usage: true, timeline_semaphores: true, texture_d24: true, texture_d24_s8: true, can_present: true, non_coherent_map_mask: 63, robust_buffer_access: true, robust_image_access: true }
[2021-10-10T01:05:52Z INFO  wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Mailbox }
[2021-10-10T01:05:54Z INFO  wgpu_core::hub] Dropping Global
[2021-10-10T01:05:54Z INFO  wgpu_core::device] Destroying 1 command encoders
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance] Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance] Live Producer at 0x000001B919C42238, Refcount: 1.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B919A297D0, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B919CE46E0, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B919CE8160, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B91E7D2180, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B919A6ECE0, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B9194922F0, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B919A71090, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B919495A70, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance] Live                         Object :      8
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance] Live Producer at 0x000001B91E899F28, Refcount: 1.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B91E8D0300, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B91E8E21D0, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B91E8E1A80, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B91E91A5B0, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B91E8F3F80, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B919495CC0, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B91E91EDC0, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance]   Live Object at 0x000001B919495380, Refcount: 0.
[2021-10-10T01:05:54Z WARN  wgpu_hal::dx12::instance] Live                         Object :      8

Platform

  • wgpu 0.11 or master
  • Windows 10
  • Nvidia RTX 3070, AMD Ryzen 5800X
@kvark
Copy link
Member

kvark commented Oct 11, 2021

I guess we could have an instance "remember" if any of the adapters where actually opened, on hide this output if nothing was opened.

@kvark kvark added help required We need community help to make this happen. type: enhancement New feature or request labels Oct 11, 2021
@LPGhatguy
Copy link
Contributor Author

@cwfitzgerald was doing some poking around to see if a D3D device even needs to be created. It is a large part of our initialization time even if we aren't using D3D12:

image

On my system, creating a D3D12 device that we don't actually use accounts for up to 250ms of startup overhead.

He mentioned that on his computer, which has... a large number of D3D12-capable devices, this accounts for much more of his startup time.

@kvark
Copy link
Member

kvark commented Oct 11, 2021

On D3D12, we need a device in order to produce an Adapter with limits, features, etc. We can probably make it faster. Also, if you know that D3D12 isn't needed, you can exclude it from the backend bits on init.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help required We need community help to make this happen. type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants