Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Made it possible to disable the rendering subsystem with configure --…
Browse files Browse the repository at this point in the history
…disable-render
  • Loading branch information
slouken committed Feb 8, 2011
1 parent 7c0c1e8 commit b0d2e83
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 10 deletions.
6 changes: 6 additions & 0 deletions configure.in
Expand Up @@ -362,6 +362,12 @@ AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
if test x$enable_video != xyes; then
AC_DEFINE(SDL_VIDEO_DISABLED)
fi
AC_ARG_ENABLE(render,
AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
, enable_render=yes)
if test x$enable_render != xyes; then
AC_DEFINE(SDL_RENDER_DISABLED)
fi
AC_ARG_ENABLE(events,
AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
, enable_events=yes)
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config.h.in
Expand Up @@ -179,6 +179,7 @@
#undef SDL_JOYSTICK_DISABLED
#undef SDL_HAPTIC_DISABLED
#undef SDL_LOADSO_DISABLED
#undef SDL_RENDER_DISABLED
#undef SDL_THREADS_DISABLED
#undef SDL_TIMERS_DISABLED
#undef SDL_VIDEO_DISABLED
Expand Down
7 changes: 7 additions & 0 deletions src/render/SDL_render.c
Expand Up @@ -45,6 +45,7 @@


static const SDL_RenderDriver *render_drivers[] = {
#if !SDL_RENDER_DISABLED
#if SDL_VIDEO_RENDER_D3D
&D3D_RenderDriver,
#endif
Expand All @@ -61,6 +62,7 @@ static const SDL_RenderDriver *render_drivers[] = {
&DirectFB_RenderDriver,
#endif
&SW_RenderDriver
#endif /* !SDL_RENDER_DISABLED */
};
static char renderer_magic;
static char texture_magic;
Expand Down Expand Up @@ -170,7 +172,12 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
SDL_Renderer *
SDL_CreateSoftwareRenderer(SDL_Surface * surface)
{
#if !SDL_RENDER_DISABLED
return SW_CreateRendererForSurface(surface);
#else
SDL_SetError("SDL not built with rendering support");
return NULL;
#endif /* !SDL_RENDER_DISABLED */
}

int
Expand Down
4 changes: 4 additions & 0 deletions src/render/SDL_sysrender.h
Expand Up @@ -119,6 +119,8 @@ struct SDL_RenderDriver
SDL_RendererInfo info;
};

#if !SDL_RENDER_DISABLED

#if SDL_VIDEO_RENDER_D3D
extern SDL_RenderDriver D3D_RenderDriver;
#endif
Expand All @@ -136,6 +138,8 @@ extern SDL_RenderDriver DirectFB_RenderDriver;
#endif
extern SDL_RenderDriver SW_RenderDriver;

#endif /* !SDL_RENDER_DISABLED */

#endif /* _SDL_sysrender_h */

/* vi: set ts=4 sw=4 expandtab: */
5 changes: 3 additions & 2 deletions src/render/direct3d/SDL_render_d3d.c
Expand Up @@ -21,7 +21,8 @@
*/
#include "SDL_config.h"

#if SDL_VIDEO_RENDER_D3D
#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED


#include "../../core/windows/SDL_windows.h"

Expand Down Expand Up @@ -1066,6 +1067,6 @@ D3D_DestroyRenderer(SDL_Renderer * renderer)
SDL_free(renderer);
}

#endif /* SDL_VIDEO_RENDER_D3D */
#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 2 additions & 2 deletions src/render/opengl/SDL_render_gl.c
Expand Up @@ -21,7 +21,7 @@
*/
#include "SDL_config.h"

#if SDL_VIDEO_RENDER_OGL
#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED

#include "SDL_opengl.h"
#include "../SDL_sysrender.h"
Expand Down Expand Up @@ -841,6 +841,6 @@ GL_DestroyRenderer(SDL_Renderer * renderer)
SDL_free(renderer);
}

#endif /* SDL_VIDEO_RENDER_OGL */
#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 2 additions & 2 deletions src/render/opengles/SDL_render_gles.c
Expand Up @@ -21,7 +21,7 @@
*/
#include "SDL_config.h"

