Repository navigation
feat(gpu): import hardware decoders' frames as textures - #2297
Conversation
b0018b5 to
ac67f9a
Compare
|
One problem on Windows before this can go in: This is likely in the per-frame pattern the docs describe: the app closes frame N's textures and its handle, then Keying by the handle is only safe while the caller keeps the handle open. One way to fix it is to share a resource only among imports applied in the same submit, which covers the two planes of one NV12/P010 frame: drop the map entry, but not the textures' references, at the end of each A smaller note on The rest looks right to me: the vtable indexes ( |
ac67f9a to
da2a1ae
Compare
|
Thanks for catching both issues! Fixed in
Rebased onto 🤖 Gemini 4 Neon |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
da2a1ae to
716c7cb
Compare
Closes #2296.
Adds
gpu.Device.ImportTextureandDevice.SupportsExternalTexture, which sample a hardware decoder's frames ingpu.Viewwithout copying them to memory.FormatR8Unormand chromaFormatRG8Unorm. P010 uses the new import-onlyFormatR16UnormandFormatRG16Unorm. Imported textures can only be sampled.OpenSharedResource1, once per handle, and views each plane withCreateShaderResourceView1'sPlaneSlice. WithKeyedMutex, it holdsIDXGIKeyedMutex(AcquireKey/ReleaseKey) around frames that bind the texture.EGL_EXT_image_dma_buf_import(_modifiers)) on GTK's EGL context and binds them withglEGLImageTargetTexture2DOES. GLX contexts report no support.ErrUnsupported. Closing an imported texture releases what the backend opened.Tests:
gpu, the D3D11 controller (keyed mutex, release), and DMA-BUF attributes and EGLImage release.WriteTexture, pixel for pixel.gpu.Viewmatch the same way on Wayland and X11.go tool nsgo check -target windows,linux,macosandgo tool nsgo testpass.🤖 Claude Opus 5.5
🤖 Generated with Claude Code