Closed rajveermalviya closed 1 year ago
This seems like a pretty good direction, anything not commented on looks good!
Why is FifoRelaxed
in AutoVsync
? It can result in visible tearing in some cases, is that ok? Can we guarantee Fifo
is always supported?
Why do we need all these various alpha modes? Are any guaranteed to be present?
+1 for ColorSpaces, they could be used in other places like helper functions to implement importExternalTexture and copyEI2T. In general for higher level language bindings it would be nice if most things could have default values. (except present mode, format and width/height?). Keeping Configure still makes sense as it removes a reference to the WGPUDevice
and lets the CPU allocation be freed in some cases. (similar reason to why we have this in JS).
Why do we have an errorMsg? Can't this use the regular facilities for errors on the WGPUDevice? Also the FreeMembers would depend on the resolution to that.
Why not use a ChainedStructOut
and a FreeMembers
method? It seems likely that we are going to add things to this structure over time. IMHO we could have a duplicate method for GetPreferredFormat
just to match JS.
Why is FifoRelaxed in AutoVsync? It can result in visible tearing in some cases, is that ok?
Up for debate
Can we guarantee Fifo is always supported?
Why do we need all these various alpha modes?
It matches VkCompositeAlphaFlagBitsKHR.
Are any guaranteed to be present?
No, hence Auto
; it will choose between Opaque & Inherit, whichever is available. (adding this info in proposal)
Vulkan on Android only advertises Inherit
Why do we have an errorMsg? Can't this use the regular facilities for errors on the WGPUDevice? Also the FreeMembers would depend on the resolution to that.
Re:Question: What do you think about the alternative API proposed in that section, it's much simpler and removes the struct?
Why not use a ChainedStructOut and a FreeMembers method?
Yeah, I wanted to keep the API simpler (one shot). Guess we should use FreeMembers there to keep things consistent. (updating the proposal).
Re:Question: What do you think about the alternative API proposed in that section, it's much simpler and removes the struct?
Maybe it could be a return enum with also SurfaceLost
and DeviceLost
, but that would work!
Why do we have an errorMsg? Can't this use the regular facilities for errors on the WGPUDevice? Also the FreeMembers would depend on the resolution to that.
Re:Question: What do you think about the alternative API proposed in that section, it's much simpler and removes the struct?
I think we liked the pattern we described here for GetMappedRange: https://github.com/webgpu-native/webgpu-headers/issues/143#issuecomment-1612208345 So maybe same for GetCurrentTexture?
There was a lot of discussion on this today so I'll paste the raw meeting notes (not totally complete but should have captured the important stuff):
(updated the proposal)
Looks good so far! Filed #200 for color spaces.
I think the big thing left to discuss is alpha modes. We might want to split that one to a new issue as well, if we don't find the answers yet.
Updated the proposal and #203 incorporates changes in the header.
Context
Currently the WGPUSwapChain API diverts from the js spec; this proposal tries to match the js spec while also maintaining the functionality that is required in the native context.
Keep in mind this proposal is mostly what
wgpu-rs
already exposes so it tries to match it.Update present mode enum to add automatic modes
Remove
WGPUSwapChain
(and merge it's interface into Surface api)In the js spec this was done a while ago. Fixes: https://github.com/webgpu-native/webgpu-headers/issues/88
Provide current
Texture
instead ofTextureView
Fixes: https://github.com/webgpu-native/webgpu-headers/issues/89
Provide a way to query information about the surface
Note:
wgpuSurfaceGetCapabilities
could replace currentwgpuSurfaceGetPreferredFormat
by guaranteeing that first format is the preferred one. But removingwgpuSurfaceGetPreferredFormat
will divert from js spec.Move Present function to Surface
open discussion: presentation extensions
frame pacing & damage support ref: https://github.com/gfx-rs/wgpu/issues/2869