GPUPipelineError
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
Note: This feature is available inWeb Workers.
TheGPUPipelineError
interface of theWebGPU API describes a pipeline failure. This is the value received when aPromise
returned by aGPUDevice.createComputePipelineAsync()
orGPUDevice.createRenderPipelineAsync()
call rejects.
In this article
Constructor
GPUPipelineError()
Creates a new
GPUPipelineError
object instance.
Instance properties
Inherits properties from its parent,DOMException
.
reason
Read onlyAn enumerated value that defines the reason the pipeline creation failed in a machine-readable way.
Examples
In the following snippet we are attempting to create aGPUComputePipeline
usingGPUDevice.createComputePipelineAsync()
. However, we have misspelt our compute pipelineentryPoint
as"maijn"
(it should be"main"
), therefore pipeline creation fails, and ourcatch
block prints the resulting reason and error message to the console.
// …let computePipeline;try { computePipeline = await device.createComputePipelineAsync({ layout: device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout], }), compute: { module: shaderModule, entryPoint: "maijn", }, });} catch (error) { // error is a GPUPipelineError object instance console.error(error.reason); console.error(`Pipeline creation failed: ${error.message}`);}// …
In this case, the givenreason
is"Validation"
, and themessage
is"Entry point "maijn" doesn't exist in the shader module [ShaderModule]."
Specifications
Specification |
---|
WebGPU> # gpupipelineerror> |
Browser compatibility
Loading…