-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorD-ShadersThis code uses GPU shader languagesThis code uses GPU shader languagesS-Needs-InvestigationThis issue requires detective work to figure out what's going wrongThis issue requires detective work to figure out what's going wrong
Description
Bevy version
0.16.0
What you did
I am using two wesl shaders, loaded as embedded assets in my library crate.
I register them for the asset server:
impl Plugin for RenderGraphPlugin {
fn build(&self, app: &mut bevy::app::App) {
embedded_asset!(app, "tesselate_pass.wesl");
embedded_asset!(app, "view.wesl");
std::mem::forget(
app.world_mut()
.resource_mut::<AssetServer>()
.load::<Shader>("embedded://my_plugin/render_graph/view.wesl"),
);
And within the tesselate shader I import the view shader
import super::view;
@group(0) @binding(0) var<uniform> v: view::View;
What went wrong
This panicked with the very unwelcoming message:
The application panicked (crashed).
Message: called `Result::unwrap()` on an `Err` value: ParseError { message: "expected `;`, found \":\"", labels: [(Span { start: 54, end: 55 }, "expected `;`")], notes: [] }
Location: /home/nionidh/projects/bevy-tomfoolery/bevy/crates/bevy_render/src/render_resource/pipeline_cache.rs:308
When looking at the compiled wesl sources, via a println!("{}", &compiled.to_string());
here:
bevy/crates/bevy_render/src/render_resource/pipeline_cache.rs
Lines 315 to 324 in f808216
let compiled = wesl::compile( | |
&module_path, | |
&shader_resolver, | |
&wesl::EscapeMangler, | |
&compiler_options, | |
) | |
.unwrap(); | |
let naga = naga::front::wgsl::parse_str(&compiled.to_string()).unwrap(); | |
ShaderSource::Naga(Cow::Owned(naga)) |
I can see that it's compiled to something like this:
@group(0) @binding(0)
var<uniform> v: package_embedded:__2my_plugin__1render_graph_view_View;
Which has a colon :
in the identifier part, and definitely is not valid wgsl.
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorD-ShadersThis code uses GPU shader languagesThis code uses GPU shader languagesS-Needs-InvestigationThis issue requires detective work to figure out what's going wrongThis issue requires detective work to figure out what's going wrong