Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naga error points to strange position in code for textureStore error messsage #6783

Open
EriKWDev opened this issue Dec 18, 2024 · 1 comment · May be fixed by #6791
Open

Naga error points to strange position in code for textureStore error messsage #6783

EriKWDev opened this issue Dec 18, 2024 · 1 comment · May be fixed by #6791
Assignees
Labels
kind: diagnostics Error message should be better naga Shader Translator

Comments

@EriKWDev
Copy link

from gfx-rs/naga#2089 (comment)

.. similar just happened me in naga v23.0.0 but with local variables, the error messsage points to min_d declaration, or rather strangely the first min function but gives no context to textureStore call

var input_texture: texture_depth_2d;
var input_sampler: sampler;
var output_texture: texture_storage_2d<r32float,write>;

// ..

    let d: vec4<f32> = textureGather(input_texture, input_sampler, uv);
    let min_d = min(min(d[0], d[1]), min(d[2], d[3]));
    // textureStore(output_texture, pixel, vec4(min_d, 0.0, 0.0, 0.0)); // correct
    textureStore(output_texture, pixel, min_d);

error:

error:
   ┌─ :26:17
   
26 │     let min_d = min(min(d[0], d[1]), min(d[2], d[3]));
   │                 ^^^ naga::Expression [23]

Entry point depth_downsample_main at Compute is invalid:
        The value [23] can not be stored
@cwfitzgerald cwfitzgerald added naga Shader Translator kind: diagnostics Error message should be better labels Dec 19, 2024
@ErichDonGubler
Copy link
Member

ErichDonGubler commented Dec 19, 2024

I know why this is because, funnily enough, I was getting irritated with this same issue yesterday. For some reason, we narrow the span associated with expression errors in function calls to the callee identifier.

I'll put up a PR for this today.

@ErichDonGubler ErichDonGubler self-assigned this Dec 19, 2024
@ErichDonGubler ErichDonGubler moved this from Todo to In Progress in WebGPU for Firefox Dec 19, 2024
@ErichDonGubler ErichDonGubler linked a pull request Dec 19, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: diagnostics Error message should be better naga Shader Translator
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants