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

Feature request: PrimitiveBatch with subbuffers #237

Open
aganm opened this issue Jun 6, 2022 · 0 comments
Open

Feature request: PrimitiveBatch with subbuffers #237

aganm opened this issue Jun 6, 2022 · 0 comments

Comments

@aganm
Copy link

aganm commented Jun 6, 2022

I'm not sure how much work it would be to add this feature but it's something I had on my mind.

The way PrimitiveBatch currently works is by taking a single pointer to an interleaved buffer.

I would like if PrimitiveBatch also had a way to take multiple pointers to distinct subbuffers of packed data instead (implemented with glBufferSubData).

If this is the current PrimitiveBatch API

DECLSPEC void SDLCALL
GPU_PrimitiveBatch(
    GPU_Image* image,
    GPU_Target* target,
    GPU_PrimitiveEnum primitive_type,
    unsigned int num_vertices,
    float* values,
    unsigned int num_indices,
    unsigned int* indices,
    GPU_BatchFlagEnum flags);

This is what I imagine this new API could look like

typedef struct GPU_SubBuffers {
       float *x_values;
       float *y_values;
       float *z_values;
       float *s_values;
       float *t_values;
       float *r_values;
       float *g_values;
       float *b_values;
       float *a_values;
       uint8_t *r8_values;
       uint8_t *g8_values;
       uint8_t *b8_values;
       uint8_t *a8_values;
} GPU_SubBuffers;

DECLSPEC void SDLCALL
GPU_PrimitiveBatchSub(
    GPU_Image* image,
    GPU_Target* target,
    GPU_PrimitiveEnum primitive_type,
    unsigned int num_vertices,
    const GPU_SubBuffers *values,
    unsigned int num_indices,
    unsigned int* indices,
    GPU_BatchFlagEnum flags);
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

No branches or pull requests

1 participant