3 ms·
--- [[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> { return vec4<f32>(0.4, 0.4, 0.8, 1.0); } --- That is very ugly and full of noise, c'mo
by Shadonototro 5y ago
---
[[stage(fragment)]]
fn main() -> [[location(0)]] vec4<f32> {
return vec4<f32>(0.4, 0.4, 0.8, 1.0);
}
---
That is very ugly and full of noise, c'mon people, that's one thing to like rust, but let's not import its ugly and noisy cluttered syntax..., it took me few seconds to understand what's going on there
---
var<private> x: f32;
---
let's not confuse things even more, we have vec4<f32> already, C'MON PEOPLE
- kvark 5y agoThis is very similar to what you'd write in HLSL, except maybe for `[[stage(fragment)]]` part (since this information is provided externally in HLSL) and `vec4<f32>` instead of `float4`. Are these the only things you are concerned about? If so, then I'd be happy with this, given that it's an artificial example.
- bschwindHN 5y agoIt's really not that bad. I had some complaints about WGSL a few months ago but it was surprising how quickly it improved. Here are some simple real-world shaders you can look at: https://github.com/bschwind/simple-game/tree/9de179085a04dd42c76bc3c39f88a54b1ba2b71f/src/graphics/shaders/wgsl https://github.com/bschwind/simple-game/tree/9de179085a04dd4... If you combine it with a quick build step to give you shader compilation errors before your program runs, it becomes a pretty nice shading language. There are still a few rough edges but it's not _that_ bad to work with.