-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
index buffer size of zero now causes black screen #4766
Comments
This is intentional, every time we grow the buffer we reserve extra space to avoid having to recreate the buffer too often as it is likely to increase again shortly after. It's a simple amortizing strategy for the underlying allocation. Many other strategies are possible, though they don't matter so much as unlike a typical std::vector+reserve use, here our buffer is write only from the POV of the CPU so we just recreate one and there's no extra copy involved.
Will apply this to both The specs says: (Technically speaking, but it would depends on what the specs says, it might be advantageous to pass |
…appears to not do what the in-flux specs says. (#4766
Pushed tentative fix 5ccb667 |
Fixes the validation error I ran into, thanks! |
Version/Branch of Dear ImGui:
Version: top of tree
Branch: master/docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_wgpu.cpp
My Issue/Question:
When running ImGui with the latest Dawn (Chrome wgpu engine), nothing currently draws. I traced it down to this:
imgui/backends/imgui_impl_wgpu.cpp
Line 372 in 65f4be1
This line of code adds 10,000 to the index count to create a buffer. The wgpu back end defaults to a 16 bit index size. It's not especially a problem, to my knowledge, that an over-large buffer is created here, although the number is undocumented, and I am wondering if this is left-over debugging code?
That's not the actual problem though, later. Some validation layers (e.g. latest Chrome) fault with this message:
That issue results from this line of code:
imgui/backends/imgui_impl_wgpu.cpp
Line 317 in 65f4be1
where the last parameter is the size of the index buffer. It should be 10000 + index count, according to the previous line of code. Since zero is being passed in, it now causes validation errors.
Fix:
the value is available in fr->IndexBufferSize, and changing the last parameter to that restores drawing functionality. I think the "trick" of passing zero as the index buffer size has been deprecated recently.
The text was updated successfully, but these errors were encountered: