On Wed, 17 Dec 2025 11:02:54 GMT, Marius Hanl <[email protected]> wrote:

> > One thought nagged me during the review: why do we keep the ordinal (an 
> > index) when we could, in theory, keep a reference to the object? Is there a 
> > potential for misalignment, perhaps a transient one?
> 
> My guess: Because the purpose is to be an Identifier (ID) only, so that a 
> Screen can be later mapped to a Pipeline, if needed. The `MTLPipeline` does 
> not need that, but e.g. `D3DPipeline` does. I guess using an object therefore 
> could be possible, but makes sense only for some pipelines still.

That would be my guess too. In D3D9 there's a "lost device" event which 
applications need to handle properly - whenever ex. a screen resolution 
changes, a screen gets (un)plugged, the window gets minimized/restored, or even 
when the fullscreen app loses keyboard focus. When D3D9 loses the Device for 
any reason the rendering calls are silently ignored and runtime returns an 
appropriate error code - application needs to first "reset" the device and then 
recreate all resources (especially resources stored in VRAM).

I would suspect that a D3D9 device reset can have a possibility of changing how 
the system enumerates the screen, so we might need to be able to re-identify 
the screens in order to re-tie the respective Resource Factories. I wasn't 
there when this was written, but an ordinal seems to be the easiest way to go 
about it. Other backends probably don't really use it since they don't have a 
scenario like this.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/2009#issuecomment-3665006186

Reply via email to