Mercurial > repos > blastem
diff render_sdl.c @ 495:39cad98d2789
Allow OpenGL support to be disabled at compile time. Move generic utility functions out of config.c
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 28 Oct 2013 19:37:30 -0700 |
parents | c8e65962bfed |
children | 0820a71b80f3 |
line wrap: on
line diff
--- a/render_sdl.c Sun Oct 27 22:08:02 2013 -0700 +++ b/render_sdl.c Mon Oct 28 19:37:30 2013 -0700 @@ -97,6 +97,7 @@ } } +#ifndef DISABLE_OPENGL GLuint textures[3], buffers[2], vshader, fshader, program, un_textures[2], at_pos; const GLfloat vertex_data[] = { @@ -142,9 +143,11 @@ } return ret; } +#endif void render_alloc_surfaces(vdp_context * context) { +#ifndef DISABLE_OPENGL if (render_gl) { context->oddbuf = context->framebuf = malloc(320 * 240 * 4 * 2); memset(context->oddbuf, 0, 320 * 240 * 4 * 2); @@ -185,9 +188,12 @@ un_textures[1] = glGetUniformLocation(program, "textures[1]"); at_pos = glGetAttribLocation(program, "pos"); } else { +#endif context->oddbuf = context->framebuf = malloc(320 * 240 * screen->format->BytesPerPixel * 2); context->evenbuf = ((char *)context->oddbuf) + 320 * 240 * screen->format->BytesPerPixel; +#ifndef DISABLE_OPENGL } +#endif } uint8_t render_depth() @@ -320,7 +326,7 @@ } SDL_JoystickEventState(SDL_ENABLE); } - +#ifndef DISABLE_OPENGL void render_context_gl(vdp_context * context) { glBindTexture(GL_TEXTURE_2D, textures[context->framebuf == context->oddbuf ? 0 : 1]); @@ -353,6 +359,7 @@ context->framebuf = context->framebuf == context->oddbuf ? context->evenbuf : context->oddbuf; } } +#endif uint32_t blankbuf[320*240]; @@ -362,11 +369,13 @@ uint32_t *buf_32; uint8_t b,g,r; last_frame = SDL_GetTicks(); +#ifndef DISABLE_OPENGL if (render_gl) { render_context_gl(context); return; } +#endif if (SDL_MUSTLOCK(screen)) { if (SDL_LockSurface(screen) < 0) { return;