facebookarchive / 360-Capture-SDK

A developer focused sample SDK that allows game and virtual Reality devs to be able to easily and quickly integrate 360 photo/video capture capability into their game apps.
https://github.com/facebook/360-Capture-SDK
Other
252 stars 75 forks source link

Crash in debug on AMD hardware #47

Open psychicteeth opened 6 years ago

psychicteeth commented 6 years ago

Hi folks,

When I compile the DLL from source, and overwrite the dll after importing the supplied unitypackage, I can get videos to record in release. However, the library crashes in AMDEncoder::fillSurface when calling CopySubresourceRegion in debug. Is this a known issue? Any ideas what I can do to fix it?

GPU hardware is Radeon RX 580, have tried with Unity 2017.4.1f1 and 2018.2.0b7.

grancia commented 6 years ago

Hi,

Do you have a log( %LOCALAPPDATA%\FBCapture\FBCaptureSDK.txt)? One thing you might want to take a look is D3D11CreateDevice in FBCaptureSystem.cpp. If it's failing there, you will need to install D3D11 SDK layer or you can also remove that flag.

Solution 1:

ifdef DEBUG

// createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;

endif

Solution 2: https://stackoverflow.com/questions/32809169/use-d3d11-debug-layer-with-vs2013-on-windows-10

psychicteeth commented 6 years ago

Thanks, I will check those solutions out. The log is thus:

[ 2018-07-04 09:52:54 ][INFO] Capture SDK Version: : 2.0 [ 2018-07-04 09:52:54 ][INFO] Graphics Card Info: : Radeon RX 580 Series [ 2018-07-04 09:52:54 ][INFO] Graphics Card Info: : Microsoft Basic Render Driver [ 2018-07-04 09:52:54 ][INFO] Output folder already existed [ 2018-07-04 09:52:54 ][INFO] AMF version (header): : 1000400000000 [ 2018-07-04 09:52:54 ][INFO] AMF version (runtime): : 1000400020000 [ 2018-07-04 09:52:54 ][INFO] Passed capture capability tests. Ready to start encoding [ 2018-07-04 09:52:55 ][ERROR] No endpoints found [ 2018-07-04 09:52:55 ][INFO] Can't find VR audio devices. Just use default audio input and output [ 2018-07-04 09:52:55 ][ERROR] Failed to get default input audio endpoint with GetDefaultAudioEndpoint. [Error code] : -2147023728 [ 2018-07-04 09:52:55 ][INFO] But we want to keep going without microphone [ 2018-07-04 09:52:55 ][INFO] Start audio capture [ 2018-07-04 09:52:55 ][INFO] Encoding configuration is initiated

And the crash occurs when you start recording. The encoding thread starts up, and when you pass the first frame the AMD encoder crashes. The call stack looks like:

ID3D11DeviceContext::CopySubresourceRegion AMDEncoder::fillSurface AMDEncoder::encodeMain EncoderMain::startEncoding

psychicteeth commented 6 years ago

Output from DirectX

D3D11 CORRUPTION: ID3D11DeviceContext::CopySubresourceRegion: First parameter is corrupt or NULL [ MISCELLANEOUS CORRUPTION #13: CORRUPTED_PARAMETER1]

psychicteeth commented 6 years ago

The texture descriptors look fine - they match exactly except for the encoding texture is marked as a shared resource image

psychicteeth commented 6 years ago

The crash also occurs if you replace CopySubresourceRegion with CopyResource

grancia commented 6 years ago

Can you check if you're still able to see the issue with v2.2? Please don't forget to build in release mode or remove following line in FBCaptureSystem.cpp if you didn't install D3D11 SDK Layers library.

ifdef DEBUG

// createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;

endif