Skip to content

[naga] Built-in function database #6443

@jimblandy

Description

@jimblandy

To solve #5523, Naga needs information about built-in function argument and result types in a form that the WGSL front end can consume to apply WGSL automatic type conversions.

At the moment, builtins appear in Naga in the following places:

  • The IR has enums like BuiltIn and MathFunction.
  • The typifier module knows the result types.
  • The valid module knows the argument types.
  • The WGSL front end and backend both know the function names.

But automatic conversions apply anywhere that they would turn an ill-typed program into a well-typed program, so one needs argument type information to apply them.

Ideally, the first three should be brought together, and the last two should be unified.

It may be the case that we can keep the WGSL front end innocent of these things, and handle automatic conversions with a processing phase.

Metadata

Metadata

Assignees

Labels

kind: refactorMaking existing function faster or nicernagaShader Translatortype: enhancementNew feature or request

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions