SDL_sysrender.h File Reference
`#include "../SDL_internal.h"`
`#include "SDL_render.h"`
`#include "SDL_events.h"`
`#include "SDL_mutex.h"`
`#include "SDL_yuv_sw_c.h"`
Include dependency graph for SDL_sysrender.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | SDL_Texture
struct | SDL_RenderCommand
struct | SDL_AllocVertGap
struct | SDL_Renderer
struct | SDL_RenderDriver

## Enumerations

enum | SDL_ScaleMode { SDL_ScaleModeNearest, SDL_ScaleModeLinear, SDL_ScaleModeBest }
enum | SDL_RenderCommandType { SDL_RENDERCMD_NO_OP, SDL_RENDERCMD_SETVIEWPORT, SDL_RENDERCMD_SETCLIPRECT, SDL_RENDERCMD_SETDRAWCOLOR, SDL_RENDERCMD_CLEAR, SDL_RENDERCMD_DRAW_POINTS, SDL_RENDERCMD_DRAW_LINES, SDL_RENDERCMD_FILL_RECTS, SDL_RENDERCMD_COPY, SDL_RENDERCMD_COPY_EX }

## Functions

SDL_BlendFactor | SDL_GetBlendModeSrcColorFactor (SDL_BlendMode blendMode)
SDL_BlendFactor | SDL_GetBlendModeDstColorFactor (SDL_BlendMode blendMode)
SDL_BlendOperation | SDL_GetBlendModeColorOperation (SDL_BlendMode blendMode)
SDL_BlendFactor | SDL_GetBlendModeSrcAlphaFactor (SDL_BlendMode blendMode)
SDL_BlendFactor | SDL_GetBlendModeDstAlphaFactor (SDL_BlendMode blendMode)
SDL_BlendOperation | SDL_GetBlendModeAlphaOperation (SDL_BlendMode blendMode)
void * | SDL_AllocateRenderVertices (SDL_Renderer *renderer, const size_t numbytes, const size_t alignment, size_t *offset)

## Variables

SDL_RenderDriver | D3D_RenderDriver
SDL_RenderDriver | D3D11_RenderDriver
SDL_RenderDriver | GL_RenderDriver
SDL_RenderDriver | GLES2_RenderDriver
SDL_RenderDriver | GLES_RenderDriver
SDL_RenderDriver | DirectFB_RenderDriver
SDL_RenderDriver | METAL_RenderDriver
SDL_RenderDriver | PSP_RenderDriver
SDL_RenderDriver | SW_RenderDriver

## Enumeration Type Documentation

## SDL_RenderCommandType

enum SDL_RenderCommandType

Enumerator
SDL_RENDERCMD_NO_OP |
SDL_RENDERCMD_SETVIEWPORT |
SDL_RENDERCMD_SETCLIPRECT |
SDL_RENDERCMD_SETDRAWCOLOR |
SDL_RENDERCMD_CLEAR |
SDL_RENDERCMD_DRAW_POINTS |
SDL_RENDERCMD_DRAW_LINES |
SDL_RENDERCMD_FILL_RECTS |
SDL_RENDERCMD_COPY |
SDL_RENDERCMD_COPY_EX |

Definition at line 72 of file SDL_sysrender.h.

{
SDL_RENDERCMD_NO_OP,
SDL_RENDERCMD_SETVIEWPORT,
SDL_RENDERCMD_SETCLIPRECT,
SDL_RENDERCMD_SETDRAWCOLOR,
SDL_RENDERCMD_CLEAR,
SDL_RENDERCMD_DRAW_POINTS,
SDL_RENDERCMD_DRAW_LINES,
SDL_RENDERCMD_FILL_RECTS,
SDL_RENDERCMD_COPY,
SDL_RENDERCMD_COPY_EX
} SDL_RenderCommandType;

## SDL_ScaleMode

enum SDL_ScaleMode

Enumerator
SDL_ScaleModeNearest |
SDL_ScaleModeLinear |
SDL_ScaleModeBest |

Definition at line 35 of file SDL_sysrender.h.

{
SDL_ScaleModeNearest,
SDL_ScaleModeLinear,
SDL_ScaleModeBest
} SDL_ScaleMode;

## Function Documentation

## SDL_AllocateRenderVertices()

void* SDL_AllocateRenderVertices | ( | SDL_Renderer * | renderer,
|  | const size_t | numbytes,
|  | const size_t | alignment,
|  | size_t * | offset
| ) |  |

Definition at line 284 of file SDL_render.c.

{
const size_t needed = renderer->vertex_data_used + numbytes + alignment;
size_t aligner, aligned;
void *retval;
SDL_AllocVertGap *prevgap = &renderer->vertex_data_gaps;
SDL_AllocVertGap *gap = prevgap->next;
while (gap) {
const size_t gapoffset = gap->offset;
aligner = (alignment && ((gap->offset % alignment) != 0)) ? (alignment - (gap->offset % alignment)) : 0;
aligned = gapoffset + aligner;
/* Can we use this gap? */
if ((aligner < gap->len) && ((gap->len - aligner) >= numbytes)) {
/* we either finished this gap off, trimmed the left, trimmed the right, or split it into two gaps. */
if (gap->len == numbytes) { /* finished it off, remove it */
SDL_assert(aligned == gapoffset);
prevgap->next = gap->next;
gap->next = renderer->vertex_data_gaps_pool;
renderer->vertex_data_gaps_pool = gap;
} else if (aligned == gapoffset) { /* trimmed the left */
gap->offset += numbytes;
gap->len -= numbytes;
} else if (((aligned - gapoffset) + numbytes) == gap->len) { /* trimmed the right */
gap->len -= numbytes;
} else { /* split into two gaps */
SDL_AllocVertGap *newgap = AllocateVertexGap(renderer);
if (!newgap) {
return NULL;
}
newgap->offset = aligned + numbytes;
newgap->len = gap->len - (aligner + numbytes);
newgap->next = gap->next;
// gap->offset doesn't change.
gap->len = aligner;
gap->next = newgap;
}
if (offset) {
*offset = aligned;
}
return ((Uint8 *) renderer->vertex_data) + aligned;
}
/* Try the next gap */
prevgap = gap;
gap = gap->next;
}
/* no gaps with enough space; get a new piece of the vertex buffer */
while (needed > renderer->vertex_data_allocation) {
const size_t current_allocation = renderer->vertex_data ? renderer->vertex_data_allocation : 1024;
const size_t newsize = current_allocation * 2;
void *ptr = SDL_realloc(renderer->vertex_data, newsize);
if (ptr == NULL) {
SDL_OutOfMemory();
return NULL;
}
renderer->vertex_data = ptr;
renderer->vertex_data_allocation = newsize;
}
aligner = (alignment && ((renderer->vertex_data_used % alignment) != 0)) ? (alignment - (renderer->vertex_data_used % alignment)) : 0;
aligned = renderer->vertex_data_used + aligner;
retval = ((Uint8 *) renderer->vertex_data) + aligned;
if (offset) {
*offset = aligned;
}
if (aligner) { /* made a new gap... */
SDL_AllocVertGap *newgap = AllocateVertexGap(renderer);
if (newgap) { /* just let it slide as lost space if malloc fails. */
newgap->offset = renderer->vertex_data_used;
newgap->len = aligner;
newgap->next = NULL;
prevgap->next = newgap;
}
}
renderer->vertex_data_used += aligner + numbytes;
return retval;
}

References AllocateVertexGap(), SDL_AllocVertGap::len, SDL_AllocVertGap::next, NULL, SDL_AllocVertGap::offset, renderer, retval, SDL_assert, SDL_OutOfMemory, SDL_realloc, SDL_Renderer::vertex_data, SDL_Renderer::vertex_data_allocation, SDL_Renderer::vertex_data_gaps, SDL_Renderer::vertex_data_gaps_pool, and SDL_Renderer::vertex_data_used.

Referenced by SW_QueueCopy(), SW_QueueCopyEx(), SW_QueueDrawPoints(), and SW_QueueFillRects().

## SDL_GetBlendModeAlphaOperation()

SDL_BlendOperation SDL_GetBlendModeAlphaOperation | ( | SDL_BlendMode | blendMode | ) |

Definition at line 3377 of file SDL_render.c.

{
blendMode = SDL_GetLongBlendMode(blendMode);
return (SDL_BlendOperation)(((Uint32)blendMode >> 16) & 0xF);
}

References blendMode, and SDL_GetLongBlendMode().

## SDL_GetBlendModeColorOperation()

SDL_BlendOperation SDL_GetBlendModeColorOperation | ( | SDL_BlendMode | blendMode | ) |

Definition at line 3356 of file SDL_render.c.

{
blendMode = SDL_GetLongBlendMode(blendMode);
return (SDL_BlendOperation)(((Uint32)blendMode >> 0) & 0xF);
}

References blendMode, and SDL_GetLongBlendMode().

## SDL_GetBlendModeDstAlphaFactor()

SDL_BlendFactor SDL_GetBlendModeDstAlphaFactor | ( | SDL_BlendMode | blendMode | ) |

Definition at line 3370 of file SDL_render.c.

{
blendMode = SDL_GetLongBlendMode(blendMode);
return (SDL_BlendFactor)(((Uint32)blendMode >> 24) & 0xF);
}

References blendMode, and SDL_GetLongBlendMode().

## SDL_GetBlendModeDstColorFactor()

SDL_BlendFactor SDL_GetBlendModeDstColorFactor | ( | SDL_BlendMode | blendMode | ) |

Definition at line 3349 of file SDL_render.c.

{
blendMode = SDL_GetLongBlendMode(blendMode);
return (SDL_BlendFactor)(((Uint32)blendMode >> 8) & 0xF);
}

References blendMode, and SDL_GetLongBlendMode().

## SDL_GetBlendModeSrcAlphaFactor()

SDL_BlendFactor SDL_GetBlendModeSrcAlphaFactor | ( | SDL_BlendMode | blendMode | ) |

Definition at line 3363 of file SDL_render.c.

{
blendMode = SDL_GetLongBlendMode(blendMode);
return (SDL_BlendFactor)(((Uint32)blendMode >> 20) & 0xF);
}

References blendMode, and SDL_GetLongBlendMode().

## SDL_GetBlendModeSrcColorFactor()

SDL_BlendFactor SDL_GetBlendModeSrcColorFactor | ( | SDL_BlendMode | blendMode | ) |

Definition at line 3342 of file SDL_render.c.

{
blendMode = SDL_GetLongBlendMode(blendMode);
return (SDL_BlendFactor)(((Uint32)blendMode >> 4) & 0xF);
}

References blendMode, and SDL_GetLongBlendMode().

## Variable Documentation

## D3D11_RenderDriver

SDL_RenderDriver D3D11_RenderDriver

## D3D_RenderDriver

SDL_RenderDriver D3D_RenderDriver

## DirectFB_RenderDriver

SDL_RenderDriver DirectFB_RenderDriver

## GL_RenderDriver

SDL_RenderDriver GL_RenderDriver

## GLES2_RenderDriver

SDL_RenderDriver GLES2_RenderDriver

## GLES_RenderDriver

SDL_RenderDriver GLES_RenderDriver

## METAL_RenderDriver

SDL_RenderDriver METAL_RenderDriver

## PSP_RenderDriver

SDL_RenderDriver PSP_RenderDriver

## SW_RenderDriver

SDL_RenderDriver SW_RenderDriver

Definition at line 866 of file SDL_render_sw.c.

Referenced by SW_CreateRendererForSurface().

SDL_AllocVertGap::len
size_t len
Definition: SDL_sysrender.h:116
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
offset
GLintptr offset
Definition: SDL_opengl_glext.h:538
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
SDL_AllocVertGap::offset
size_t offset
Definition: SDL_sysrender.h:115
NULL
#define NULL
Definition: begin_code.h:167
SDL_ScaleModeNearest
@ SDL_ScaleModeNearest
Definition: SDL_sysrender.h:37
SDL_ScaleModeBest
@ SDL_ScaleModeBest
Definition: SDL_sysrender.h:39
SDL_RenderCommandType
SDL_RenderCommandType
Definition: SDL_sysrender.h:72
SDL_BlendOperation
SDL_BlendOperation
The blend operation used when combining source and destination pixel components.
Definition: SDL_blendmode.h:62
AllocateVertexGap
static SDL_AllocVertGap * AllocateVertexGap(SDL_Renderer *renderer)
Definition: SDL_render.c:267
SDL_AllocVertGap
Definition: SDL_sysrender.h:113
SDL_realloc
#define SDL_realloc
Definition: SDL_dynapi_overrides.h:376
SDL_Renderer::vertex_data
void * vertex_data
Definition: SDL_sysrender.h:226
SDL_Renderer::vertex_data_used
size_t vertex_data_used
Definition: SDL_sysrender.h:227
SDL_ScaleModeLinear
@ SDL_ScaleModeLinear
Definition: SDL_sysrender.h:38
SDL_Renderer::vertex_data_gaps
SDL_AllocVertGap vertex_data_gaps
Definition: SDL_sysrender.h:229
SDL_AllocVertGap::next
struct SDL_AllocVertGap * next
Definition: SDL_sysrender.h:117
SDL_RENDERCMD_COPY
@ SDL_RENDERCMD_COPY
Definition: SDL_sysrender.h:82
SDL_RENDERCMD_SETCLIPRECT
@ SDL_RENDERCMD_SETCLIPRECT
Definition: SDL_sysrender.h:76
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
retval
SDL_bool retval
Definition: testgamecontroller.c:65
SDL_RENDERCMD_SETVIEWPORT
@ SDL_RENDERCMD_SETVIEWPORT
Definition: SDL_sysrender.h:75
SDL_RENDERCMD_DRAW_POINTS
@ SDL_RENDERCMD_DRAW_POINTS
Definition: SDL_sysrender.h:79
SDL_ScaleMode
SDL_ScaleMode
Definition: SDL_sysrender.h:35
SDL_BlendFactor
SDL_BlendFactor
The normalized factor used to multiply pixel components.
Definition: SDL_blendmode.h:75
SDL_Renderer::vertex_data_allocation
size_t vertex_data_allocation
Definition: SDL_sysrender.h:228
SDL_RENDERCMD_NO_OP
@ SDL_RENDERCMD_NO_OP
Definition: SDL_sysrender.h:74
SDL_Renderer::vertex_data_gaps_pool
SDL_AllocVertGap * vertex_data_gaps_pool
Definition: SDL_sysrender.h:230
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
SDL_RENDERCMD_DRAW_LINES
@ SDL_RENDERCMD_DRAW_LINES
Definition: SDL_sysrender.h:80
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_RENDERCMD_FILL_RECTS
@ SDL_RENDERCMD_FILL_RECTS
Definition: SDL_sysrender.h:81
SDL_GetLongBlendMode
static SDL_BlendMode SDL_GetLongBlendMode(SDL_BlendMode blendMode)
Definition: SDL_render.c:3313
SDL_RENDERCMD_COPY_EX
@ SDL_RENDERCMD_COPY_EX
Definition: SDL_sysrender.h:83
renderer
static SDL_Renderer * renderer
Definition: testaudiocapture.c:21
SDL_RENDERCMD_SETDRAWCOLOR
@ SDL_RENDERCMD_SETDRAWCOLOR
Definition: SDL_sysrender.h:77
SDL_RENDERCMD_CLEAR
@ SDL_RENDERCMD_CLEAR
Definition: SDL_sysrender.h:78
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179