RenderQuad, RenderTriangle

SDL is a very lightweight graphics engine. I am very honored to be able to use it. I have used SDL for more than 5 years.
I want to be able to draw the mesh model through SDL instead of using the OpenGL interface.
I expect to add the following similar interfaces to achieve this goal

/**
 *  \brief Copy a portion of the texture to the current rendering target.
 *
 *  \param renderer The renderer which should copy parts of a texture.
 *  \param texture The source texture.
 *  \param src   A pointer to the source quad, or NULL for the entire
 *                   texture.
 *  \param dst   A pointer to the destination quad, or NULL for the
 *                   entire rendering target.
 *
 *  \return 0 on success, or -1 on error
 */
extern DECLSPEC int SDLCALL SDL_RenderQuad(SDL_Renderer * renderer,
                                           SDL_Texture * texture,
                                           const float * src,
                                           const float * dst);

/**
 *  \brief Copy a portion of the texture to the current rendering target.
 *
 *  \param renderer The renderer which should copy parts of a texture.
 *  \param texture The source texture.
 *  \param src   A pointer to the source triangle, or NULL for the entire
 *                   texture.
 *  \param dst   A pointer to the destination triangle, or NULL for the
 *                   entire rendering target.
 *
 *  \return 0 on success, or -1 on error
 */
extern DECLSPEC int SDLCALL SDL_RenderTriangle(SDL_Renderer * renderer,
                                           SDL_Texture * texture,
                                           const float * src,
                                           const float * dst);


static int
D3D_QueueQuad(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture,
                          const float * src, const float * dst)
{
    const DWORD color = D3DCOLOR_ARGB(cmd->data.draw.a, cmd->data.draw.r, cmd->data.draw.g, cmd->data.draw.b);
    // float minx, miny, maxx, maxy;
    // float minu, maxu, minv, maxv;
    const size_t vertslen = sizeof (Vertex) * 4;
    Vertex *verts = (Vertex *) SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first);

    if (!verts) {
        return -1;
    }

    cmd->data.draw.count = 1;

    // minx = dstrect->x - 0.5f;
    // miny = dstrect->y - 0.5f;
    // maxx = dstrect->x + dstrect->w - 0.5f;
    // maxy = dstrect->y + dstrect->h - 0.5f;

    // minu = (float) srcrect->x / texture->w;
    // maxu = (float) (srcrect->x + srcrect->w) / texture->w;
    // minv = (float) srcrect->y / texture->h;
    // maxv = (float) (srcrect->y + srcrect->h) / texture->h;

    verts->x = dst[0] - 0.5f;  // minx;
    verts->y = dst[1] - 0.5f;  // miny;
    verts->z = 0.0f;
    verts->color = color;
    verts->u = src[0];         // minu;
    verts->v = src[1];         // minv;
    verts++;

    verts->x = dst[2] - 0.5f;  // maxx;
    verts->y = dst[3] - 0.5f;  // miny;
    verts->z = 0.0f;
    verts->color = color;
    verts->u = src[2];         // maxu;
    verts->v = src[3];         // minv;
    verts++;

    verts->x = dst[4] - 0.5f;  // maxx;
    verts->y = dst[5] - 0.5f;  // maxy;
    verts->z = 0.0f;
    verts->color = color;
    verts->u = src[4];         // maxu;
    verts->v = src[5];         // maxv;
    verts++;

    verts->x = dst[6] - 0.5f;  // minx;
    verts->y = dst[7] - 0.5f;  // maxy;
    verts->z = 0.0f;
    verts->color = color;
    verts->u = src[6];         // minu;
    verts->v = src[7];         // maxv;
    verts++;

    return 0;
}

