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

read-only storage binding in VS results in scary warning in MSL #1761

Closed
kyren opened this issue Mar 6, 2022 · 0 comments · Fixed by #1763
Closed

read-only storage binding in VS results in scary warning in MSL #1761

kyren opened this issue Mar 6, 2022 · 0 comments · Fixed by #1763
Assignees
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: Metal Metal Shading Language

Comments

@kyren
Copy link

kyren commented Mar 6, 2022

I have a binding like this in a WGSL shader

@group(0) @binding(1) var<storage,read> particle_buffer: ParticleBufferReadonly;

when translated to MSL, it becomes this parameter to vs_main:

, device ParticleBufferReadonly& particle_buffer [[buffer(1)]]

which then results in this scary warning:

    program_source:277:22: warning: writable resources in non-void vertex function
    vertex vs_mainOutput vs_main(
                         ^
    program_source:282:34: note: writable buffer defined here
    , device ParticleBufferReadonly& particle_buffer [[buffer(1)]]
                                     ^

This seems related to this PR #1711

If I revert the part of the PR that changes the function to_msl_name back to:

            Self::Storage { access } if access.contains(crate::StorageAccess::STORE) => {
                Some("device")
            }
            Self::Storage { .. } => Some("constant"),

then the parameter to the vs_main function becomes:

, constant ParticleBufferReadonly& particle_buffer [[buffer(1)]]

and the warning disappears.

I'm not sure if the warning has an actual negative effect or not, it doesn't seem to yet but I'm still fixing other problems. I only noticed this because the shader was failing MSL compilation for a different reason.

@kyren kyren changed the title MSL read-only storage binding results in scary warning in VS read-only storage binding in VS results in scary warning in MSL Mar 6, 2022
@kvark kvark added area: back-end Outputs of shader conversion kind: bug Something isn't working lang: Metal Metal Shading Language labels Mar 6, 2022
@kvark kvark self-assigned this Mar 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: Metal Metal Shading Language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants