Skip to content

WebGPU backend incorrectly assumes WGPUTextureView pointers will never be reused #7765

Open
@dkaste

Description

Version/Branch of Dear ImGui:

Version 1.90.6, Branch: docking (through cimgui)

Back-ends:

imgui_impl_glfw.cpp + imgui_impl_wgpu.cpp

Compiler, OS:

Windows 10 + Zig (MSVC)

Full config/build information:

No response

Details:

My Issue/Question:

The WebGPU backend keeps a cache of WGPUBindGroups that internally reference WGPUTextureViews which are simply typedef'd opaque pointers. The backend uses a hash of the texture view pointer as the key for the cache. If a texture view is destroyed and another is created with the same pointer, the old, stale bind group will be used.

I ran into this when rapidly creating/destroying textures to resize a custom 3D viewport embedded in IMGUI.

My current workaround is to manually clear the internal bind group cache whenever changing textures used in IMGUI. It works, but it's far from ideal.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions