Skip to content

naga support #99

@stefnotch

Description

@stefnotch

Eventually, we might need proper support from naga to be able to handle all WGSL constructs. (The hard alternative is rolling our own parser.)

Currently, naga_oil generates headers and uses them to compile modules individually.

However, generating WGSL headers breaks down when they include a predeclared type which gets redefined.

For example, a simple header could be

// foo.wgsl
alias LightValue = f32;
fn light() -> LightValue { return 1.0f; }

Then, if we parse code like this, it leads to an issue

// main.wgsl
#import foo::{light};

// Affects the header
alias f32 = f64;

I believe that this is very hard to fix under the current model. We currently generate WGSL code for headers, and then pass the whole code to naga.

If WGSL were slightly more expressive, then this would also no longer be an issue. For example gpuweb/gpuweb#4308 would let us fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions