-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display Helpers #1566
base: master
Are you sure you want to change the base?
Display Helpers #1566
Conversation
4a8be46
to
c6b8a3f
Compare
// aspect ratio is good - add the mode to the list | ||
plDisplayMode plasmaMode; | ||
plasmaMode.ColorDepth = 32; | ||
plasmaMode.Width = int(CGDisplayModeGetWidth(mode)); | ||
plasmaMode.Height = int(CGDisplayModeGetHeight(mode)); | ||
|
||
fDisplayModes.push_back(plasmaMode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably use emplace_back()
to construct in place (avoids copying).
@@ -357,6 +367,9 @@ class plPipeline : public plCreatable | |||
|
|||
float fBackingScale = 1.0f; | |||
void SetBackingScale(float scale) { fBackingScale = scale; }; | |||
|
|||
std::shared_ptr<plDisplayHelper> fDisplayHelper; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably want a better ownership model than shared pointer.
A few high-level thoughts:
|
c6b8a3f
to
665cde2
Compare
665cde2
to
8421682
Compare
Digging this PR back out - @dpogue I think you are right. One issue is that the client makes a lot of decisions about resolution - but it does it before the pipeline is necessarily available. One possible issue is the divergent views on if resolution selection is part of the graphics API or the platform API. Apple feels that it's platform API, but Microsoft sees it as a graphics API issue at least under D3D9. Other pipelines like OpenGL/Vulkan could cause further chaos, especially if you had one accelerator that supported one set of APIs and another adapter that supported a different set. There are probably Win32 APIs to map a display to resolutions that I'm not aware of. That might be a good solution. But the display helper still includes some graphics API related code to check capabilities. |
There's also overlap going on between this display helper class and DeviceEnumerator. |
I have mostly avoided thinking about this because (as you mentioned) with OpenGL is becomes a complicated nightmare that can't really be done at the driver level. I agree with the idea that the display mode stuff should be at the plClient/windowing level rather than the pipeline level, although I see how we might still want to filter that list of modes based on capabilities of the pipeline render device. The original Direct3D renderer used exclusive fullscreen, which presumably is where it's important to use the driver to enumerate the supported modes. We replaced that with fake-fullscreen though, so it might be less important to use that now vs using standard Win32 APIs to ask for the supported resolutions. I'm imagining something like |
We might need a display handle to go along with that (along with a re-review of where else this concept is already encapsulated in the pipeline.) Resolutions are going to be per display - and it would be good to clean that whole thing up while we're putting in new plumbing. The client will probably need to vend which display the window is currently on, and broadcast any changes. |
plClient does querying of the possible display modes in it’s constructor. For now - using a singleton as a way to set a global display helper before this process starts. Keeping display helpers in the plPipeline family. It’s possible it belongs at a lower level alongside hsG3DDeviceMode in since display helpers are platform and not render specific.
Looking for feedback on this concept. Direct3D is funny in that it directly includes display mode queries as part of its API. For Metal - and OpenGL particularly - things are a bit more interesting. The display mode API is separate from the graphics API.
This PR adds display helpers as a structure to try to bridge a specific renderer to a platform specific implementation.
I'm not sure how this fits with enumerations - it's possible that this integration needs to happen at a deeper level in the code.