800: Add the preferred format query r=cwfitzgerald a=kvark

Just getting us synced up to the spec naming and API for the swapchains...

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
This commit is contained in:
bors[bot]
2020-07-16 19:59:10 +00:00
committed by GitHub
2 changed files with 13 additions and 2 deletions

View File

@@ -199,7 +199,7 @@ impl GlobalExt for wgc::hub::Global<IdentityPassThroughFactory> {
}
A::GetSwapChainTexture { id, parent_id } => {
if let Some(id) = id {
self.swap_chain_get_next_texture::<B>(parent_id, id)
self.swap_chain_get_current_texture_view::<B>(parent_id, id)
.view_id
.unwrap();
}

View File

@@ -89,7 +89,18 @@ pub struct SwapChainOutput {
}
impl<G: GlobalIdentityHandlerFactory> Global<G> {
pub fn swap_chain_get_next_texture<B: GfxBackend>(
pub fn swap_chain_get_preferred_format<B: GfxBackend>(
&self,
_swap_chain_id: SwapChainId,
) -> wgt::TextureFormat {
span!(_guard, INFO, "SwapChain::get_next_texture");
//TODO: we can query the formats like done in `device_create_swapchain`,
// but its not clear which format in the list to return.
// For now, return `Bgra8UnormSrgb` that we know is supported everywhere.
wgt::TextureFormat::Bgra8UnormSrgb
}
pub fn swap_chain_get_current_texture_view<B: GfxBackend>(
&self,
swap_chain_id: SwapChainId,
view_id_in: Input<G, TextureViewId>,