Skip to content

Question about different commands, sizes, and buffer alignment #816

@awschult002

Description

@awschult002

I'm not an expert, so my thoughts may be flawed here.

Some investigation that I have done has left me a little bit confused.

At the end of the draw pipeline, nuclear starts to push different primative draw commands into a continuous buffer stored in the CTX. Each new command gets tacked onto the end except in the case of a popup which gets stitched in at the nk_end call.

Within all of these pushes and buffer writing and pointer movement, there is a lot of math being done for memory alignment of the commands in the buffer. This isn't necessarily a bad thing (it's functional today). But I find it rather confusing. If I were to rewrite this, I would consider making a command type as a union of all command type to be pushed, that way alignment is lnt really something that anyone needs to consider. Every command would be the same size.

That, or perhaps I would try a linked list setup similar to how the Amiga RTOS handled its tasks.

@RobLoach
I'm just genuinely curious about the design decision here. And wondering what the teams thoughts on playing around with that structure are.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions