CONCEPT Cited by 1 source
Explicit graphics state¶
Explicit graphics state is an API-design choice where every
draw call specifies the full state it needs — vertex buffers,
textures, materials, pipeline, bind groups — as explicit
arguments, rather than expecting state to persist globally from
prior bindX() calls.
WebGPU chose explicit state; WebGL (and OpenGL before it) used implicit (global) state.
The bug class implicit state enables¶
With implicit state, code like:
context->bindVertexBuffer(vertexBuffer, ...);
context->bindTextureUniform(texture, ...);
context->bindMaterial(material, ...);
context->bindFramebuffer(framebuffer, ...);
context->draw();
leaves the bound resources alive until overwritten. The next
draw() call uses whichever resources happen to be bound — which
may or may not be the ones the author intended. Forgetting to
rebind one input before a later draw() is a silent correctness
bug, not a crash or an error.
Switch to explicit state:
Now every draw's inputs are arguments. Omitting one is a compile error. The class of "I forgot to rebind" bugs disappears.
Generalization beyond graphics¶
The same API-design principle shows up across other substrates:
- CLI tools — global flags (
export API_KEY=...) cause action at a distance; argument-only tools are auditable per invocation. - Distributed-system RPCs — stateless RPC (every request carries full context) vs. session-bound RPC (binding-then-call) has the same bug class.
- Address hardcoding — baking a literal into state that depends on mutable context is a sibling antipattern; see concepts/hardcoded-literal-address-antipattern.
The graphics-API instance is the most canonically documented case because the perf impact was historically the reason implicit state won: fewer bytes on the wire per draw, fewer API calls per frame. Modern GPU-driver architectures narrow that gap, so WebGPU could afford to choose correctness.
In production¶
Figma's 2026-04-21 post calls out this shift as the foundation of its migration:
"A major part of our project was to make all of the state required for each draw call more explicit and WebGPU-like ... This modified interface fixed a handful of bugs in our WebGL renderer before we even touched WebGPU."
The explicit-state refactor benefited both backends — it's not just a WebGPU requirement, it's a correctness improvement that happens to be forced by WebGPU's API shape.
Seen in¶
- sources/2026-04-21-figma-rendering-powered-by-webgpu — Figma's pre-migration abstraction redesign fixed latent WebGL bugs just by making draw state explicit, independent of the WebGPU work.