Add default for texture format (#675)
This commit is contained in:
parent
fccfa12d3b
commit
7ba45849f3
@ -34,7 +34,7 @@ pub(crate) fn build_forward_pipeline(shaders: &mut Assets<Shader>) -> PipelineDe
|
||||
},
|
||||
}),
|
||||
color_states: vec![ColorStateDescriptor {
|
||||
format: TextureFormat::Bgra8UnormSrgb,
|
||||
format: TextureFormat::default(),
|
||||
color_blend: BlendDescriptor {
|
||||
src_factor: BlendFactor::SrcAlpha,
|
||||
dst_factor: BlendFactor::OneMinusSrcAlpha,
|
||||
|
@ -91,7 +91,7 @@ impl PipelineDescriptor {
|
||||
},
|
||||
}),
|
||||
color_states: vec![ColorStateDescriptor {
|
||||
format: TextureFormat::Bgra8UnormSrgb,
|
||||
format: TextureFormat::default(),
|
||||
color_blend: BlendDescriptor {
|
||||
src_factor: BlendFactor::SrcAlpha,
|
||||
dst_factor: BlendFactor::OneMinusSrcAlpha,
|
||||
|
@ -209,7 +209,7 @@ impl BaseRenderGraphBuilder for RenderGraph {
|
||||
mip_level_count: 1,
|
||||
sample_count: msaa.samples,
|
||||
dimension: TextureDimension::D2,
|
||||
format: TextureFormat::Bgra8UnormSrgb,
|
||||
format: TextureFormat::default(),
|
||||
usage: TextureUsage::OUTPUT_ATTACHMENT,
|
||||
},
|
||||
),
|
||||
|
@ -206,6 +206,17 @@ impl TextureFormat {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TextureFormat {
|
||||
fn default() -> Self {
|
||||
if cfg!(target_os = "android") {
|
||||
// Bgra8UnormSrgb texture missing on some Android devices
|
||||
TextureFormat::Rgba8UnormSrgb
|
||||
} else {
|
||||
TextureFormat::Bgra8UnormSrgb
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
#[repr(transparent)]
|
||||
pub struct TextureUsage: u32 {
|
||||
|
@ -40,7 +40,7 @@ pub fn build_sprite_sheet_pipeline(shaders: &mut Assets<Shader>) -> PipelineDesc
|
||||
},
|
||||
}),
|
||||
color_states: vec![ColorStateDescriptor {
|
||||
format: TextureFormat::Bgra8UnormSrgb,
|
||||
format: TextureFormat::default(),
|
||||
color_blend: BlendDescriptor {
|
||||
src_factor: BlendFactor::SrcAlpha,
|
||||
dst_factor: BlendFactor::OneMinusSrcAlpha,
|
||||
@ -88,7 +88,7 @@ pub fn build_sprite_pipeline(shaders: &mut Assets<Shader>) -> PipelineDescriptor
|
||||
},
|
||||
}),
|
||||
color_states: vec![ColorStateDescriptor {
|
||||
format: TextureFormat::Bgra8UnormSrgb,
|
||||
format: TextureFormat::default(),
|
||||
color_blend: BlendDescriptor {
|
||||
src_factor: BlendFactor::SrcAlpha,
|
||||
dst_factor: BlendFactor::OneMinusSrcAlpha,
|
||||
|
@ -42,7 +42,7 @@ pub fn build_ui_pipeline(shaders: &mut Assets<Shader>) -> PipelineDescriptor {
|
||||
},
|
||||
}),
|
||||
color_states: vec![ColorStateDescriptor {
|
||||
format: TextureFormat::Bgra8UnormSrgb,
|
||||
format: TextureFormat::default(),
|
||||
color_blend: BlendDescriptor {
|
||||
src_factor: BlendFactor::SrcAlpha,
|
||||
dst_factor: BlendFactor::OneMinusSrcAlpha,
|
||||
|
@ -562,7 +562,7 @@ impl WgpuFrom<&Window> for wgpu::SwapChainDescriptor {
|
||||
fn from(window: &Window) -> Self {
|
||||
wgpu::SwapChainDescriptor {
|
||||
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
|
||||
format: wgpu::TextureFormat::Bgra8UnormSrgb,
|
||||
format: TextureFormat::default().wgpu_into(),
|
||||
width: window.width(),
|
||||
height: window.height(),
|
||||
present_mode: if window.vsync() {
|
||||
|
@ -134,7 +134,7 @@ fn setup(
|
||||
mip_level_count: 1,
|
||||
sample_count: msaa.samples,
|
||||
dimension: TextureDimension::D2,
|
||||
format: TextureFormat::Bgra8UnormSrgb,
|
||||
format: TextureFormat::default(),
|
||||
usage: TextureUsage::OUTPUT_ATTACHMENT,
|
||||
},
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user