#if SDL_VIDEO_RENDER_OGL_ES
#if SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED

#include "SDL_opengles.h"
#include "../SDL_sysrender.h"
Expand Down Expand Up @@ -728,6 +728,6 @@ GLES_DestroyRenderer(SDL_Renderer * renderer)
SDL_free(renderer);
}

#endif /* SDL_VIDEO_RENDER_OGL_ES */
#endif /* SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 2 additions & 2 deletions src/render/opengles2/SDL_render_gles2.c
Expand Up @@ -23,7 +23,7 @@

#include "SDL_config.h"

#if SDL_VIDEO_RENDER_OGL_ES2
#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED

#include "SDL_opengles2.h"
#include "../SDL_sysrender.h"
Expand Down Expand Up @@ -1201,6 +1201,6 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
return renderer;
}

#endif /* SDL_VIDEO_RENDER_OGL_ES2 */
#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 2 additions & 2 deletions src/render/opengles2/SDL_shaders_gles2.c
Expand Up @@ -23,7 +23,7 @@

#include "SDL_config.h"

#if SDL_VIDEO_RENDER_OGL_ES2
#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED

#include "SDL_video.h"
#include "SDL_opengles2.h"
Expand Down Expand Up @@ -539,6 +539,6 @@ const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMo
}
}

#endif /* SDL_VIDEO_RENDER_OGL_ES2 */
#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 4 additions & 0 deletions src/render/software/SDL_blendfillrect.c
Expand Up @@ -21,6 +21,8 @@
*/
#include "SDL_config.h"

#if !SDL_RENDER_DISABLED

#include "SDL_draw.h"
#include "SDL_blendfillrect.h"

Expand Down Expand Up @@ -345,4 +347,6 @@ SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect ** rects, int count,
return status;
}

#endif /* !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 4 additions & 0 deletions src/render/software/SDL_blendline.c
Expand Up @@ -21,6 +21,8 @@
*/
#include "SDL_config.h"

#if !SDL_RENDER_DISABLED

#include "SDL_draw.h"
#include "SDL_blendline.h"
#include "SDL_blendpoint.h"
Expand Down Expand Up @@ -779,4 +781,6 @@ SDL_BlendLines(SDL_Surface * dst, const SDL_Point * points, int count,
return 0;
}

#endif /* !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 4 additions & 0 deletions src/render/software/SDL_blendpoint.c
Expand Up @@ -21,6 +21,8 @@
*/
#include "SDL_config.h"

#if !SDL_RENDER_DISABLED

#include "SDL_draw.h"
#include "SDL_blendpoint.h"

Expand Down Expand Up @@ -343,4 +345,6 @@ SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count,
return status;
}

#endif /* !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 4 additions & 0 deletions src/render/software/SDL_drawline.c
Expand Up @@ -21,6 +21,8 @@
*/
#include "SDL_config.h"

#if !SDL_RENDER_DISABLED

#include "SDL_draw.h"
#include "SDL_drawline.h"
#include "SDL_drawpoint.h"
Expand Down Expand Up @@ -208,4 +210,6 @@ SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count,
return 0;
}

#endif /* !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 4 additions & 0 deletions src/render/software/SDL_drawpoint.c
Expand Up @@ -21,6 +21,8 @@
*/
#include "SDL_config.h"

#if !SDL_RENDER_DISABLED

#include "SDL_draw.h"
#include "SDL_drawpoint.h"

Expand Down Expand Up @@ -114,4 +116,6 @@ SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count,
return 0;
}

#endif /* !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */
4 changes: 4 additions & 0 deletions src/render/software/SDL_render_sw.c
Expand Up @@ -21,6 +21,8 @@
*/
#include "SDL_config.h"

#if !SDL_RENDER_DISABLED

#include "../SDL_sysrender.h"
#include "../../video/SDL_pixels_c.h"

Expand Down Expand Up @@ -428,4 +430,6 @@ SW_DestroyRenderer(SDL_Renderer * renderer)
SDL_free(renderer);
}

#endif /* !SDL_RENDER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */

0 comments on commit b0d2e83

Please sign in to comment.