Skip to content

Implement pipeline caches - #618

Draft
rael-g wants to merge 1 commit into
gfx-rs:trunkfrom
rael-g:pipeline-cache
Draft

Implement pipeline caches#618
rael-g wants to merge 1 commit into
gfx-rs:trunkfrom
rael-g:pipeline-cache

Conversation

@rael-g

@rael-g rael-g commented Jul 11, 2026

Copy link
Copy Markdown

Checklist

  • cargo clippy reports no issues
  • cargo doc reports no issues
  • cargo deny issues have been fixed or added to deny.toml
  • Human-readable change descriptions added to CHANGELOG.md under the "Unreleased" heading.
    • If the change does not affect the user (or is a process change), preface the change with "Internal:"
    • Add credit to yourself for each change: Added new functionality. @githubname

Description

Exposes pipeline caches to the C API, letting the result of shader compilation be reused between executions of a program.

wgpu-core already supports this, and WGPUNativeFeature_PipelineCache was already exposed, but there was no way to actually use it: both pipeline descriptors hardcoded cache: None behind a // TODO(wgpu.h).

Adds:

  • The WGPUPipelineCache object, with wgpuDeviceCreatePipelineCache, wgpuPipelineCacheGetData, wgpuPipelineCacheAddRef and wgpuPipelineCacheRelease.
  • WGPUPipelineDescriptorExtras, chained onto WGPURenderPipelineDescriptor or WGPUComputePipelineDescriptor to compile a pipeline through a cache.
  • A pipeline_cache example, wired into CI. It creates a cache, compiles a pipeline through it, reads the resulting data back, and recreates the pipeline from that data. Adapters that do not support pipeline caches skip it rather than fail, so it is safe to run everywhere.

wgpuPipelineCacheGetData follows the same two-call convention as wgpuInstanceEnumerateAdapters: call it once with data set to NULL to obtain the size, then again with a buffer.

Related Issues

@rael-g
rael-g marked this pull request as draft July 14, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant