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

Is wgpuSurfaceGetPreferredFormat redundant with WGPUSurfaceCapabilities.formats[0]? #290

Open
kainino0x opened this issue May 15, 2024 · 3 comments
Labels
has resolution Issue is resolved, just needs to be done needs docs Non-trivial API contract needs to be documented. Orthogonal to open vs closed; remove when doc'd. presentation Presenting images to surfaces like windows and canvases

Comments

@kainino0x
Copy link
Collaborator

Since @beaufortfrancois is trying to port some samples, I realized we probably should list the preferred format as formats[0]. Otherwise it's not obvious that formats[0] might give you the wrong format and you need to call GetPreferredFormat instead.

GetPreferredFormat is already planned to become extensible (#216) so it can take extra options into account unlike formats[0], but in the near term it won't actually have any extra options, so maybe there's no reason to have it at all yet. We can add the function once it actually has extra options.

@kainino0x kainino0x added agenda Agenda for upcoming meetings presentation Presenting images to surfaces like windows and canvases labels May 15, 2024
@Kangz
Copy link
Collaborator

Kangz commented May 16, 2024

I'd definitely be in favor of removing it for now!

@kainino0x
Copy link
Collaborator Author

kainino0x commented May 23, 2024

After reviewing some code using this, I do think it's a little bit of a magic incantation to use formats[0] to get the preferred format. But probably not a big deal, compared with being redundant/unclear about how you should do things.

@kainino0x kainino0x removed the agenda Agenda for upcoming meetings label Jun 6, 2024
@kainino0x
Copy link
Collaborator Author

May 23 meeting (sorry for delay):

  • AE/KN: Both in favor of doing this
  • CF: me too
  • KN: eventually JS spec may have srgb, hdr, etc.
  • AE: Can you get this information by just filtering and looking for first match?
  • KN: Probably? If you filter to a format that you need, then the first one you get should be the preferred one? Could use this as a basic heuristic?
  • AE: What about WASM? Would we get only the JS-allowed format?
  • KN: Yea, but there’s 3 formats, so ordering would tell us what's the preferred one.
  • Remove wgpuSurfaceGetPreferredFormat, formats[0] is preferred.

@kainino0x kainino0x added the has resolution Issue is resolved, just needs to be done label Jun 6, 2024
@kainino0x kainino0x added the needs docs Non-trivial API contract needs to be documented. Orthogonal to open vs closed; remove when doc'd. label Jun 7, 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 needs docs Non-trivial API contract needs to be documented. Orthogonal to open vs closed; remove when doc'd. presentation Presenting images to surfaces like windows and canvases
Projects
None yet
Development

No branches or pull requests

2 participants