Rust-GPU / Rust-GPU/rust-gpu

Fragment shader can be silently compiled out

Open
#284 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This works fine:

#[spirv(fragment)]
pub fn main_fs(
    in_color: Vec3,
    out_frag_color: &mut Vec4,
) {
    *out_frag_color = vec4(in_color.x, in_color.y, in_color.z, 1.0);
}

This silently does not output a fragment shader:

#[spirv(fragment)]
pub fn main_fs(
    in_color: Vec3,
    out_frag_color: &mut Vec4,
) {
    out_frag_color.x = in_color.x;
    out_frag_color.y = in_color.y;
    out_frag_color.z = in_color.z;
}

Rather than failing silently, it should probably be an error when an entire shader is dead code / compiled out and does not produce an artifact.

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 by compiling the two Rust fragment-shader examples from the issue and compare their outputs. Trace the compiler path for a shader that produces no artifact, then determine where an error should be reported. Done means the second example fails explicitly instead of being silently compiled out, while the first continues to produce a fragment shader.

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.