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

[WGSL] Variables initializer shouldn't be a reference #14584

Commits on Jun 5, 2023

  1. [WGSL] Variables initializer shouldn't be a reference

    https://bugs.webkit.org/show_bug.cgi?id=257601
    rdar://110105334
    
    Reviewed by Mike Wyrzykowski.
    
    When initializing a variable, the value used to initialize it should be unpacked
    if it's a reference. E.g.:
    
    var a = 0;
    var b = a;
    b = 1;
    
    The above program should not change the value of `a`, and references to `b` should
    have type `ref<i32>`, not `ref<ref<i32>>`. In order to fix that, when we infer the
    type of a variable initializer (which doesn't have an explicit type annotation), if
    the is a reference (as it would be for `a` in the example above, which would have type
    `ref<i32>`), we should use the referenced type instead (i.e. `i32` in this example)
    
    * Source/WebGPU/WGSL/TypeCheck.cpp:
    (WGSL::TypeChecker::visitVariable):
    
    Canonical link: https://commits.webkit.org/264860@main
    tadeuzagallo committed Jun 5, 2023
    Configuration menu
    Copy the full SHA
    e90fdfd View commit details
    Browse the repository at this point in the history