Skip to content

Opportunity to use point sampler in the shader. #3590

Closed
@obfuscate

Description

Version/Branch of Dear ImGui:

Branch: tables branch (a53ee5e) merged into the docking branch (3d4af15)

Back-end/Renderer/Compiler/OS

Back-ends: we use custom abstract render interface, but it looks like d3d11 implementation.
Compiler: doesn't matter
Operating System: doesn't matter

My Issue/Question:

I want to add an opportunity to use point filtering (and save linear filter for usual rendering) for some textures in the imgui's shader, for example, to implement such tools like a magnifier (where is important to see pixels clearly).

To implement it, I have merely extended ImDrawListFlags_ adding a new flag constexpr int ImDrawListFlags_PointFiltration = 1 << 31; in our imgui_integration.hpp file (I did it because we use imgui as the third party and it wasn't comfortable to patch).

After it, in the ImGui_ImplDX11_RenderDrawData I just check a new flag and pass a new constant to the shader, which selects a sampler.

What do you think about this approach? Is it ok and lies in the imgui's logic or may be here exist more right solution?

It seems there is a way to use callbacks, but be honest such approach doesn't look fine some reasons.

Screenshots/Video
before:
linear filtering magnifier
after:
point filtering magnifier

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions