H-uru / Plasma

Cyan Worlds's Plasma game engine
http://h-uru.github.io/Plasma/
GNU General Public License v3.0
202 stars 80 forks source link

Reconciling D3D Adapter Enumeration #1516

Closed colincornaby closed 6 months ago

colincornaby commented 8 months ago

D3D enumerates adapters. In kernel driver parlance - an adapter is a device that represents a video output on a card. Typically an enumeration API (like the one in D3D) will only enumerate adapters on a video card that have a display connected.

Basically:

I think the original source code has muddled things by assuming that an adapter is a driver or a video card. This has led to weird descriptions in the code like a video card having display modes instead of a monitor having display modes.

Comments like this one are suspicious:

//-----------------------------------------------------------------------------
// Name: D3DEnum_DriverInfo
// Desc: Linked-list structure to hold information about a DirectX driver. The
//       info stored is the capability bits for the driver plus a list
//       of valid Direct3D devices for the driver. Note: most systems will only
//       have one driver. The exception are multi-monitor systems, and systems
//       with non-GDI 3D video cards.

Here DriverInfo represents an adapter/display - not a GPU driver. That's why more than one "driver" appears on multi monitor systems.

My goal is to have a client be able to tell a pipeline which display is the target display. This should allow the user to move between displays and have the display modes update. To do that - I need to begin untangling the Direct3D pipeline and reviewing changes that could impact the other pipelines.

The changes I'm proposing here for clarity:

I'm going to admit - I don't know if this language is correct. Adapter is the most correct description of a port on a video card connected to a display. But Adapter is a DX-ism - and it has a 1:1 relationship with a display. Renderer I feel a little better about. Plasma refers to the software renderer and the hardware renderer as 'Devices' which doesn't seem like the right language.

Things I'm thinking about but not actively addressing yet (but am open to feedback):

I'm not sure of the origins of what happened here. This goes back to the original source drop. I think this file was a port of a D3D8 iterator - and possibly D3D8 had different terminology that mapped over badly.

Hoping to have this PR dragged through the wringer before I look at any changes to higher layers of Plasma that could spill into OpenGL and Metal.