-
Here is a super minimal example: use bevy::math::Vec3;
use bevy::prelude::Trigger;
use bevy::render::gpu_readback::ReadbackComplete;
fn readback_complete_compilation_issue(trigger: Trigger<ReadbackComplete>) {
let readback_result: Vec<Vec3> = trigger.event()
.to_shader_type(); // Error: Trait `VectorScalar` is not implemented for `f32`
} However, if I add this seemingly unrelated line: use bevy::math::{vec3, Vec3};
use bevy::prelude::Trigger;
use bevy::render::gpu_readback::ReadbackComplete;
use bevy::render::storage::ShaderStorageBuffer;
fn readback_complete_compilation_issue(trigger: Trigger<ReadbackComplete>) {
let _ = ShaderStorageBuffer::from(vec![vec3(0.0, 0.0, 0.0)]);
let readback_result: Vec<Vec3> = trigger.event()
.to_shader_type(); // Now compiles fine!
} even if this line is never actually reached: if false {
let _ = ShaderStorageBuffer::from(vec![vec3(0.0, 0.0, 0.0)]);
} My guess is this has something to do with how Is there any way to resolve this compilation error without the extra line? 🙏 (this is bevy version 0.16.1 btw) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I don't see how that extra line can affect your problem. The first block of code with an empty |
Beta Was this translation helpful? Give feedback.
I don't see how that extra line can affect your problem. The first block of code with an empty
main
function compiles without errors on my machine with Bevy 0.16.1.