-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error printed every frame in some GPUs #9
Comments
Merged
bevyengine/bevy#9975 looks relevant. use bevy::prelude::*;
use bevy::render::settings::Backends;
use bevy::render::settings::RenderCreation;
use bevy::render::settings::WgpuSettings;
use bevy::render::RenderPlugin;
use bevy_pixel_buffer::prelude::*;
#[derive(Deref, DerefMut, Resource)]
struct ResizeTimer(Timer);
fn main() {
let size = PixelBufferSize {
size: UVec2::new(32, 32),
pixel_size: UVec2::new(16, 16),
};
App::new()
.add_plugins((
DefaultPlugins.set(RenderPlugin {
render_creation: RenderCreation::Automatic(WgpuSettings {
backends: Some(Backends::VULKAN),
..default()
}),
}),
PixelBufferPlugin,
))
.add_systems(Startup, PixelBufferBuilder::new().with_size(size).setup())
// Resize applies at the beginning of next frame, update the image and
// prepare the resize for the next frame
.add_systems(Update, (update, resize).chain())
.insert_resource(ResizeTimer(Timer::from_seconds(2.0, TimerMode::Repeating)))
.run()
}
// update pixels when pixel buffer changes
fn update(image: Query<&Handle<Image>, Changed<PixelBuffer>>, mut images: ResMut<Assets<Image>>) {
if let Ok(image) = image.get_single() {
Frame::extract(&mut images, image).per_pixel(|_, _| Pixel::random());
}
}
fn resize(
time: Res<Time>,
mut timer: ResMut<ResizeTimer>,
mut pb: Query<&mut PixelBuffer>,
mut toggle: Local<bool>,
) {
timer.tick(time.delta());
if timer.finished() {
let mut pb = pb.single_mut();
pb.size = if *toggle {
PixelBufferSize {
size: UVec2::new(32, 32),
pixel_size: UVec2::new(16, 16),
}
} else {
PixelBufferSize {
size: UVec2::new(16, 16),
pixel_size: UVec2::new(32, 32),
}
};
*toggle = !*toggle;
}
} |
Yep, it's that wgpu issue and that fixes it. Thanks again 😊 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe something with resize and or texture size? It happens in in (at least some) AMD GPUs
The text was updated successfully, but these errors were encountered: