mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 06:21:13 +01:00
add the preferred format query
This commit is contained in:
1 parent
71e853d6ce
commit
76e136e375
2 files changed
+13
-2
No files matched your search
+1
-1
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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>,
|
||||
|
||||
Reference in new issue
Block a user