Interface GPUShaderModuleDescriptor
interface GPUShaderModuleDescriptor {
code: string;
compilationHints?: GPUShaderModuleCompilationHint[];
label?: string;
}
code: string;
compilationHints?: GPUShaderModuleCompilationHint[];
label?: string;
}
Hierarchy
- GPUObjectDescriptorBase
- GPUShaderModuleDescriptor (View Summary)
Index
Properties
Properties
code
code: string
Optional
compilationHints
A list of GPUShaderModuleCompilationHints. Any hint provided by an application should contain information about one entry point of a pipeline that will eventually be created from the entry point. Implementations should use any information present in the GPUShaderModuleCompilationHint to perform as much compilation as is possible within GPUDevice#createShaderModule. Aside from type-checking, these hints are not validated in any way.
Supplying information in GPUShaderModuleDescriptor#compilationHints does not have any
observable effect, other than performance. It may be detrimental to performance to
provide hints for pipelines that never end up being created.
Because a single shader module can hold multiple entry points, and multiple pipelines
can be created from a single shader module, it can be more performant for an
implementation to do as much compilation as possible once in
GPUDevice#createShaderModule rather than multiple times in the multiple calls to
() or GPUDevice#createRenderPipeline.
Hints are only applied to the entry points they explicitly name.
Unlike GPUProgrammableStage.entryPoint,
there is no default, even if only one entry point is present in the module.
Note:
Hints are not validated in an observable way, but user agents **may** surface identifiable
errors (like unknown entry point names or incompatible pipeline layouts) to developers,
for example in the browser developer console.Optional
label
label?: string
The initial value of GPUObjectBase.label.
The WGSL source code for the shader module.