add the preferred format query

This commit is contained in:
Dzmitry Malyshau committed 2020-07-16 11:27:05 -04:00
1 parent 71e853d6ce
commit 76e136e375
2 files changed
+13 -2

No files matched your search

+1 -1
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();
}
+12 -1
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>,