6.4 KiB
DRP2 Layer 1
Human-readable contract for the future Datoviz Rendering Protocol v2.
Status: active reduced contract Scope: intentionally reduced first contract
Purpose
DRP2 is the backend-agnostic rendering contract that future Datoviz runtimes should execute.
It exists to let higher-level producers emit one logical GPU command stream that can be consumed by:
- a native runtime with a Vulkan backend,
- a browser runtime over WebGPU,
- future tooling for replay, validation, capture, and testing.
Non-Goals
This first contract freeze is not trying to define:
- the full future scene API,
- native interop escape hatches,
- profiling and benchmarking APIs,
- a complete binary transport format,
- advanced memory-management policy.
Those topics matter, but they should remain outside the initial DRP2 contract freeze unless they are strictly required by the minimal renderer slice.
Design Principles
- Backend-agnostic public contract.
- WebGPU-shaped semantics where practical.
- No
Vk*types or Vulkan constants in public DRP2 definitions. - Deterministic validation and replay at the contract level.
- Narrow first version, expand later.
Object Model
The first DRP2 contract defines logical objects only. Backends remain free to implement them with different physical strategies.
Active object kinds:
- buffer
- texture
- shader module
- bind group layout
- bind group
- render pipeline
- compute pipeline
- command encoder
- render pass encoder
- compute pass encoder
Each object is addressed by an explicit logical id chosen by the producer.
Command Categories
The reduced 2.0 contract covers only these categories:
- resource creation and destruction,
- resource upload and copy,
- lightweight pipeline creation,
- command encoder lifecycle,
- render pass lifecycle,
- compute pass lifecycle,
- draw and dispatch,
- queue submission.
Settled 2.0 Decisions
These decisions are already taken for the 2.0 contract:
- explicit destroy commands are part of
2.0, - compute is mandatory in
2.0, - prototype C API sketches are intentionally excluded until the contract is tighter.
Required First-Slice Commands
The active 2.0 command surface is defined in COMMANDS.md.
At a minimum, 2.0 includes:
- resource lifecycle commands,
- binding and pipeline lifecycle commands,
- render-pass commands,
- compute-pass commands,
- draw and dispatch commands,
- copy commands,
- queue submission.
Execution Semantics
- Commands are immutable once emitted.
- Commands are consumed in order.
- Validation is part of the contract, not an optional debug feature.
- Implicit synchronization should follow WebGPU-like semantics in the first version.
- Explicit backend-specific synchronization is deferred unless it becomes necessary for the minimal renderer slice.
Resource Rules
- Every resource has an explicit logical id.
- Resource usage must be declared at creation time.
- Upload and copy commands must obey documented range and layout rules.
- Texture formats and shader formats are validated against the capability model.
- The public contract describes logical resources, not allocation strategy.
Shader Rules
- Shader-module objects are part of the active executable
2.0surface. - WGSL is the default portable contract-level shader language in active
2.0. - GLSL and native-only ingestion paths such as SPIR-V may exist only behind explicit capability flags.
- Shader modules carry only the minimum executable contract metadata: stage, format, entry point, and declared required features.
- Pipelines reference shader-module ids explicitly.
- Active
2.0still keeps pipeline semantics narrow beyond shader attachment, bind-group-layout expectations, and required vertex-buffer slots.
Pass Rules
Render and compute passes are explicit encoder scopes.
Rules:
- resource, bind-group, shader, and pipeline creation/upload commands are valid outside pass scopes only,
- draw commands are valid only inside a render pass,
- dispatch commands are valid only inside a compute pass,
- attachments, load/store operations, and pipeline state must be validated before execution,
- pass compatibility is a contract-level concern, not only a backend detail.
Validation
Every runtime should implement the same logical validation model.
At minimum, validation covers:
- object existence,
- object type compatibility,
- lifetime and state transitions,
- command ordering,
- pass scope correctness,
- binding compatibility,
- resource range and layout checks,
- capability gating,
- version compatibility.
Detailed symbolic codes live in ERRORS.md.
Detailed lifetime and state rules live in LIFETIMES.md.
Capability Model
DRP2 must have an explicit capability report used before feature-dependent command streams are emitted.
At minimum the capability model must cover:
- supported protocol versions,
- shader language support,
- texture format support,
- sample count support,
- FP64 support,
- key size and binding limits.
Detailed rules live in CAPABILITIES.md.
Versioning
Every stream and handshake message declares a DRP2 protocol version object. The schema, fixture set, and human-readable Layer 1 contract for a given version must be kept in lockstep.
Detailed rules live in VERSIONING.md.
Terminology is fixed in GLOSSARY.md.
Conformance
The full conformance model is defined in CONFORMANCE.md.
Summary:
- Level 1 (validation): all corpus fixtures pass the fixture runner — required and mechanically verified.
- Level 2 (execution): a runtime executes every positive fixture without protocol error, with WGSL
as the mandatory shader language — required, prose commitment only in
2.0. - Level 3 (output): readback data matches golden checksums across backends — deferred to
2.1.
The command surface for 2.0 is frozen in COMMANDS.md.
The active fixture core includes a mandatory handshake/version slice.
HelloRenderer followed by RendererHelloReply is required as the opening of every fixture stream.
Pressure Tests From Future Scene Work
The first contract freeze should be checked against at least these producer stories:
- static geometry in a panel,
- dynamic buffer updates across frames,
- texture upload and sampling,
- picking-oriented render-to-texture plus readback,
- one compute-assisted data path.
If DRP2 cannot express those cleanly without backend leakage, the contract is not ready.