allowed Dear ImGUI to draw with point filtering

This commit is contained in:
myT 2024-12-20 01:58:26 +01:00
parent f3594a8900
commit 2c8026e0c1

View file

@ -258,10 +258,16 @@ void ImGUI::Draw(HTexture renderTarget)
continue;
}
static_assert(sizeof(ImTextureID) >= 4, "Unexpected ImTextureID size");
const ImTextureID textureIndex = cmd->TextureId & 0xFFFF;
const ImTextureID mipIndex = (cmd->TextureId >> 16) & 0xFF;
const bool usePointFilter = ((cmd->TextureId >> 31) & 1) == 1;
const TextureFilter::Id filter = usePointFilter ? TextureFilter::Point : TextureFilter::Linear;
ImGUIPixelRC pixelRC = {};
pixelRC.texture = (uint32_t)cmd->TextureId & 0xFFFF;
pixelRC.sampler = GetSamplerIndex(TW_CLAMP_TO_EDGE, TextureFilter::Linear);
pixelRC.mip = (float)(((uint32_t)cmd->TextureId >> 16) & 0xFFFF);
pixelRC.texture = (uint32_t)textureIndex;
pixelRC.sampler = GetSamplerIndex(TW_CLAMP_TO_EDGE, filter);
pixelRC.mip = (float)mipIndex;
if(ddhi)
{
CmdSetGraphicsRootConstants(sizeof(vertexRC), sizeof(pixelRC), &pixelRC);