mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Merge #800
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:
@@ -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