EmbarkStudios / rust-gpu

🐉 Making Rust a first-class language and ecosystem for GPU shaders 🚧
https://shader.rs
Apache License 2.0
7.35k stars 245 forks source link

Reassigning to f64s doesn't work #850

Open Icelk opened 2 years ago

Icelk commented 2 years ago

Expected Behaviour

Reassigning to a variable should work, just as it does with f32s.

Example & Steps To Reproduce

Run the compute example (just used as it's already set up). Then, add the following lines to the shader code:

let mut test: f64 = 1.0;
test = 2.0;

You have to remove the #[deny(warnings)] at the top.

The shader will fail to compile. This also applies to when the value is read.

System Info

Compiler error

```rust error: f64 without OpCapability Float64 --> /home/icelk/.rustup/toolchains/nightly-2022-01-13-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/f64.rs:451:5 | 451 | pub(crate) const fn abs_private(self) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: Stack: main_cs error: No OpEntryPoint instruction was found. This is only allowed if the Linkage capability is being used. | = note: module `/home/icelk/dev/Rust/fractal-renderer/target/spirv-unknown-vulkan1.1/release/deps/compute_shader.spv.dir/module` warning: an unknown error occurred | = note: spirv-opt failed, leaving as unoptimized = note: module `/home/icelk/dev/Rust/fractal-renderer/target/spirv-unknown-vulkan1.1/release/deps/compute_shader.spv.dir/module` error: error:0:0 - No OpEntryPoint instruction was found. This is only allowed if the Linkage capability is being used. | = note: spirv-val failed = note: module `/home/icelk/dev/Rust/fractal-renderer/target/spirv-unknown-vulkan1.1/release/deps/compute_shader.spv.dir/module` warning: `compute-shader` (lib) generated 1 warning error: could not compile `compute-shader` due to 3 previous errors; 1 warning emitted ```
repi commented 2 years ago

thanks for reporting!

talked to @oisyn which will try and repo and see can get this, sounded like the float64 capability was not enabled