What does navigator.gpu.requestAdapter() return in the WebGPU API?
GPUAdapter: the adapter represents available GPU hardware (or software fallback). You inspect its features and limits, then call adapter.requestDevice({ requiredFeatures: [...] }) to get the GPUDevice you actually use for all GPU operations.
2 / 5
What is WGSL in the context of WebGPU?
WGSL: designed alongside the WebGPU spec, WGSL has explicit address spaces, no implicit type conversions, and no undefined behaviour. @vertex fn vs_main(@builtin(vertex_index) vi: u32) -> @builtin(position) vec4f { ... } is a typical vertex shader entry point.
3 / 5
What is a GPURenderPipeline and what does it configure?
GPURenderPipeline: unlike WebGL where state is global and mutable, WebGPU pipelines are created once and are immutable. This allows the driver to fully compile and optimise the shader program and state combination upfront, avoiding expensive state validation during rendering.
4 / 5
How does a WebGPU compute shader differ from a vertex/fragment shader?
Compute shader: you dispatch compute work with pass.dispatchWorkgroups(x, y, z). Each invocation has a global and local ID. Workgroup shared memory (var<workgroup>) enables efficient inter-thread communication within a group, critical for algorithms like reduction or convolution.
5 / 5
What is a GPUBindGroup in WebGPU?
GPUBindGroup: shaders declare resource bindings with @group(0) @binding(0) var<uniform> params: Params. You create a GPUBindGroup that maps actual GPU buffers/textures to those slots, then call pass.setBindGroup(0, bindGroup). Separating layout from data allows efficient rebinding with pre-compiled pipelines.