这几天在学习wgpu,有一点比较困惑。当我浏览 wgpu 示例(https://github.com/gfx-rs/wgpu/tree/master/wgpu/examples)时,他们对其着色器使用以下语法:
struct VertexOutput {
@location(0) color: vec4<f32>,
@builtin(position) position: vec4<f32>,
}
Run Code Online (Sandbox Code Playgroud)
但我必须像这样编写我的着色器:
struct VertexOutput {
[[location(0)]] color: vec4<f32>;
[[builtin(position)]] position: vec4<f32>;
};
Run Code Online (Sandbox Code Playgroud)
@比起语法,我更喜欢[[]]语法。我的猜测是,这是我需要在 Cargo.toml 中启用的功能,但我无法找出这是什么功能。因此,如果有人能告诉我如何@在我的 wgsl 着色器中使用语法,我将不胜感激。