Immediate-Mode-UI / Immediate-Mode-UI/Nuklear

nk_context commands buffer pollutes on skipping rendering.

Open
#95 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
11.4k
Forks
686
Avg merge
4d 1h
Merged PRs (30d)
3

Description

Hi, I am having issues with optimizing render loop with `memcmp(cmds, last, cmds->allocated)`, if I am getting 0 then I call `nk_clear(ctx)` directly as documentation suggested.

But later at some point of rendering I found out I would have problems with `cmds`. I am getting garbage `cmd->type` and very big `cmd->next`, especially in the case of pop-up windows. It seems I need to call `nk_foreach` regardless I want to render or not before calling `nk_clear(ctx)`. I digged a bit and found that there was a `nk_build` function underneath that changes the command buffer.

I am not sure if this is the issue but I found calling a dummy `nk_foreach` is like a hack. Is there a better way doing it?

Contributor guide

Open the contributing guide

Research direction

Start by tracing the command-buffer paths through nk_build, nk_foreach, and nk_clear, focusing on the skipped-rendering and pop-up cases described in the issue. Reproduce the garbage cmd->type and unusually large cmd->next values, then establish whether clearing without traversal is supported and what behavior should remain valid afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.