Skip to content
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

gpu: Add instanceCount parameter to SDL_GpuDrawPrimitives() #226

Merged

Conversation

Akaricchi
Copy link

@Akaricchi Akaricchi commented Aug 22, 2024

Partially fixes #231

Copy link
Collaborator

@flibitijibibo flibitijibibo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be okay if CI is happy

@thatcosmonaut
Copy link
Owner

I'd really like to see an indirect variant of this and a functioning test before merging.

@Akaricchi
Copy link
Author

Akaricchi commented Aug 22, 2024

The plain IndirectDrawCommand already has instancing parameters. If anything, this PR makes the non-indirect one more consistent with it.

typedef struct SDL_GpuIndirectDrawCommand

typedef struct SDL_GpuIndirectDrawCommand
{
    Uint32 vertexCount;   /* number of vertices to draw */
    Uint32 instanceCount; /* number of instances to draw */
    Uint32 firstVertex;   /* index of the first vertex to draw */
    Uint32 firstInstance; /* ID of the first instance to draw */
} SDL_GpuIndirectDrawCommand;

I'm not sure why or where do you want a test for this. The only test we have in the repo is the spinning cube, which certainly doesn't cover the entire API surface. Do you want me to add an example to the SDL_gpu_examples repo?

@flibitijibibo
Copy link
Collaborator

Do you want me to add an example to the SDL_gpu_examples repo?

That's probably the way to go. We already have an instancing sample so we can just rip that off.

@thatcosmonaut
Copy link
Owner

I reviewed and all the backends do in fact take an instance count for the indirect variant so this does make it more consistent. Just need to use it in SDL_gpu_examples and we're good to go.

@flibitijibibo
Copy link
Collaborator

Getting this in now because the weekly rebase is going to take all day and this is mostly an obvious change - we still expect an example though, so I've filed that at TheSpydog/SDL_gpu_examples#31

@flibitijibibo flibitijibibo merged commit 6ac84d5 into thatcosmonaut:gpu_next Aug 23, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants