ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
61.12k stars 10.3k forks source link

ImGui::Image() does not work in some environments #8055

Closed am-1129 closed 1 month ago

am-1129 commented 1 month ago

Version/Branch of Dear ImGui:

Version 1.91.3, Branch: docking

Back-ends:

imgui_impl_dx12.cpp + imgui_impl_win32.cpp

Compiler, OS:

Win11, Visual Studio 2022

Full config/build information:

No response

Details:

This is my first post and I am writing through translation as I am not an English speaker.

My Issue/Question:

It works differently between two different PCs.

  1. Laptop PC RTX3060 Laptop GPU Driver ver 552.22
  2. Desktop PC RTX3060 Ti Driver ver 537.13 Here are the images

2024-10-13_015837 スクリーンショット 2024-10-13 015827

void Update() {
    ImGui::Begin("Image");
    auto mats = anim_test_mesh->GetMesh().GetMaterials();
    auto cpu = Graphics::GraphicsDevice::Instance().GetCBVSRVUAV()->GetCPUHandle(mats[0].albedo_texture->SRVNumber()).ptr;
    auto gpu = Graphics::GraphicsDevice::Instance().GetCBVSRVUAV()->GetGPUHandle(mats[0].albedo_texture->SRVNumber()).ptr;
    ImVec2 size{ mats[0].albedo_texture->Size().x / 2, mats[0].albedo_texture->Size().y / 2 };

    ImGui::Text("CPU Handle Ptr: %p", cpu);
    ImGui::Text("GPU Handle Ptr: %p", gpu);

    ImGui::Image((ImTextureID)gpu, size);
    ImGui::End();
}

SRVs are managed collectively by IDs in CBVSRVUAVHeap, and the IDs of SRVs are stored in the object's material. By passing the ID to CBVSRVUAVHeap::GetGPUHandle(), the GPUHandle of the SRV is calculated and returned.

const D3D12_GPU_DESCRIPTOR_HANDLE CBVSRVUAVHeap::GetGPUHandle(GEint number) {
    D3D12_GPU_DESCRIPTOR_HANDLE handle = heap_->GetGPUDescriptorHandleForHeapStart();
    handle.ptr += (UINT64)increment_size_ * ((UINT64)use_count_ + 1) + (UINT64)number * (UINT64)increment_size_;
    return handle;
}

Since the operation is different between the two PCs, the code does not seem to matter much. I would appreciate it if you could tell me if there is any cause, even if it is something small.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

am-1129 commented 1 month ago

I updated the driver for the graphics board and it shows up.