Skip to content

SDL_RenderGeometryRaw: optionally copy additional coordinates based on stride #11276

Open
@expikr

Description

@expikr

SDL_RenderGeometryRaw already lets you specify an arbitrary stride for your vertex list.

It would be very useful to allow up to four spatial coordinates to be transmitted to the render backend if the stride is greater than 8 bytes.

Backends which accept up to four spatial coordinates should have the third and fourth coordinate default to zero and one respectively if the user provides a stride of only two coordinates.

SDL should make no additional guarantee or responsibility beyond dumb transmission of the coordinates to the hardware, and the software renderer should do nothing at all with the third and fourth optional coordinate.

Example:

size_t sz = 2 * sizeof(GLfloat) + 4 * sizeof(GLfloat) + (texture ? 2 : 0) * sizeof(GLfloat);

*(verts++) = xy_[0] * scale_x;
*(verts++) = xy_[1] * scale_y;

--- size_t sz = 2 * sizeof(GLfloat) + 4 * sizeof(GLfloat) + (texture ? 2 : 0) * sizeof(GLfloat);
+++ size_t sz = 4 * sizeof(GLfloat) + 4 * sizeof(GLfloat) + (texture ? 2 : 0) * sizeof(GLfloat);
        *(verts++) = xy_[0] * scale_x;
        *(verts++) = xy_[1] * scale_y;
+++     *(verts++) = xy_stride >= 12 ? xy_[2] : 0;
+++     *(verts++) = xy_stride >= 16 ? xy_[3] : 1;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions