gfx icon indicating copy to clipboard operation
gfx copied to clipboard

Get gfxTexture D3D12_GPU_DESCRIPTOR_HANDLE for imgui image

Open ySion opened this issue 10 months ago • 1 comments

I'm using ImGui to show some texture. ImGui's function AddImage need a argument which type is ImTextureID, it was defined as D3D12_GPU_DESCRIPTOR_HANDLE in D3D12, how can I get D3D12_GPU_DESCRIPTOR_HANDLE from a gfxTexture?

ySion avatar Mar 27 '24 18:03 ySion

You shouldn't need passing a D3D12_GPU_DESCRIPTOR_HANDLE as ImTextureID can be anything really based on your application needs.

If you're using the built-in gfx ImGui integration (i.e., https://github.com/gboisse/gfx/blob/master/gfx_imgui.h), then you should be able to simply pass a pointer to the GfxTexture object you want to use as image: https://github.com/gboisse/gfx/blob/d617b252a68ea27116a5a26027530c22d45bc9e6/gfx_imgui.cpp#L270-L272

gboisse avatar Apr 03 '24 09:04 gboisse