Add SDL_HAVE_RENDER_GEOMETRY to compile or not with RenderGeometry support
parent
b9bd9da78f
commit
47db47c1cc
|
@ -116,6 +116,12 @@
|
||||||
#define SDL_HAVE_YUV !SDL_LEAN_AND_MEAN
|
#define SDL_HAVE_YUV !SDL_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* SDL Renderer
|
||||||
|
- SDL_RenderGeometry() */
|
||||||
|
#ifndef SDL_HAVE_RENDER_GEOMETRY
|
||||||
|
#define SDL_HAVE_RENDER_GEOMETRY !SDL_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "SDL_assert.h"
|
#include "SDL_assert.h"
|
||||||
#include "SDL_log.h"
|
#include "SDL_log.h"
|
||||||
|
|
||||||
|
|
|
@ -572,6 +572,7 @@ QueueCmdCopyEx(SDL_Renderer *renderer, SDL_Texture * texture,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
static int
|
static int
|
||||||
QueueCmdGeometry(SDL_Renderer *renderer, SDL_Texture *texture,
|
QueueCmdGeometry(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const float *xy, int xy_stride,
|
const float *xy, int xy_stride,
|
||||||
|
@ -599,6 +600,7 @@ QueueCmdGeometry(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int UpdateLogicalSize(SDL_Renderer *renderer);
|
static int UpdateLogicalSize(SDL_Renderer *renderer);
|
||||||
|
|
||||||
|
@ -3359,6 +3361,7 @@ SDL_RenderGeometry(SDL_Renderer *renderer,
|
||||||
return SDL_RenderGeometryRaw(renderer, texture, xy, xy_stride, color, color_stride, uv, uv_stride, num_vertices, indices, num_indices, size_indice);
|
return SDL_RenderGeometryRaw(renderer, texture, xy, xy_stride, color, color_stride, uv, uv_stride, num_vertices, indices, num_indices, size_indice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
static int
|
static int
|
||||||
remap_one_indice(
|
remap_one_indice(
|
||||||
int prev,
|
int prev,
|
||||||
|
@ -3696,6 +3699,7 @@ end:
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_RenderGeometryRaw(SDL_Renderer *renderer,
|
SDL_RenderGeometryRaw(SDL_Renderer *renderer,
|
||||||
|
@ -3706,6 +3710,7 @@ SDL_RenderGeometryRaw(SDL_Renderer *renderer,
|
||||||
int num_vertices,
|
int num_vertices,
|
||||||
const void *indices, int num_indices, int size_indice)
|
const void *indices, int num_indices, int size_indice)
|
||||||
{
|
{
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
int i;
|
int i;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
int count = indices ? num_indices : num_vertices;
|
int count = indices ? num_indices : num_vertices;
|
||||||
|
@ -3806,8 +3811,12 @@ SDL_RenderGeometryRaw(SDL_Renderer *renderer,
|
||||||
renderer->scale.x, renderer->scale.y);
|
renderer->scale.x, renderer->scale.y);
|
||||||
|
|
||||||
return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer);
|
return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer);
|
||||||
|
#else
|
||||||
|
return SDL_SetError("SDL not built with RenderGeometry support");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||||
Uint32 format, void * pixels, int pitch)
|
Uint32 format, void * pixels, int pitch)
|
||||||
|
|
|
@ -129,11 +129,12 @@ struct SDL_Renderer
|
||||||
int (*QueueCopyEx) (SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture,
|
int (*QueueCopyEx) (SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture,
|
||||||
const SDL_Rect * srcquad, const SDL_FRect * dstrect,
|
const SDL_Rect * srcquad, const SDL_FRect * dstrect,
|
||||||
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
|
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
int (*QueueGeometry) (SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
int (*QueueGeometry) (SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
||||||
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
||||||
int num_vertices, const void *indices, int num_indices, int size_indice,
|
int num_vertices, const void *indices, int num_indices, int size_indice,
|
||||||
float scale_x, float scale_y);
|
float scale_x, float scale_y);
|
||||||
|
#endif
|
||||||
|
|
||||||
int (*RunCommandQueue) (SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize);
|
int (*RunCommandQueue) (SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize);
|
||||||
int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
|
int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
|
|
|
@ -1020,6 +1020,7 @@ D3D_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * t
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
static int
|
static int
|
||||||
D3D_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
D3D_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
||||||
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
||||||
|
@ -1071,6 +1072,7 @@ D3D_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
UpdateDirtyTexture(IDirect3DDevice9 *device, D3D_TextureRep *texture)
|
UpdateDirtyTexture(IDirect3DDevice9 *device, D3D_TextureRep *texture)
|
||||||
|
@ -1486,6 +1488,7 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_RENDERCMD_GEOMETRY: {
|
case SDL_RENDERCMD_GEOMETRY: {
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
const size_t count = cmd->data.draw.count;
|
const size_t count = cmd->data.draw.count;
|
||||||
const size_t first = cmd->data.draw.first;
|
const size_t first = cmd->data.draw.first;
|
||||||
SetDrawState(data, cmd);
|
SetDrawState(data, cmd);
|
||||||
|
@ -1495,6 +1498,7 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
|
||||||
const Vertex* verts = (Vertex*)(((Uint8*)vertices) + first);
|
const Vertex* verts = (Vertex*)(((Uint8*)vertices) + first);
|
||||||
IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLELIST, (UINT) count, verts, sizeof(Vertex));
|
IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLELIST, (UINT) count, verts, sizeof(Vertex));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1792,7 +1796,9 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
renderer->QueueFillRects = D3D_QueueFillRects;
|
renderer->QueueFillRects = D3D_QueueFillRects;
|
||||||
renderer->QueueCopy = D3D_QueueCopy;
|
renderer->QueueCopy = D3D_QueueCopy;
|
||||||
renderer->QueueCopyEx = D3D_QueueCopyEx;
|
renderer->QueueCopyEx = D3D_QueueCopyEx;
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
renderer->QueueGeometry = D3D_QueueGeometry;
|
renderer->QueueGeometry = D3D_QueueGeometry;
|
||||||
|
#endif
|
||||||
renderer->RunCommandQueue = D3D_RunCommandQueue;
|
renderer->RunCommandQueue = D3D_RunCommandQueue;
|
||||||
renderer->RenderReadPixels = D3D_RenderReadPixels;
|
renderer->RenderReadPixels = D3D_RenderReadPixels;
|
||||||
renderer->RenderPresent = D3D_RenderPresent;
|
renderer->RenderPresent = D3D_RenderPresent;
|
||||||
|
|
|
@ -1865,6 +1865,7 @@ D3D11_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
static int
|
static int
|
||||||
D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
||||||
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
||||||
|
@ -1919,6 +1920,7 @@ D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
|
D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
|
||||||
|
@ -2402,6 +2404,7 @@ D3D11_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_RENDERCMD_GEOMETRY: {
|
case SDL_RENDERCMD_GEOMETRY: {
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
const size_t count = cmd->data.draw.count;
|
const size_t count = cmd->data.draw.count;
|
||||||
const size_t first = cmd->data.draw.first;
|
const size_t first = cmd->data.draw.first;
|
||||||
|
@ -2414,6 +2417,7 @@ D3D11_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, start, count);
|
D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, start, count);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2632,7 +2636,9 @@ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
renderer->QueueFillRects = D3D11_QueueFillRects;
|
renderer->QueueFillRects = D3D11_QueueFillRects;
|
||||||
renderer->QueueCopy = D3D11_QueueCopy;
|
renderer->QueueCopy = D3D11_QueueCopy;
|
||||||
renderer->QueueCopyEx = D3D11_QueueCopyEx;
|
renderer->QueueCopyEx = D3D11_QueueCopyEx;
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
renderer->QueueGeometry = D3D11_QueueGeometry;
|
renderer->QueueGeometry = D3D11_QueueGeometry;
|
||||||
|
#endif
|
||||||
renderer->RunCommandQueue = D3D11_RunCommandQueue;
|
renderer->RunCommandQueue = D3D11_RunCommandQueue;
|
||||||
renderer->RenderReadPixels = D3D11_RenderReadPixels;
|
renderer->RenderReadPixels = D3D11_RenderReadPixels;
|
||||||
renderer->RenderPresent = D3D11_RenderPresent;
|
renderer->RenderPresent = D3D11_RenderPresent;
|
||||||
|
|
|
@ -1318,6 +1318,7 @@ METAL_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
static int
|
static int
|
||||||
METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
||||||
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
||||||
|
@ -1362,6 +1363,7 @@ METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -1622,6 +1624,7 @@ METAL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_RENDERCMD_GEOMETRY: {
|
case SDL_RENDERCMD_GEOMETRY: {
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
const size_t count = cmd->data.draw.count;
|
const size_t count = cmd->data.draw.count;
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
|
|
||||||
|
@ -1632,6 +1635,7 @@ METAL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
|
||||||
SetDrawState(renderer, cmd, SDL_METAL_FRAGMENT_SOLID, CONSTANTS_OFFSET_IDENTITY, mtlbufvertex, &statecache);
|
SetDrawState(renderer, cmd, SDL_METAL_FRAGMENT_SOLID, CONSTANTS_OFFSET_IDENTITY, mtlbufvertex, &statecache);
|
||||||
[data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:count];
|
[data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:count];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1997,7 +2001,9 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
renderer->QueueFillRects = METAL_QueueFillRects;
|
renderer->QueueFillRects = METAL_QueueFillRects;
|
||||||
renderer->QueueCopy = METAL_QueueCopy;
|
renderer->QueueCopy = METAL_QueueCopy;
|
||||||
renderer->QueueCopyEx = METAL_QueueCopyEx;
|
renderer->QueueCopyEx = METAL_QueueCopyEx;
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
renderer->QueueGeometry = METAL_QueueGeometry;
|
renderer->QueueGeometry = METAL_QueueGeometry;
|
||||||
|
#endif
|
||||||
renderer->RunCommandQueue = METAL_RunCommandQueue;
|
renderer->RunCommandQueue = METAL_RunCommandQueue;
|
||||||
renderer->RenderReadPixels = METAL_RenderReadPixels;
|
renderer->RenderReadPixels = METAL_RenderReadPixels;
|
||||||
renderer->RenderPresent = METAL_RenderPresent;
|
renderer->RenderPresent = METAL_RenderPresent;
|
||||||
|
|
|
@ -1051,6 +1051,7 @@ GL_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * te
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
static int
|
static int
|
||||||
GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
||||||
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
||||||
|
@ -1107,6 +1108,7 @@ GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader shader)
|
SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader shader)
|
||||||
|
@ -1430,6 +1432,7 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_RENDERCMD_GEOMETRY: {
|
case SDL_RENDERCMD_GEOMETRY: {
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first);
|
const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first);
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
const size_t count = cmd->data.draw.count;
|
const size_t count = cmd->data.draw.count;
|
||||||
|
@ -1467,6 +1470,7 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
|
||||||
data->glEnd();
|
data->glEnd();
|
||||||
data->glColor4f(currentColor[0], currentColor[1], currentColor[2], currentColor[3]);
|
data->glColor4f(currentColor[0], currentColor[1], currentColor[2], currentColor[3]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1752,7 +1756,9 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
renderer->QueueFillRects = GL_QueueFillRects;
|
renderer->QueueFillRects = GL_QueueFillRects;
|
||||||
renderer->QueueCopy = GL_QueueCopy;
|
renderer->QueueCopy = GL_QueueCopy;
|
||||||
renderer->QueueCopyEx = GL_QueueCopyEx;
|
renderer->QueueCopyEx = GL_QueueCopyEx;
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
renderer->QueueGeometry = GL_QueueGeometry;
|
renderer->QueueGeometry = GL_QueueGeometry;
|
||||||
|
#endif
|
||||||
renderer->RunCommandQueue = GL_RunCommandQueue;
|
renderer->RunCommandQueue = GL_RunCommandQueue;
|
||||||
renderer->RenderReadPixels = GL_RenderReadPixels;
|
renderer->RenderReadPixels = GL_RenderReadPixels;
|
||||||
renderer->RenderPresent = GL_RenderPresent;
|
renderer->RenderPresent = GL_RenderPresent;
|
||||||
|
|
|
@ -755,6 +755,7 @@ GLES_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
static int
|
static int
|
||||||
GLES_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
GLES_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
||||||
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
||||||
|
@ -811,6 +812,7 @@ GLES_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SetDrawState(GLES_RenderData *data, const SDL_RenderCommand *cmd)
|
SetDrawState(GLES_RenderData *data, const SDL_RenderCommand *cmd)
|
||||||
|
@ -1046,6 +1048,7 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_RENDERCMD_GEOMETRY: {
|
case SDL_RENDERCMD_GEOMETRY: {
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first);
|
const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first);
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
const size_t count = cmd->data.draw.count;
|
const size_t count = cmd->data.draw.count;
|
||||||
|
@ -1068,7 +1071,7 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
|
||||||
data->glDrawArrays(GL_TRIANGLES, 0, (GLsizei) count);
|
data->glDrawArrays(GL_TRIANGLES, 0, (GLsizei) count);
|
||||||
|
|
||||||
data->glDisableClientState(GL_COLOR_ARRAY);
|
data->glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1282,7 +1285,9 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
renderer->QueueFillRects = GLES_QueueFillRects;
|
renderer->QueueFillRects = GLES_QueueFillRects;
|
||||||
renderer->QueueCopy = GLES_QueueCopy;
|
renderer->QueueCopy = GLES_QueueCopy;
|
||||||
renderer->QueueCopyEx = GLES_QueueCopyEx;
|
renderer->QueueCopyEx = GLES_QueueCopyEx;
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
renderer->QueueGeometry = GLES_QueueGeometry;
|
renderer->QueueGeometry = GLES_QueueGeometry;
|
||||||
|
#endif
|
||||||
renderer->RunCommandQueue = GLES_RunCommandQueue;
|
renderer->RunCommandQueue = GLES_RunCommandQueue;
|
||||||
renderer->RenderReadPixels = GLES_RenderReadPixels;
|
renderer->RenderReadPixels = GLES_RenderReadPixels;
|
||||||
renderer->RenderPresent = GLES_RenderPresent;
|
renderer->RenderPresent = GLES_RenderPresent;
|
||||||
|
|
|
@ -937,6 +937,7 @@ GLES2_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
static int
|
static int
|
||||||
GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
||||||
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
|
||||||
|
@ -996,6 +997,7 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_ImageSource imgsrc)
|
SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_ImageSource imgsrc)
|
||||||
|
@ -1373,6 +1375,7 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_RENDERCMD_GEOMETRY: {
|
case SDL_RENDERCMD_GEOMETRY: {
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
const size_t count = cmd->data.draw.count;
|
const size_t count = cmd->data.draw.count;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1386,6 +1389,7 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
data->glDrawArrays(GL_TRIANGLES, 0, (GLsizei) count);
|
data->glDrawArrays(GL_TRIANGLES, 0, (GLsizei) count);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2183,7 +2187,9 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||||
renderer->QueueFillRects = GLES2_QueueFillRects;
|
renderer->QueueFillRects = GLES2_QueueFillRects;
|
||||||
renderer->QueueCopy = GLES2_QueueCopy;
|
renderer->QueueCopy = GLES2_QueueCopy;
|
||||||
renderer->QueueCopyEx = GLES2_QueueCopyEx;
|
renderer->QueueCopyEx = GLES2_QueueCopyEx;
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
renderer->QueueGeometry = GLES2_QueueGeometry;
|
renderer->QueueGeometry = GLES2_QueueGeometry;
|
||||||
|
#endif
|
||||||
renderer->RunCommandQueue = GLES2_RunCommandQueue;
|
renderer->RunCommandQueue = GLES2_RunCommandQueue;
|
||||||
renderer->RenderReadPixels = GLES2_RenderReadPixels;
|
renderer->RenderReadPixels = GLES2_RenderReadPixels;
|
||||||
renderer->RenderPresent = GLES2_RenderPresent;
|
renderer->RenderPresent = GLES2_RenderPresent;
|
||||||
|
|
|
@ -562,6 +562,7 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
typedef struct GeometryFillData
|
typedef struct GeometryFillData
|
||||||
{
|
{
|
||||||
SDL_Point dst;
|
SDL_Point dst;
|
||||||
|
@ -657,6 +658,7 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrepTextureForCopy(const SDL_RenderCommand *cmd)
|
PrepTextureForCopy(const SDL_RenderCommand *cmd)
|
||||||
|
@ -833,6 +835,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_RENDERCMD_GEOMETRY: {
|
case SDL_RENDERCMD_GEOMETRY: {
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
int i;
|
int i;
|
||||||
SDL_Rect *verts = (SDL_Rect *) (((Uint8 *) vertices) + cmd->data.draw.first);
|
SDL_Rect *verts = (SDL_Rect *) (((Uint8 *) vertices) + cmd->data.draw.first);
|
||||||
const int count = (int) cmd->data.draw.count;
|
const int count = (int) cmd->data.draw.count;
|
||||||
|
@ -861,7 +864,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
|
||||||
SDL_SW_FillTriangle(surface, &(ptr[0].dst), &(ptr[1].dst), &(ptr[2].dst), blend, ptr[0].color, ptr[1].color, ptr[2].color);
|
SDL_SW_FillTriangle(surface, &(ptr[0].dst), &(ptr[1].dst), &(ptr[2].dst), blend, ptr[0].color, ptr[1].color, ptr[2].color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -974,7 +977,9 @@ SW_CreateRendererForSurface(SDL_Surface * surface)
|
||||||
renderer->QueueFillRects = SW_QueueFillRects;
|
renderer->QueueFillRects = SW_QueueFillRects;
|
||||||
renderer->QueueCopy = SW_QueueCopy;
|
renderer->QueueCopy = SW_QueueCopy;
|
||||||
renderer->QueueCopyEx = SW_QueueCopyEx;
|
renderer->QueueCopyEx = SW_QueueCopyEx;
|
||||||
|
#if SDL_HAVE_RENDER_GEOMETRY
|
||||||
renderer->QueueGeometry = SW_QueueGeometry;
|
renderer->QueueGeometry = SW_QueueGeometry;
|
||||||
|
#endif
|
||||||
renderer->RunCommandQueue = SW_RunCommandQueue;
|
renderer->RunCommandQueue = SW_RunCommandQueue;
|
||||||
renderer->RenderReadPixels = SW_RenderReadPixels;
|
renderer->RenderReadPixels = SW_RenderReadPixels;
|
||||||
renderer->RenderPresent = SW_RenderPresent;
|
renderer->RenderPresent = SW_RenderPresent;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../SDL_internal.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED
|
#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED && SDL_HAVE_RENDER_GEOMETRY
|
||||||
|
|
||||||
#include "SDL_surface.h"
|
#include "SDL_surface.h"
|
||||||
#include "SDL_triangle.h"
|
#include "SDL_triangle.h"
|
||||||
|
|
Loading…
Reference in New Issue