Bug in 4.12.2 with Oculus on startup

Not sure how much earlier this goes, but is evident on 4.12.2 and 4.12.1

Editor crashes on startup with an array out of bounds error.

My system has 2 GTX 970s, the rift is plugged into the second one, my main display is plugged into the first.

I created a debug build and traced the error to here.

Engine\Source\Runtime\Windows\D3D11RHI\Private\Windows\WindowsD3D11Device.cpp

in

void FD3D11DynamicRHIModule::FindAdapter()

this line(368) causes the error

ChosenDescription = AdapterDescription[ChosenAdapter.AdapterIndex];

This is caused by the AdapterDescription array having only one entry due to how it is populated in the loop above. Several test call “continue” resulting in no description for that device being added to the array.

This line is below the tests in the loop, it needs to be moved to above the tests.

AdapterDescription.Add(AdapterDesc);

Or, change line 368 to

ChosenDescription = AdapterDescription[0];

I’ll let someone familiar with that code make the correct fix.

Cheers,
Dave.

Hello doorman,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Which oculus device are you using?
  2. Can you reproduce this issue in a clean project?
  3. If so, could you provide a detailed list of steps to reproduce this issue on our end?
  4. Was the project that you are using upgraded from an older version of the engine?

Hi Rudy,

Steps to reproduce:
Plug an Oculus CRV1 into the second (or subsequent) graphics adapter in your system.
This bug will not appear if you are plugging your HMD into the first adapter.

Project specifics:
This bug occurs on startup at 0%, no project is loaded.

Versions:
I compiled from zip file of 4.12.2 (and 4.12.1)

And just to be clear, I have fixed this issue for myself, I’m trying to give you guys the fix.The code change I described does fix the problem, I’m just not across that code so I’m not confident that my fix won’t have an adverse effect on something else.

I’ll try and get the most current source and look at the code in a bit more depth, then ill fix it there and create a pull request.

Hello again,

I have made a pull request here.
https://github.com/EpicGames/UnrealEngine/pull/2494

This is the first time I’ve done this, so apologies if I have stuffed anything up.

Hello doorman,

Thank you for submitting a pull request. I will be converting your last comment to an answer. Thank you for your time.

Make it a great day