Skip to content

Simpler methods #917

@ottoville

Description

@ottoville

To create a compute pipeline, one must write:

const pipeline = device.createComputePipeline({
            layout: shaderLayout,
            computeStage: {
                module: shaderModule,
                entryPoint: 'main'
            }
        })

As there are no more properties in GPUComputePipelineDescriptor interface than in example above, I made a shortcut method under GPUDevice class in my project for creating a compute pipeline.

createComputePipeline(GPUShaderModule, entryPoint = 'main', GPUPipelineLayout?) : GPUComputePipeLine

The shortcut covers 100% of all usage cases. Layout is an optional because one could use "getBindGroupLayout" method to infer the bind group layout from the shader module. EntryPoint defaults to 'main' so its also optional.

So the question is, should the creation of compute pipeline not be in line with pipelines that produces graphic output, as they share no common parameters.

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