Skip to content

Add support for user images to ImGui integration of SampleBase #9

Closed
@Marlax0

Description

@Marlax0

I see SampleBase has ImGui integrated, but it doesn't have support for user images or custom font textures.
A working example of this for NRI would be really useful, and I guess this would be the most convenient place to do it.

Ideally the Descriptor* would be used as the ImTextureID, but I'm not sure how to make that work with NRI's design.

I'm currently very inexperienced with NRI, but integration is clearly not as simple as:

nri::Descriptor* image = (nri::Descriptor*)drawCmd.GetTexID();

if (image)
{
    nri::DescriptorRangeUpdateDesc descriptorRangeUpdateDesc[] = {
        {&image, 1},
        {&m_Sampler, 1}};

    NRI.UpdateDescriptorRanges(*m_DescriptorSet, 0, helper::GetCountOf(descriptorRangeUpdateDesc), descriptorRangeUpdateDesc);
}

NRI.CmdSetScissors(commandBuffer, &rect, 1);
NRI.CmdDrawIndexed(commandBuffer, {drawCmd.ElemCount, 1, indexOffset, vertexOffset, 0});

(As UpdateDescriptorRanges() is immediate but CmdDrawIndexed() buffered.)

Since the descriptor set part of NRI sort of resembles Vulkan, perhaps this issue is relevant: ocornut/imgui#914

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions