5.8 KiB
DRP2 Capabilities
This document defines the minimum capability model needed by DRP2.
Goals
- Keep the public contract backend-agnostic.
- Make optional features explicit and testable.
- Avoid embedding Vulkan-specific or browser-specific constants in the public DRP2 surface.
Capability Categories
The runtime should expose a structured capability record covering:
- protocol version support
- shader language support
- texture format support
- sample count support
- depth/stencil support
- limits
- determinism-related guarantees
- optional native escape hatches outside the core DRP2 contract
- lower-level rendering features used by scene techniques such as transparency
Minimum Fields
The first capability schema should include at least:
protocol_versionmax_bind_groupsmax_color_attachmentsmax_buffer_sizemax_uniform_buffer_binding_sizemax_storage_buffer_binding_sizemax_texture_dimension_1dmax_texture_dimension_2dmax_texture_dimension_3dmax_texture_array_layerssupported_texture_formatssupported_render_target_formatssupported_sample_countssupported_shader_formatssupports_timestamp_queriessupports_fp64supports_readbacksupports_offscreen_targetssupports_storage_texturessupports_color_blendingmin_uniform_buffer_offset_alignmentmin_storage_buffer_offset_alignmentmin_texture_copy_bytes_per_row_alignment
Fixture Capability Shape
When a fixture declares capabilities, the first active 2.0 capability object should use this
shape:
max_buffer_sizemax_texture_dimension_1dmax_texture_dimension_2dmax_texture_dimension_3dsupported_texture_formatssupported_sample_countssupported_shader_formatssupports_fp64
The omitted fields from the broader future capability model remain planned but are not yet consumed by the first executable fixture corpus.
The fixture capability object is intentionally smaller than the runtime capability snapshot consumed by the future scene layer. Fixtures should declare only the fields needed to make the fixture's validation outcome deterministic.
Runtime Capability Snapshot
A runtime that is consumed by the scene layer should expose a richer DvzCapabilitySnapshot.
This runtime snapshot includes the fixture fields above plus scene-planning limits such as:
protocol_versionmax_bind_groupsmax_color_attachmentsmax_uniform_buffer_binding_sizemax_storage_buffer_binding_sizemax_texture_array_layerssupported_render_target_formatssupports_readbacksupports_offscreen_targetssupports_storage_texturessupports_color_blendingmin_uniform_buffer_offset_alignmentmin_storage_buffer_offset_alignmentmin_texture_copy_bytes_per_row_alignment
The three alignment fields are backend-agnostic numeric limits. They are required for scene/runtime planning, but individual JSON fixtures do not need to declare them unless the fixture specifically tests dynamic buffer offsets or texture-copy row-pitch alignment.
Weighted blended OIT is not represented as a single capability bit. The scene derives whether it can use that technique from lower-level facts: at least two color attachments, supported floating-point render-target formats for the accumulation targets, color blending support, and the ability to run the needed transparent accumulation and resolve render passes.
Active 2.0 Command Gates
The first active 2.0 capability validation rules are:
CreateBuffer.sizemust not exceedmax_buffer_size,CreateTexture.formatmust be listed insupported_texture_formats,CreateTexture.sample_countmust be listed insupported_sample_counts,CreateTexturedimensions must not exceed the correspondingmax_texture_dimension_*field for the chosen texture dimension,CreateShaderModule.formatmust be listed insupported_shader_formatswhen that field is present,- a shader module declaring
required_features = ["fp64"]requiressupports_fp64 = true, - compute is mandatory in active DRP2
2.0and therefore is not gated by a capability field.
Capability failures should occur during capability_validation after schema and semantic validation
have succeeded.
Feature Gating Rules
- If a command needs a capability, that dependency must be explicit in the contract.
- Unsupported features fail during capability validation, before backend submission.
- Capability reports are declarative; they must not expose backend handle types.
- WGSL should be the default shader language for the portable contract.
- GLSL and native-only ingestion paths such as SPIR-V belong behind explicit capability flags in
supported_shader_formats.
Error Mapping
The first capability-validation mapping should be:
- use
DRP2_ERR_UNSUPPORTED_CAPABILITYwhen the runtime explicitly reports lack of support for a requested capability, - use
DRP2_ERR_FEATURE_REQUIREDwhen the command stream requires a feature the runtime reports as unavailable and the fixture is explicitly testing that required feature boundary, - for the current active fixture corpus, prefer
DRP2_ERR_UNSUPPORTED_CAPABILITY.
FP64
FP64 should be treated as optional-but-reportable at the contract level.
Rules:
- The capability report must state whether FP64 is supported.
- Pipelines or shader modules that require FP64 must declare that requirement.
- Producers must be able to select a fallback path when FP64 is unavailable.
Determinism
The capability model should distinguish:
- best-effort execution,
- deterministic rendering and readback where guaranteed,
- deterministic compute/reduction modes where explicitly supported.
Determinism should be requested by contract-level policy, not inferred from a backend.