Rust-GPU / Rust-GPU/rust-gpu

[Migrated] Reassigning to f64s doesn't work

Open
#114 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/850
Old labels: t: bug,s: needs update
Originally creatd by Icelk on 2022-02-10T20:34:17Z


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

  • Rust: nightly-2022-01-13
  • OS: Arch Linux
  • GPU: Nvidia 1060
  • SPIR-V: no clue, but using latest commit from this repo to build

Compiler error

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the compute example and reproduce the f64 reassignment and read using the lines in the issue. Trace the resulting compiler output and SPIR-V validation errors, then verify that the example compiles without the Float64 and missing-entry-point errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.