rust_minifb
rust_minifb copied to clipboard
Window always renders white on Windows 11 in release build.
I appreciate this may not be an issue with minifb (Windows versions, Graphics driver versions) - but its pretty much my only dependency.
Everything displays correctly in debug builds. Same code works fine in both release & debug on M1 mac.
Any of the examples exhibit this.
Main things I can think of that may impact?
rustc 1.79.0-nightly (ccfcd950b 2024-04-15)
Nvidia 3080, game ready driver 552.22 (april 16 2024)
Edition Windows 11 Pro Version 23H2 Installed on 06/10/2022 OS build 22631.3447 Experience Windows Feature Experience Pack 1000.22688.1000.0
I had a small application that was fine from 1 month ago, no changes in code (probably a windows update and a rustup update).
I would recommend that you try to clone the rust_minifb
repo and run one of the examples and see if these works. Such as cargo run --release --example noise
and see if it still shows up while or not if you switch between --release
and not including it.
Repro
use minifb::*;
const WIDTH: usize = 320;
const HEIGHT: usize = 240;
fn create_window() -> minifb::Window {
minifb::Window::new(
"App",
WIDTH,
HEIGHT,
WindowOptions {
scale: Scale::X4,
transparency: false,
..WindowOptions::default()
},
)
.unwrap_or_else(|e| {
panic!("{}", e);
})
}
fn update_buffers(window: &mut minifb::Window, buffer: &[u32]) {
window.update_with_buffer(&buffer, WIDTH, HEIGHT).unwrap();
}
fn main() {
let mut window = create_window();
let mut buffer: Vec<u32> = vec![0; WIDTH * HEIGHT];
while window.is_open() && !window.is_key_down(Key::Escape) {
for i in 0..WIDTH * HEIGHT {
buffer[i] = 0xff000000;
}
update_buffers(&mut window, &buffer);
}
}
In Release
In Debug
I would recommend that you try to clone the
rust_minifb
repo and run one of the examples and see if these works. Such ascargo run --release --example noise
and see if it still shows up while or not if you switch between--release
and not including it.
Interestingly this works.
Also interestingly however is that the version in master
(cargo toml 0.25) doesnt match the released version (also 0.25) (ie missing window.set_target_fps(60);
)
Could it be fixed since the latest published to crates.io?
I can confirm that adding
minifb = { git = "https://github.com/emoon/rust_minifb.git", rev = "633e6cd4f8f55fd9cbedc461976dde0f408bea35" }
as my dependency everything renders fine
Unsure, I can make a new release later today.
No rush on my account - its good to know its fixed and I'm unblocked by specifying the revision.
Thanks for such an awesome project :)
Thanks :)
Just saw this issue - now that Rust 1.78 is live, we're also seeing the problem on stable. We'll also pin to the git version as well until a new release is up, but leaving a note here in case other users are encountering the same problem.
Some function is also deprecated in the new release -- so the switch over isn't exactly clean, but, I'll also check in the code change to comply to the deprecation notice as well when I rev things.
I wonder what changed from 1.77 to 1.78 that made this happen?
I will sort out a new release today
I wonder what changed from 1.77 to 1.78 that made this happen?
A couple changes specifically impacting windows: https://github.com/rust-lang/rust/pull/115141/ or this https://github.com/rust-lang/rust/pull/112267/
Nothing leaps out at me as the culprit, there were also some changes to locking that maybe introduced a race condition? Either way, top of main branch works.
Thanks @emoon for the support!
0.26 has now been published
thank you ~~~