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

Compile error when function declare after '@compute @workgroup_size' #2073

Closed
haoyunfeix opened this issue Sep 30, 2022 · 2 comments
Closed

Comments

@haoyunfeix
Copy link

Failed shader:

  @compute @workgroup_size(256, 1, 1)
        fn A(index : i32)
       {
        }
        fn main(@builtin(local_invocation_id) LocalId : vec3<u32>,
                  @builtin(global_invocation_id) GlobalId : vec3<u32>,
                  @builtin(num_workgroups) NumWorkgroups : vec3<u32>) {
          var localId = LocalId;
          var globalId = GlobalId;
          var numWorkgroups = NumWorkgroups;
          A(getGlobalIndex());

naga output:

$ naga after.wgsl
error: unknown local function `A`
   鈹屸攢 after.wgsl:11:11
   ?[0m
11 ?[0m           A(getGlobalIndex());
   ?[0m           ^ unknown local function

Could not parse WGSL

This could be fixed after moved A() declaration before @compute @workgroup_size(256, 1, 1)

@haoyunfeix
Copy link
Author

Dup with #2072

@vicary
Copy link

vicary commented Sep 30, 2022

Thanks @haoyunfeix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants