GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — WebGPU sampler set to WGPUAddressMode_Repeat causes image rendering issues · Issue #7511 · ocornut/imgui Closed DescriptionVersion/Branch of Dear ImGui:master Back-ends:imgui_impl_wgpu.cpp Compiler, OS:macOS 13.6.6 Full config/build information:Details:I was working on porting my ImGui desktop application to webgpu (Dawn) and I noticed this issue. See screenshot attached. I have an image that I render like this: // kAudioJack is a texture loaded in webgpu and I keep a record of its size ImGui::SliderFloat("scale", &kScale, 0.1f, 2.0f); ImGui::Image(kAudioJack->getAsImTextureID(), {kAudioJack->fSize.x * kScale, kAudioJack->fSize.y * kScale}); As I move the scale slider, there are instances where the left of the image bleeds on the right side as can be seen on the screenshot (you can see a grey vertical line corresponding to the left edge of the image). In the ImGui demo, you can see that the bottom of the triangle bleeds on the top... The issue comes from this section in the code where the sampler is defined: // imgui_impl_wgpu.cpp line 535 WGPUSamplerDescriptor sampler_desc = {}; sampler_desc.minFilter = WGPUFilterMode_Linear; sampler_desc.magFilter = WGPUFilterMode_Linear; sampler_desc.mipmapFilter = WGPUMipmapFilterMode_Linear; sampler_desc.addressModeU = WGPUAddressMode_Repeat; sampler_desc.addressModeV = WGPUAddressMode_Repeat; sampler_desc.addressModeW = WGPUAddressMode_Repeat; sampler_desc.maxAnisotropy = 1; bd->renderResources.Sampler = wgpuDeviceCreateSampler(bd->wgpuDevice, &sampler_desc); Using In other backends, for example OpenGL, because it is completely statefull it is easy to change this kind of parameter outside of ImGui. But with WebGPU, because it is stateless, there is no way to change it besides changing the (ImGui) code. I can think of 2 ways to address the issue: a) change the code in ImGui directly to use I think a) is the right approach because I feel like this is an issue (= a bug) with ImGui: any texture that has data on any side will simply get repeated if the texture is scaled. It is not due to my code or my texture. Screenshots/Video:Actually it is visible in the demo window. It is just harder to see because the image has a border, but it is there (I circled it in red) Minimal, Complete and Verifiable Example code:// Here's some code anyone can copy and paste to reproduce your issue static float kScale = 1.0f; ImGui::SliderFloat("scale", &kScale, 0.1f, 2.0f); auto &io = ImGui::GetIO(); ImTextureID my_tex_id = io.Fonts->TexID; float my_tex_w = (float)io.Fonts->TexWidth; float my_tex_h = (float)io.Fonts->TexHeight; ImGui::Image(my_tex_id, {my_tex_w * kScale, my_tex_h * kScale}); Activity
|
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |