VOGONS


First post, by Sgeo

User metadata
Rank Newbie
Rank
Newbie

I like modding old games to work with VR. Unfortunately, that requires supporting Direct3D 11+, or OpenGL, or Vulkan. I recently found out that OpenGL reportedly does not perform well with AMD graphics cards.

If I were to run a D3D9 game (or potentially older) under D3D11 via dgVoodoo2, would it be possible for me to obtain an ID3D11Device? Would it be possible for me to use a ID3D11Texture2D (obtained from the VR API) directly? Would the IDirect3D9Device == the equivalent ID3D11Device, or is there a translation layer I wouldn't have access to?

In theory I might be able to just copy pixels via CPU from the D3D9 to the D3D11 surface instead of using dgVoodoo2, but should I worry about the performance impact?

Currently, I'm doing stuff by using WineD3D and then using OpenGL to copy from the current back buffer to the provided texture, but that's mostly possible because there is in fact a "current" back buffer. I don't know D3D well enough to know if there's such global aspects anywhere.

Reply 1 of 2, by Dege

User metadata
Rank l33t
Rank
l33t

It's all is a problem that I were thinking about formerly… and didn't want to come up with a solution at the end because I thought nobody (no modder) would need cooperating with dgVoodoo D3D11.

The problem is, D3D11 is not a function-based API with a current (thread-global) context like opengl but an object-oriented one which means, you cannot just retrieve a pointer to objects like ID3D11Device.
I can't remember now if D3D11 allows creating multiple ID3D11Device objects on the same adapter but even if it does, they and their child objects are separated worlds, cannot be mixed (like ogl contexts).

If I were to run a D3D9 game (or potentially older) under D3D11 via dgVoodoo2, would it be possible for me to obtain an ID3D11Device?

Inserting your code could basically be done by
- either implementing your own DXGI/D3D11 libraries passing calls through to the system libraries and hooking what they want (like ReShade does)
- or getting some help from dgVoodoo by loading your mod dll and providing you the device object along with some others like the "back buffer"

The latter solution is been planned.

Would it be possible for me to use a ID3D11Texture2D (obtained from the VR API) directly?

Yes, as long as the VR API is working with the ID3D11Device instance coming from dgVoodoo (not an own instance created separately).

Would the IDirect3D9Device == the equivalent ID3D11Device, or is there a translation layer I wouldn't have access to?

No, there is a translation layer: IDirect3D9Device --> a lot of internal logic --> ID3D11Device.

D3D11 hook code could be inserted like this: IDirect3D9Device --> a lot of internal logic --> optional hook code --> ID3D11Device.

In theory I might be able to just copy pixels via CPU from the D3D9 to the D3D11 surface instead of using dgVoodoo2, but should I worry about the performance impact?

It's not that simple. D3D surface formats (like 8/16 bit ones) don't necessarily match D3D11 surface formats, conversion is done when needed.