Skip to content
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

Add windows association flags to WGPUSurfaceDescriptorFromWindowsHWND #298

Open
austinEng opened this issue Jun 5, 2024 · 7 comments
Open
Labels
has resolution Issue is resolved, just needs to be done non-breaking Does not require a breaking change (that would block V1.0) presentation Presenting images to surfaces like windows and canvases

Comments

@austinEng
Copy link
Collaborator

This PR google/dawn#16 adds DXGI_MWA_NO_ALT_ENTER always to Dawn.

Probably the better thing would be for an application to be able to configure the window association when creating the WGPUSurface.

Concretely, something like:

typedef struct WGPUSurfaceDescriptorFromWindowsHWND {
    WGPUChainedStruct chain;
    void * hinstance;
    void * hwnd;
+   uint32_t windowAssocationFlags;
} WGPUSurfaceDescriptorFromWindowsHWND WGPU_STRUCTURE_ATTRIBUTE;

For reference, valid flags are:

#define DXGI_MWA_NO_WINDOW_CHANGES  0x1
#define DXGI_MWA_NO_ALT_ENTER       0x2
#define DXGI_MWA_NO_PRINT_SCREEN    0x4
@kainino0x
Copy link
Collaborator

Jun 6 meeting:

  • KN: Can the caller call MakeWindowAssociation themselves?
  • AE: They don’t have the IDXGIFactory.
  • KN: Could we pass it out to them, or have them pass it in?
  • AE: Not sure, could cause layering violation problems.
  • (looking through everything on IDXGIFactory through IDXGIFactory7)
  • KN/AE: Seems fine to just pass this through for now and take a factory later in an extension or different descriptor, if it turns out to be useful
  • AE: Name? mwa? mwaFlags?
  • KN: I like the current name, mwa would be harder to look up
  • Let’s do what’s written in the proposal

@kainino0x kainino0x added the has resolution Issue is resolved, just needs to be done label Jun 6, 2024
@Kangz
Copy link
Collaborator

Kangz commented Jun 7, 2024

I have slight concerns with adding the flags directly in this descriptor because it is only useful on the D3D11 and D3D12 backend, but the HWND descriptor can also be used to Vulkan and OpenGL/ES, so the flags would do nothing there. At the minimum we'll need docs to cover that.

@austinEng
Copy link
Collaborator Author

We hadn't considered HWND on Vulkan / GL - do you think this would be better as an independent feature?

I think if the feature isn't enabled, you'd get a validation error during surface.Configure(..)
(need to know the device first)

@kainino0x kainino0x removed the has resolution Issue is resolved, just needs to be done label Jun 7, 2024
@kainino0x
Copy link
Collaborator

I guess if MakeWindowAssociation gets called in Configure we could make this an extension to Configure?

@austinEng
Copy link
Collaborator Author

Moving to an extension to Configure sounds fine to me. @SoapyMan would you like to champion adding this since it seems important for your use case?

@SoapyMan
Copy link

Sounds good to me

@kainino0x kainino0x added the has resolution Issue is resolved, just needs to be done label Jul 13, 2024
@kainino0x kainino0x added the presentation Presenting images to surfaces like windows and canvases label Oct 2, 2024
@kainino0x
Copy link
Collaborator

This has a resolution but it should be implemented before we try to standardize it. It's going to be an extension struct anyway so it's non-breaking (can be easily added after stabilization).

@kainino0x kainino0x added the non-breaking Does not require a breaking change (that would block V1.0) label Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has resolution Issue is resolved, just needs to be done non-breaking Does not require a breaking change (that would block V1.0) presentation Presenting images to surfaces like windows and canvases
Projects
None yet
Development

No branches or pull requests

4 participants