static int
D3D_QueueTriangle(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture,
                          const float * src, const float * dst)
{

    const DWORD color = D3DCOLOR_ARGB(cmd->data.draw.a, cmd->data.draw.r, cmd->data.draw.g, cmd->data.draw.b);
    // float minx, miny, maxx, maxy;
    // float minu, maxu, minv, maxv;
    const size_t vertslen = sizeof (Vertex) * 4;
    Vertex *verts = (Vertex *) SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first);

    if (!verts) {
        return -1;
    }

    cmd->data.draw.count = 1;

    // minx = dstrect->x - 0.5f;
    // miny = dstrect->y - 0.5f;
    // maxx = dstrect->x + dstrect->w - 0.5f;
    // maxy = dstrect->y + dstrect->h - 0.5f;

    // minu = (float) srcrect->x / texture->w;
    // maxu = (float) (srcrect->x + srcrect->w) / texture->w;
    // minv = (float) srcrect->y / texture->h;
    // maxv = (float) (srcrect->y + srcrect->h) / texture->h;

    verts->x = dst[0] - 0.5f;  // minx;
    verts->y = dst[1] - 0.5f;  // miny;
    verts->z = 0.0f;
    verts->color = color;
    verts->u = src[0];         // minu;
    verts->v = src[1];         // minv;
    verts++;

    verts->x = dst[2] - 0.5f;  // maxx;
    verts->y = dst[3] - 0.5f;  // miny;
    verts->z = 0.0f;
    verts->color = color;
    verts->u = src[2];         // maxu;
    verts->v = src[3];         // minv;
    verts++;

    verts->x = dst[4] - 0.5f;  // maxx;
    verts->y = dst[5] - 0.5f;  // maxy;
    verts->z = 0.0f;
    verts->color = color;
    verts->u = src[4];         // maxu;
    verts->v = src[5];         // maxv;
    verts++;

    // verts->x = dst[6] - 0.5f;  // minx;
    // verts->y = dst[7] - 0.5f;  // maxy;
    // verts->z = 0.0f;
    // verts->color = color;
    // verts->u = src[6];         // minu;
    // verts->v = src[7];         // maxv;
    // verts++;

    return 0;
}


static int
GL_QueueQuad(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture,
             const float * src, const float * dst)
{
    GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata;
    // GLfloat minx, miny, maxx, maxy;
    // GLfloat minu, maxu, minv, maxv;
    GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, 16 * sizeof (GLfloat), 0, &cmd->data.draw.first);

    if (!verts) {
        return -1;
    }

    cmd->data.draw.count = 1;

    // minx = dstrect->x;
    // miny = dstrect->y;
    // maxx = dstrect->x + dstrect->w;
    // maxy = dstrect->y + dstrect->h;

    // minu = (GLfloat) srcrect->x / texture->w;
    // minu *= texturedata->texw;
    // maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
    // maxu *= texturedata->texw;
    // minv = (GLfloat) srcrect->y / texture->h;
    // minv *= texturedata->texh;
    // maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
    // maxv *= texturedata->texh;

    cmd->data.draw.count = 1;
    // *(verts++) = minx;
    // *(verts++) = miny;
    // *(verts++) = maxx;
    // *(verts++) = maxy;
    // *(verts++) = minu;
    // *(verts++) = maxu;
    // *(verts++) = minv;
    // *(verts++) = maxv;

    *(verts++) = dst[0];
    *(verts++) = dst[1];
    *(verts++) = src[0];
    *(verts++) = src[1];

    *(verts++) = dst[2];
    *(verts++) = dst[3];
    *(verts++) = src[2];
    *(verts++) = src[3];

    *(verts++) = dst[4];
    *(verts++) = dst[5];
    *(verts++) = src[4];
    *(verts++) = src[5];

    *(verts++) = dst[6];
    *(verts++) = dst[7];
    *(verts++) = src[6];
    *(verts++) = src[7];
    return 0;
}

static int
GL_QueueQuad(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture,
             const float * src, const float * dst)
{
    GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata;
    // GLfloat minx, miny, maxx, maxy;
    // GLfloat minu, maxu, minv, maxv;
    GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, 12 * sizeof (GLfloat), 0, &cmd->data.draw.first);

    if (!verts) {
        return -1;
    }

    cmd->data.draw.count = 1;

    // minx = dstrect->x;
    // miny = dstrect->y;
    // maxx = dstrect->x + dstrect->w;
    // maxy = dstrect->y + dstrect->h;

    // minu = (GLfloat) srcrect->x / texture->w;
    // minu *= texturedata->texw;
    // maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
    // maxu *= texturedata->texw;
    // minv = (GLfloat) srcrect->y / texture->h;
    // minv *= texturedata->texh;
    // maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
    // maxv *= texturedata->texh;

    cmd->data.draw.count = 1;
    // *(verts++) = minx;
    // *(verts++) = miny;
    // *(verts++) = maxx;
    // *(verts++) = maxy;
    // *(verts++) = minu;
    // *(verts++) = maxu;
    // *(verts++) = minv;
    // *(verts++) = maxv;

    *(verts++) = dst[0];
    *(verts++) = dst[1];
    *(verts++) = src[0];
    *(verts++) = src[1];

    *(verts++) = dst[2];
    *(verts++) = dst[3];
    *(verts++) = src[2];
    *(verts++) = src[3];

    *(verts++) = dst[4];
    *(verts++) = dst[5];
    *(verts++) = src[4];
    *(verts++) = src[5];

    // *(verts++) = dst[6];
    // *(verts++) = dst[7];
    // *(verts++) = src[6];
    // *(verts++) = src[7];
    return 0;
}

Hi!
See


thinks, so I start to use sokol instead of SDL