diff --git a/player/src/main.rs b/player/src/main.rs index c5be023ee0..1a1823a7ad 100644 --- a/player/src/main.rs +++ b/player/src/main.rs @@ -199,7 +199,7 @@ impl GlobalExt for wgc::hub::Global { } A::GetSwapChainTexture { id, parent_id } => { if let Some(id) = id { - self.swap_chain_get_next_texture::(parent_id, id) + self.swap_chain_get_current_texture_view::(parent_id, id) .view_id .unwrap(); } diff --git a/wgpu-core/src/swap_chain.rs b/wgpu-core/src/swap_chain.rs index d201bd7228..5fc0665516 100644 --- a/wgpu-core/src/swap_chain.rs +++ b/wgpu-core/src/swap_chain.rs @@ -89,7 +89,18 @@ pub struct SwapChainOutput { } impl Global { - pub fn swap_chain_get_next_texture( + pub fn swap_chain_get_preferred_format( + &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( &self, swap_chain_id: SwapChainId, view_id_in: Input,