-
Notifications
You must be signed in to change notification settings - Fork 345
Description
Maybe this was already discussed but, as it is, you always have to specify entry points when creating a pipeline. After having written a bunch of WebGPU, it seems like it would be nice if there were some defaults.
In other words, these 2 lines
const pipeline = device.createRenderPipeline({
layout: 'auto',
vertex: {
module: shaderModule,
entryPoint: 'myVSMain', // <-------------------
},
fragment: {
module: shaderModule,
entryPoint: 'myFSMain', // <-------------------
...
},
});If there were a default "entryPoint" for each stage then these lines would not be needed and would make the api a tiny bit less tedious.
4 ideas
-
The defaults could be something like
vertexMain,fragmentMain,computeMain -
If the attribute is considered part of the name then just
mainIn other words,
@compute fn main(...)is different from@vertex main fn(...)because
of the attribute specifying what type of shader it is so if in createXXXPipeline you don't specify an entry point then it looks formainwith a correct attribute for the stage. -
The default is the first compatible function.
In this idea, using the attributes again
@computevs@fragmentvs@vertex. If no entryPoint is specified, find the first function that has the required attribute, the name is irrelevant. -
The default is the only compatible function
This idea is the same as # 3 except if there are 2 or more compatible functions you get an error "More than one compatible function. You must specify an entryPoint"
I know it's not a big deal. I just thought I ask.