ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.13k stars 1.28k forks source link

Live D3D objects DirectX 11 #1278

Open rorydriscoll opened 4 years ago

rorydriscoll commented 4 years ago

Under DirectX 11 using an Oculus DK2, I notice that OpenVR holds on to some references to compute shaders even after shut down. When going to shut down my application and running under VR, I end up with the device having outstanding references from six compute shaders (I don't use compute shaders, so I know they're not mine).

D3D11 WARNING:  Live ID3D11ComputeShader at 0x000001F1D032BC80, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #2097299: LIVE_COMPUTESHADER]
D3D11 WARNING:  Live ID3D11ComputeShader at 0x000001F1D378DAB0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #2097299: LIVE_COMPUTESHADER]
D3D11 WARNING:  Live ID3D11ComputeShader at 0x000001F1D37BF140, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #2097299: LIVE_COMPUTESHADER]
D3D11 WARNING:  Live ID3D11ComputeShader at 0x000001F1D38EB7D0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #2097299: LIVE_COMPUTESHADER]
D3D11 WARNING:  Live ID3D11ComputeShader at 0x000001F1D38EBBC0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #2097299: LIVE_COMPUTESHADER]
D3D11 WARNING:  Live ID3D11ComputeShader at 0x000001F1D37C0310, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #2097299: LIVE_COMPUTESHADER]

Is there anything else I'm missing beyond calling vr::VR_Shutdown() that should release these objects, or is this a bug?

LukeRoss00 commented 3 years ago

This bug is still present in February 2021, and while the majority of games simply terminate the process after VR shutdown, it would definitely be nice if it were fixed, because for apps that can toggle VR on and off it causes a device to leak every time.

hbhollis commented 3 years ago

This leak also impacts D3D12. It's a bigger problem in D3D12 so I create a separate issue. Please see #1520 for details on how to reproduce the VRAM leak using the openvr dx12 sample.