Skip to content

Commit

Permalink
fix: potential fix for view_texture error on older hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
ElhamAryanpur committed Jun 7, 2024
1 parent 5f3f232 commit 4762fbd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 4 additions & 3 deletions examples/dev/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ use blue_engine::{

fn main() {
let mut engine = Engine::new_config(blue_engine::WindowDescriptor {
power_preference: blue_engine::PowerPreference::LowPower,
power_preference: blue_engine::PowerPreference::None,
present_mode: blue_engine::wgpu::PresentMode::Mailbox,
limits: blue_engine::wgpu::Limits::downlevel_defaults(),
..Default::default()
})
.expect("win");
Expand All @@ -31,7 +32,7 @@ fn main() {
.renderer
.build_texture(
"background",
TextureData::Path("resources/player.png".to_string()),
TextureData::Path("resources/BlueLogoDiscord.png".to_string()),
blue_engine::TextureMode::Clamp,
)
.unwrap();
Expand All @@ -40,7 +41,7 @@ fn main() {
.renderer
.build_texture(
"background",
TextureData::Path("resources/image.png".to_string()),
TextureData::Path("resources/BlueLogoDiscord.png".to_string()),
blue_engine::TextureMode::Clamp,
)
.unwrap();
Expand Down
9 changes: 1 addition & 8 deletions src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,6 @@ impl crate::header::Renderer {
TextureMode::MirrorRepeat => mode = wgpu::AddressMode::ClampToEdge,
}

/*let img_format = match texture_format {
TextureFormat::PNG => image::ImageFormat::Png,
TextureFormat::BMP => image::ImageFormat::Bmp,
TextureFormat::JPEG => image::ImageFormat::Jpeg,
TextureFormat::PNM => image::ImageFormat::Pnm,
};*/

let img = match texture_data {
TextureData::Bytes(data) => image::load_from_memory(data.as_slice())
.expect(format!("Couldn't Load Image For Texture Of {}", name.as_str()).as_str()),
Expand Down Expand Up @@ -159,7 +152,7 @@ impl crate::header::Renderer {
| wgpu::TextureUsages::COPY_DST
| wgpu::TextureUsages::COPY_SRC
| wgpu::TextureUsages::RENDER_ATTACHMENT,
view_formats: &[wgpu::TextureFormat::Rgba8Unorm],
view_formats: &[],
});

self.queue.write_texture(
Expand Down

0 comments on commit 4762fbd

Please sign in to comment.