Making the API simpler, the renderer present semantics are always having a backbuffer and then discarding it. This is best for hardware accelerated rendering.
authorSam Lantinga <slouken@libsdl.org>
Tue, 01 Feb 2011 12:19:46 -0800
changeset 5142c8e049de174c
parent 5141 31e7f523ab3d
child 5143 b52793134276
Making the API simpler, the renderer present semantics are always having a backbuffer and then discarding it. This is best for hardware accelerated rendering.
include/SDL_video.h
src/SDL_compat.c
src/video/SDL_renderer_gl.c
src/video/SDL_renderer_gles.c
src/video/SDL_renderer_sw.c
src/video/directfb/SDL_DirectFB_render.c
src/video/dummy/SDL_nullrender.c
src/video/nds/SDL_ndsrender.c
src/video/windows/SDL_d3drender.c
test/common.c
test/testshape.c
     1.1 --- a/include/SDL_video.h	Mon Jan 31 23:37:30 2011 -0800
     1.2 +++ b/include/SDL_video.h	Tue Feb 01 12:19:46 2011 -0800
     1.3 @@ -151,33 +151,12 @@
     1.4   */
     1.5  typedef enum
     1.6  {
     1.7 -    SDL_RENDERER_SINGLEBUFFER = 0x00000001,     /**< Render directly to the 
     1.8 -                                                     window, if possible */
     1.9 -    
    1.10 -    SDL_RENDERER_PRESENTCOPY = 0x00000002,      /**< Present uses a copy from 
    1.11 -                                                     back buffer to the front 
    1.12 -                                                     buffer */
    1.13 -    
    1.14 -    SDL_RENDERER_PRESENTFLIP2 = 0x00000004,     /**< Present uses a flip, 
    1.15 -                                                     swapping back buffer and 
    1.16 -                                                     front buffer */
    1.17 -    
    1.18 -    SDL_RENDERER_PRESENTFLIP3 = 0x00000008,     /**< Present uses a flip, 
    1.19 -                                                     rotating between two back 
    1.20 -                                                     buffers and a front buffer
    1.21 -                                                 */
    1.22 -    
    1.23 -    SDL_RENDERER_PRESENTDISCARD = 0x00000010,   /**< Present leaves the contents
    1.24 -                                                     of the backbuffer undefined
    1.25 -                                                 */
    1.26 -    
    1.27      SDL_RENDERER_PRESENTVSYNC = 0x00000020,     /**< Present is synchronized 
    1.28                                                       with the refresh rate */
    1.29      
    1.30      SDL_RENDERER_ACCELERATED = 0x00000040       /**< The renderer uses hardware 
    1.31                                                       acceleration */
    1.32 -    
    1.33 -    } SDL_RendererFlags;
    1.34 +} SDL_RendererFlags;
    1.35  
    1.36  /**
    1.37   *  \brief Information on the capabilities of a render driver or context.
     2.1 --- a/src/SDL_compat.c	Mon Jan 31 23:37:30 2011 -0800
     2.2 +++ b/src/SDL_compat.c	Tue Feb 01 12:19:46 2011 -0800
     2.3 @@ -667,9 +667,7 @@
     2.4      }
     2.5  
     2.6      /* Create a renderer for the window */
     2.7 -    if (SDL_CreateRenderer
     2.8 -        (SDL_VideoWindow, -1,
     2.9 -         SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD) < 0) {
    2.10 +    if (SDL_CreateRenderer(SDL_VideoWindow, -1, 0) < 0) {
    2.11          return NULL;
    2.12      }
    2.13      SDL_GetRendererInfo(&SDL_VideoRendererInfo);
    2.14 @@ -861,6 +859,7 @@
    2.15  SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects)
    2.16  {
    2.17      int i;
    2.18 +    SDL_Rect rect;
    2.19  
    2.20      if (screen == SDL_ShadowSurface) {
    2.21          for (i = 0; i < numrects; ++i) {
    2.22 @@ -887,18 +886,11 @@
    2.23                  SDL_UpdateTexture(SDL_VideoTexture, rect, pixels, pitch);
    2.24              }
    2.25          }
    2.26 -        if (SDL_VideoRendererInfo.flags & SDL_RENDERER_PRESENTCOPY) {
    2.27 -            for (i = 0; i < numrects; ++i) {
    2.28 -                SDL_RenderCopy(SDL_VideoTexture, &rects[i], &rects[i]);
    2.29 -            }
    2.30 -        } else {
    2.31 -            SDL_Rect rect;
    2.32 -            rect.x = 0;
    2.33 -            rect.y = 0;
    2.34 -            rect.w = screen->w;
    2.35 -            rect.h = screen->h;
    2.36 -            SDL_RenderCopy(SDL_VideoTexture, &rect, &rect);
    2.37 -        }
    2.38 +        rect.x = 0;
    2.39 +        rect.y = 0;
    2.40 +        rect.w = screen->w;
    2.41 +        rect.h = screen->h;
    2.42 +        SDL_RenderCopy(SDL_VideoTexture, &rect, &rect);
    2.43          SDL_RenderPresent();
    2.44      }
    2.45  }
     3.1 --- a/src/video/SDL_renderer_gl.c	Mon Jan 31 23:37:30 2011 -0800
     3.2 +++ b/src/video/SDL_renderer_gl.c	Tue Feb 01 12:19:46 2011 -0800
     3.3 @@ -112,8 +112,7 @@
     3.4      GL_CreateRenderer,
     3.5      {
     3.6       "opengl",
     3.7 -     (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD |
     3.8 -      SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
     3.9 +     (SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
    3.10       15,
    3.11       {
    3.12        SDL_PIXELFORMAT_INDEX1LSB,
    3.13 @@ -252,7 +251,6 @@
    3.14      SDL_Renderer *renderer;
    3.15      GL_RenderData *data;
    3.16      GLint value;
    3.17 -    int doublebuffer;
    3.18  
    3.19      /* Render directly to the window, unless we're compositing */
    3.20  #ifndef __MACOSX__
    3.21 @@ -304,8 +302,7 @@
    3.22      renderer->window = window;
    3.23      renderer->driverdata = data;
    3.24  
    3.25 -    renderer->info.flags =
    3.26 -        (SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED);
    3.27 +    renderer->info.flags = SDL_RENDERER_ACCELERATED;
    3.28  
    3.29      if (GL_LoadFunctions(data) < 0) {
    3.30          GL_DestroyRenderer(renderer);
    3.31 @@ -337,12 +334,6 @@
    3.32          renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
    3.33      }
    3.34  
    3.35 -    if (SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuffer) == 0) {
    3.36 -        if (!doublebuffer) {
    3.37 -            renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER;
    3.38 -        }
    3.39 -    }
    3.40 -
    3.41      data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
    3.42      renderer->info.max_texture_width = value;
    3.43      data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
     4.1 --- a/src/video/SDL_renderer_gles.c	Mon Jan 31 23:37:30 2011 -0800
     4.2 +++ b/src/video/SDL_renderer_gles.c	Tue Feb 01 12:19:46 2011 -0800
     4.3 @@ -98,8 +98,7 @@
     4.4      GLES_CreateRenderer,
     4.5      {
     4.6       "opengl_es",
     4.7 -     (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD |
     4.8 -      SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
     4.9 +     (SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
    4.10       {
    4.11        /* OpenGL ES 1.x supported formats list */
    4.12        SDL_PIXELFORMAT_RGBA4444,
    4.13 @@ -241,8 +240,7 @@
    4.14      renderer->window = window;
    4.15      renderer->driverdata = data;
    4.16  
    4.17 -    renderer->info.flags =
    4.18 -        (SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED);
    4.19 +    renderer->info.flags = SDL_RENDERER_ACCELERATED;
    4.20  
    4.21  #if defined(__QNXNTO__)
    4.22  #if _NTO_VERSION<=641
     5.1 --- a/src/video/SDL_renderer_sw.c	Mon Jan 31 23:37:30 2011 -0800
     5.2 +++ b/src/video/SDL_renderer_sw.c	Tue Feb 01 12:19:46 2011 -0800
     5.3 @@ -81,9 +81,7 @@
     5.4      SW_CreateRenderer,
     5.5      {
     5.6       "software",
     5.7 -     (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
     5.8 -      SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
     5.9 -      SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC),
    5.10 +     (SDL_RENDERER_PRESENTVSYNC),
    5.11       14,
    5.12       {
    5.13        SDL_PIXELFORMAT_INDEX8,
    5.14 @@ -108,8 +106,7 @@
    5.15  {
    5.16      Uint32 format;
    5.17      SDL_bool updateSize;
    5.18 -    int current_texture;
    5.19 -    SDL_Texture *texture[3];
    5.20 +    SDL_Texture *texture;
    5.21      SDL_Surface surface;
    5.22      SDL_Renderer *renderer;
    5.23      SDL_DirtyRectList dirty;
    5.24 @@ -150,15 +147,11 @@
    5.25  DisplayPaletteChanged(void *userdata, SDL_Palette * palette)
    5.26  {
    5.27      SW_RenderData *data = (SW_RenderData *) userdata;
    5.28 -    int i;
    5.29  
    5.30 -    for (i = 0; i < SDL_arraysize(data->texture); ++i) {
    5.31 -        if (data->texture[i] && data->renderer->SetTexturePalette) {
    5.32 -            data->renderer->SetTexturePalette(data->renderer,
    5.33 -                                              data->texture[i],
    5.34 -                                              palette->colors, 0,
    5.35 -                                              palette->ncolors);
    5.36 -        }
    5.37 +    if (data->renderer->SetTexturePalette) {
    5.38 +        data->renderer->SetTexturePalette(data->renderer, data->texture,
    5.39 +                                          palette->colors, 0,
    5.40 +                                          palette->ncolors);
    5.41      }
    5.42      return 0;
    5.43  }
    5.44 @@ -237,21 +230,11 @@
    5.45      renderer->driverdata = data;
    5.46      Setup_SoftwareRenderer(renderer);
    5.47  
    5.48 -    if (flags & SDL_RENDERER_PRESENTFLIP2) {
    5.49 -        renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2;
    5.50 -        n = 2;
    5.51 -    } else if (flags & SDL_RENDERER_PRESENTFLIP3) {
    5.52 -        renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3;
    5.53 -        n = 3;
    5.54 -    } else {
    5.55 -        renderer->info.flags |= SDL_RENDERER_PRESENTCOPY;
    5.56 -        n = 1;
    5.57 -    }
    5.58 +    n = 1;
    5.59      data->format = displayMode->format;
    5.60  
    5.61      /* Find a render driver that we can use to display data */
    5.62 -    renderer_flags = (SDL_RENDERER_SINGLEBUFFER |
    5.63 -                      SDL_RENDERER_PRESENTDISCARD);
    5.64 +    renderer_flags = 0;
    5.65      if (flags & SDL_RENDERER_PRESENTVSYNC) {
    5.66          renderer_flags |= SDL_RENDERER_PRESENTVSYNC;
    5.67      }
    5.68 @@ -280,15 +263,12 @@
    5.69      }
    5.70  
    5.71      /* Create the textures we'll use for display */
    5.72 -    for (i = 0; i < n; ++i) {
    5.73 -        data->texture[i] =
    5.74 -            CreateTexture(data->renderer, data->format, window->w, window->h);
    5.75 -        if (!data->texture[i]) {
    5.76 -            SW_DestroyRenderer(renderer);
    5.77 -            return NULL;
    5.78 -        }
    5.79 +    data->texture =
    5.80 +        CreateTexture(data->renderer, data->format, window->w, window->h);
    5.81 +    if (!data->texture) {
    5.82 +        SW_DestroyRenderer(renderer);
    5.83 +        return NULL;
    5.84      }
    5.85 -    data->current_texture = 0;
    5.86  
    5.87      /* Create a surface we'll use for rendering */
    5.88      data->surface.flags = SDL_PREALLOC;
    5.89 @@ -321,26 +301,14 @@
    5.90      }
    5.91      if (data->updateSize) {
    5.92          /* Recreate the textures for the new window size */
    5.93 -        if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) {
    5.94 -            n = 2;
    5.95 -        } else if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP3) {
    5.96 -            n = 3;
    5.97 -        } else {
    5.98 -            n = 1;
    5.99 +        if (data->texture) {
   5.100 +            DestroyTexture(data->renderer, data->texture);
   5.101 +            data->texture = 0;
   5.102          }
   5.103 -        for (i = 0; i < n; ++i) {
   5.104 -            if (data->texture[i]) {
   5.105 -                DestroyTexture(data->renderer, data->texture[i]);
   5.106 -                data->texture[i] = 0;
   5.107 -            }
   5.108 -        }
   5.109 -        for (i = 0; i < n; ++i) {
   5.110 -            data->texture[i] =
   5.111 -                CreateTexture(data->renderer, data->format, window->w,
   5.112 -                              window->h);
   5.113 -            if (!data->texture[i]) {
   5.114 -                return -1;
   5.115 -            }
   5.116 +        data->texture = CreateTexture(data->renderer, data->format,
   5.117 +                                      window->w, window->h);
   5.118 +        if (!data->texture) {
   5.119 +            return -1;
   5.120          }
   5.121          data->updateSize = SDL_FALSE;
   5.122      }
   5.123 @@ -528,7 +496,7 @@
   5.124                      int count)
   5.125  {
   5.126      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   5.127 -    SDL_Texture *texture = data->texture[data->current_texture];
   5.128 +    SDL_Texture *texture = data->texture;
   5.129      SDL_Rect rect;
   5.130      int i;
   5.131      int x, y;
   5.132 @@ -544,10 +512,6 @@
   5.133          return 0;
   5.134      }
   5.135  
   5.136 -    if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
   5.137 -        SDL_AddDirtyRect(&data->dirty, &rect);
   5.138 -    }
   5.139 -
   5.140      if (data->renderer->LockTexture(data->renderer, texture, &rect, 1,
   5.141                                      &data->surface.pixels,
   5.142                                      &data->surface.pitch) < 0) {
   5.143 @@ -591,7 +555,7 @@
   5.144                     int count)
   5.145  {
   5.146      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   5.147 -    SDL_Texture *texture = data->texture[data->current_texture];
   5.148 +    SDL_Texture *texture = data->texture;
   5.149      SDL_Rect clip, rect;
   5.150      int i;
   5.151      int x1, y1, x2, y2;
   5.152 @@ -608,10 +572,6 @@
   5.153          return 0;
   5.154      }
   5.155  
   5.156 -    if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
   5.157 -        SDL_AddDirtyRect(&data->dirty, &rect);
   5.158 -    }
   5.159 -
   5.160      if (data->renderer->LockTexture(data->renderer, texture, &rect, 1,
   5.161                                      &data->surface.pixels,
   5.162                                      &data->surface.pitch) < 0) {
   5.163 @@ -659,7 +619,7 @@
   5.164                     int count)
   5.165  {
   5.166      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   5.167 -    SDL_Texture *texture = data->texture[data->current_texture];
   5.168 +    SDL_Texture *texture = data->texture;
   5.169      SDL_Rect clip, rect;
   5.170      Uint32 color = 0;
   5.171      int i;
   5.172 @@ -683,10 +643,6 @@
   5.173              continue;
   5.174          }
   5.175  
   5.176 -        if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
   5.177 -            SDL_AddDirtyRect(&data->dirty, &rect);
   5.178 -        }
   5.179 -
   5.180          if (data->renderer->LockTexture(data->renderer, texture, &rect, 1,
   5.181                                          &data->surface.pixels,
   5.182                                          &data->surface.pitch) < 0) {
   5.183 @@ -715,7 +671,7 @@
   5.184                     int count)
   5.185  {
   5.186      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   5.187 -    SDL_Texture *texture = data->texture[data->current_texture];
   5.188 +    SDL_Texture *texture = data->texture;
   5.189      SDL_Rect clip, rect;
   5.190      Uint32 color = 0;
   5.191      int i;
   5.192 @@ -738,10 +694,6 @@
   5.193              continue;
   5.194          }
   5.195  
   5.196 -        if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
   5.197 -            SDL_AddDirtyRect(&data->dirty, &rect);
   5.198 -        }
   5.199 -
   5.200          if (data->renderer->LockTexture(data->renderer, texture, &rect, 1,
   5.201                                          &data->surface.pixels,
   5.202                                          &data->surface.pitch) < 0) {
   5.203 @@ -772,12 +724,7 @@
   5.204      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   5.205      int status;
   5.206  
   5.207 -    if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
   5.208 -        SDL_AddDirtyRect(&data->dirty, dstrect);
   5.209 -    }
   5.210 -
   5.211 -    if (data->renderer->LockTexture(data->renderer,
   5.212 -                                    data->texture[data->current_texture],
   5.213 +    if (data->renderer->LockTexture(data->renderer, data->texture,
   5.214                                      dstrect, 1, &data->surface.pixels,
   5.215                                      &data->surface.pitch) < 0) {
   5.216          return -1;
   5.217 @@ -803,8 +750,7 @@
   5.218              SDL_LowerBlit(surface, &real_srcrect, &data->surface,
   5.219                            &real_dstrect);
   5.220      }
   5.221 -    data->renderer->UnlockTexture(data->renderer,
   5.222 -                                  data->texture[data->current_texture]);
   5.223 +    data->renderer->UnlockTexture(data->renderer, data->texture);
   5.224      return status;
   5.225  }
   5.226  
   5.227 @@ -814,8 +760,7 @@
   5.228  {
   5.229      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   5.230  
   5.231 -    if (data->renderer->LockTexture(data->renderer,
   5.232 -                                    data->texture[data->current_texture],
   5.233 +    if (data->renderer->LockTexture(data->renderer, data->texture,
   5.234                                      rect, 0, &data->surface.pixels,
   5.235                                      &data->surface.pitch) < 0) {
   5.236          return -1;
   5.237 @@ -825,8 +770,7 @@
   5.238                        data->format, data->surface.pixels, data->surface.pitch,
   5.239                        format, pixels, pitch);
   5.240  
   5.241 -    data->renderer->UnlockTexture(data->renderer,
   5.242 -                                  data->texture[data->current_texture]);
   5.243 +    data->renderer->UnlockTexture(data->renderer, data->texture);
   5.244      return 0;
   5.245  }
   5.246  
   5.247 @@ -836,12 +780,7 @@
   5.248  {
   5.249      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   5.250  
   5.251 -    if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
   5.252 -        SDL_AddDirtyRect(&data->dirty, rect);
   5.253 -    }
   5.254 -
   5.255 -    if (data->renderer->LockTexture(data->renderer,
   5.256 -                                    data->texture[data->current_texture],
   5.257 +    if (data->renderer->LockTexture(data->renderer, data->texture,
   5.258                                      rect, 1, &data->surface.pixels,
   5.259                                      &data->surface.pitch) < 0) {
   5.260          return -1;
   5.261 @@ -850,8 +789,7 @@
   5.262      SDL_ConvertPixels(rect->w, rect->h, format, pixels, pitch,
   5.263                        data->format, data->surface.pixels, data->surface.pitch);
   5.264  
   5.265 -    data->renderer->UnlockTexture(data->renderer,
   5.266 -                                  data->texture[data->current_texture]);
   5.267 +    data->renderer->UnlockTexture(data->renderer, data->texture);
   5.268      return 0;
   5.269  }
   5.270  
   5.271 @@ -859,32 +797,16 @@
   5.272  SW_RenderPresent(SDL_Renderer * renderer)
   5.273  {
   5.274      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   5.275 -    SDL_Texture *texture = data->texture[data->current_texture];
   5.276 +    SDL_Texture *texture = data->texture;
   5.277 +    SDL_Rect rect;
   5.278  
   5.279      /* Send the data to the display */
   5.280 -    if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
   5.281 -        SDL_DirtyRect *dirty;
   5.282 -        for (dirty = data->dirty.list; dirty; dirty = dirty->next) {
   5.283 -            data->renderer->RenderCopy(data->renderer, texture, &dirty->rect,
   5.284 -                                       &dirty->rect);
   5.285 -        }
   5.286 -        SDL_ClearDirtyRects(&data->dirty);
   5.287 -    } else {
   5.288 -        SDL_Rect rect;
   5.289 -        rect.x = 0;
   5.290 -        rect.y = 0;
   5.291 -        rect.w = texture->w;
   5.292 -        rect.h = texture->h;
   5.293 -        data->renderer->RenderCopy(data->renderer, texture, &rect, &rect);
   5.294 -    }
   5.295 +    rect.x = 0;
   5.296 +    rect.y = 0;
   5.297 +    rect.w = texture->w;
   5.298 +    rect.h = texture->h;
   5.299 +    data->renderer->RenderCopy(data->renderer, texture, &rect, &rect);
   5.300      data->renderer->RenderPresent(data->renderer);
   5.301 -
   5.302 -    /* Update the flipping chain, if any */
   5.303 -    if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) {
   5.304 -        data->current_texture = (data->current_texture + 1) % 2;
   5.305 -    } else if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP3) {
   5.306 -        data->current_texture = (data->current_texture + 1) % 3;
   5.307 -    }
   5.308  }
   5.309  
   5.310  static void
   5.311 @@ -908,10 +830,8 @@
   5.312      int i;
   5.313  
   5.314      if (data) {
   5.315 -        for (i = 0; i < SDL_arraysize(data->texture); ++i) {
   5.316 -            if (data->texture[i]) {
   5.317 -                DestroyTexture(data->renderer, data->texture[i]);
   5.318 -            }
   5.319 +        if (data->texture) {
   5.320 +            DestroyTexture(data->renderer, data->texture);
   5.321          }
   5.322          if (data->surface.format) {
   5.323              SDL_SetSurfacePalette(&data->surface, NULL);
     6.1 --- a/src/video/directfb/SDL_DirectFB_render.c	Mon Jan 31 23:37:30 2011 -0800
     6.2 +++ b/src/video/directfb/SDL_DirectFB_render.c	Tue Feb 01 12:19:46 2011 -0800
     6.3 @@ -87,10 +87,7 @@
     6.4      DirectFB_CreateRenderer,
     6.5      {
     6.6       "directfb",
     6.7 -     (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
     6.8 -      SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
     6.9 -      SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
    6.10 -      SDL_RENDERER_ACCELERATED),
    6.11 +     (SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
    6.12       14,
    6.13       {
    6.14        SDL_PIXELFORMAT_INDEX4LSB,
    6.15 @@ -256,7 +253,6 @@
    6.16      SDL_VideoDisplay *display = window->display;
    6.17      SDL_Renderer *renderer = NULL;
    6.18      DirectFB_RenderData *data = NULL;
    6.19 -    DFBSurfaceCapabilities scaps;
    6.20      char *p;
    6.21  
    6.22      SDL_DFB_CALLOC(renderer, 1, sizeof(*renderer));
    6.23 @@ -288,8 +284,7 @@
    6.24      renderer->window = window;      /* SDL window */
    6.25      renderer->driverdata = data;
    6.26  
    6.27 -    renderer->info.flags =
    6.28 -        SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD;
    6.29 +    renderer->info.flags = SDL_RENDERER_ACCELERATED;
    6.30  
    6.31      data->window = window;
    6.32  
    6.33 @@ -301,15 +296,6 @@
    6.34      } else
    6.35          data->flipflags |= DSFLIP_ONSYNC;
    6.36  
    6.37 -    SDL_DFB_CHECKERR(windata->surface->
    6.38 -                     GetCapabilities(windata->surface, &scaps));
    6.39 -    if (scaps & DSCAPS_DOUBLE)
    6.40 -        renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2;
    6.41 -    else if (scaps & DSCAPS_TRIPLE)
    6.42 -        renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3;
    6.43 -    else
    6.44 -        renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER;
    6.45 -
    6.46      data->isyuvdirect = 0;      /* default is off! */
    6.47      p = SDL_getenv(DFBENV_USE_YUV_DIRECT);
    6.48      if (p)
     7.1 --- a/src/video/dummy/SDL_nullrender.c	Mon Jan 31 23:37:30 2011 -0800
     7.2 +++ b/src/video/dummy/SDL_nullrender.c	Tue Feb 01 12:19:46 2011 -0800
     7.3 @@ -59,16 +59,13 @@
     7.4      SDL_DUMMY_CreateRenderer,
     7.5      {
     7.6       "dummy",
     7.7 -     (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
     7.8 -      SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
     7.9 -      SDL_RENDERER_PRESENTDISCARD),
    7.10 +     (0),
    7.11       }
    7.12  };
    7.13  
    7.14  typedef struct
    7.15  {
    7.16 -    int current_screen;
    7.17 -    SDL_Surface *screens[3];
    7.18 +    SDL_Surface *screen;
    7.19  } SDL_DUMMY_RenderData;
    7.20  
    7.21  SDL_Renderer *
    7.22 @@ -78,7 +75,6 @@
    7.23      SDL_DisplayMode *displayMode = &display->current_mode;
    7.24      SDL_Renderer *renderer;
    7.25      SDL_DUMMY_RenderData *data;
    7.26 -    int i, n;
    7.27      int bpp;
    7.28      Uint32 Rmask, Gmask, Bmask, Amask;
    7.29  
    7.30 @@ -117,27 +113,14 @@
    7.31      renderer->driverdata = data;
    7.32      Setup_SoftwareRenderer(renderer);
    7.33  
    7.34 -    if (flags & SDL_RENDERER_PRESENTFLIP2) {
    7.35 -        renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2;
    7.36 -        n = 2;
    7.37 -    } else if (flags & SDL_RENDERER_PRESENTFLIP3) {
    7.38 -        renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3;
    7.39 -        n = 3;
    7.40 -    } else {
    7.41 -        renderer->info.flags |= SDL_RENDERER_PRESENTCOPY;
    7.42 -        n = 1;
    7.43 +    data->screen =
    7.44 +        SDL_CreateRGBSurface(0, window->w, window->h, bpp, Rmask, Gmask,
    7.45 +                             Bmask, Amask);
    7.46 +    if (!data->screen) {
    7.47 +        SDL_DUMMY_DestroyRenderer(renderer);
    7.48 +        return NULL;
    7.49      }
    7.50 -    for (i = 0; i < n; ++i) {
    7.51 -        data->screens[i] =
    7.52 -            SDL_CreateRGBSurface(0, window->w, window->h, bpp, Rmask, Gmask,
    7.53 -                                 Bmask, Amask);
    7.54 -        if (!data->screens[i]) {
    7.55 -            SDL_DUMMY_DestroyRenderer(renderer);
    7.56 -            return NULL;
    7.57 -        }
    7.58 -        SDL_SetSurfacePalette(data->screens[i], display->palette);
    7.59 -    }
    7.60 -    data->current_screen = 0;
    7.61 +    SDL_SetSurfacePalette(data->screen, display->palette);
    7.62  
    7.63      return renderer;
    7.64  }
    7.65 @@ -148,7 +131,7 @@
    7.66  {
    7.67      SDL_DUMMY_RenderData *data =
    7.68          (SDL_DUMMY_RenderData *) renderer->driverdata;
    7.69 -    SDL_Surface *target = data->screens[data->current_screen];
    7.70 +    SDL_Surface *target = data->screen;
    7.71  
    7.72      if (renderer->blendMode == SDL_BLENDMODE_NONE) {
    7.73          Uint32 color = SDL_MapRGBA(target->format,
    7.74 @@ -169,7 +152,7 @@
    7.75  {
    7.76      SDL_DUMMY_RenderData *data =
    7.77          (SDL_DUMMY_RenderData *) renderer->driverdata;
    7.78 -    SDL_Surface *target = data->screens[data->current_screen];
    7.79 +    SDL_Surface *target = data->screen;
    7.80  
    7.81      if (renderer->blendMode == SDL_BLENDMODE_NONE) {
    7.82          Uint32 color = SDL_MapRGBA(target->format,
    7.83 @@ -190,7 +173,7 @@
    7.84  {
    7.85      SDL_DUMMY_RenderData *data =
    7.86          (SDL_DUMMY_RenderData *) renderer->driverdata;
    7.87 -    SDL_Surface *target = data->screens[data->current_screen];
    7.88 +    SDL_Surface *target = data->screen;
    7.89  
    7.90      if (renderer->blendMode == SDL_BLENDMODE_NONE) {
    7.91          Uint32 color = SDL_MapRGBA(target->format,
    7.92 @@ -212,7 +195,7 @@
    7.93  {
    7.94      SDL_DUMMY_RenderData *data =
    7.95          (SDL_DUMMY_RenderData *) renderer->driverdata;
    7.96 -    SDL_Surface *target = data->screens[data->current_screen];
    7.97 +    SDL_Surface *target = data->screen;
    7.98  
    7.99      if (renderer->blendMode == SDL_BLENDMODE_NONE) {
   7.100          Uint32 color = SDL_MapRGBA(target->format,
   7.101 @@ -238,7 +221,7 @@
   7.102      SDL_VideoDisplay *display = window->display;
   7.103  
   7.104      if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
   7.105 -        SDL_Surface *target = data->screens[data->current_screen];
   7.106 +        SDL_Surface *target = data->screen;
   7.107          void *pixels =
   7.108              (Uint8 *) target->pixels + dstrect->y * target->pitch +
   7.109              dstrect->x * target->format->BytesPerPixel;
   7.110 @@ -248,7 +231,7 @@
   7.111                                     target->pitch);
   7.112      } else {
   7.113          SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
   7.114 -        SDL_Surface *target = data->screens[data->current_screen];
   7.115 +        SDL_Surface *target = data->screen;
   7.116          SDL_Rect real_srcrect = *srcrect;
   7.117          SDL_Rect real_dstrect = *dstrect;
   7.118  
   7.119 @@ -264,7 +247,7 @@
   7.120          (SDL_DUMMY_RenderData *) renderer->driverdata;
   7.121      SDL_Window *window = renderer->window;
   7.122      SDL_VideoDisplay *display = window->display;
   7.123 -    SDL_Surface *screen = data->screens[data->current_screen];
   7.124 +    SDL_Surface *screen = data->screen;
   7.125      Uint32 screen_format = display->current_mode.format;
   7.126      Uint8 *screen_pixels = (Uint8 *) screen->pixels +
   7.127                              rect->y * screen->pitch +
   7.128 @@ -284,7 +267,7 @@
   7.129          (SDL_DUMMY_RenderData *) renderer->driverdata;
   7.130      SDL_Window *window = renderer->window;
   7.131      SDL_VideoDisplay *display = window->display;
   7.132 -    SDL_Surface *screen = data->screens[data->current_screen];
   7.133 +    SDL_Surface *screen = data->screen;
   7.134      Uint32 screen_format = display->current_mode.format;
   7.135      Uint8 *screen_pixels = (Uint8 *) screen->pixels +
   7.136                              rect->y * screen->pitch +
   7.137 @@ -308,14 +291,7 @@
   7.138          char file[128];
   7.139          SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp",
   7.140                       renderer->window->id, ++frame_number);
   7.141 -        SDL_SaveBMP(data->screens[data->current_screen], file);
   7.142 -    }
   7.143 -
   7.144 -    /* Update the flipping chain, if any */
   7.145 -    if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) {
   7.146 -        data->current_screen = (data->current_screen + 1) % 2;
   7.147 -    } else if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP3) {
   7.148 -        data->current_screen = (data->current_screen + 1) % 3;
   7.149 +        SDL_SaveBMP(data->screen, file);
   7.150      }
   7.151  }
   7.152  
   7.153 @@ -327,10 +303,8 @@
   7.154      int i;
   7.155  
   7.156      if (data) {
   7.157 -        for (i = 0; i < SDL_arraysize(data->screens); ++i) {
   7.158 -            if (data->screens[i]) {
   7.159 -                SDL_FreeSurface(data->screens[i]);
   7.160 -            }
   7.161 +        if (data->screen) {
   7.162 +            SDL_FreeSurface(data->screen);
   7.163          }
   7.164          SDL_free(data);
   7.165      }
     8.1 --- a/src/video/nds/SDL_ndsrender.c	Mon Jan 31 23:37:30 2011 -0800
     8.2 +++ b/src/video/nds/SDL_ndsrender.c	Tue Feb 01 12:19:46 2011 -0800
     8.3 @@ -71,7 +71,7 @@
     8.4  SDL_RenderDriver NDS_RenderDriver = {
     8.5      NDS_CreateRenderer,
     8.6      {"nds",                     /* char* name */
     8.7 -     (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC),  /* u32 flags */
     8.8 +     (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),  /* u32 flags */
     8.9       3,                         /* u32 num_texture_formats */
    8.10       {
    8.11        SDL_PIXELFORMAT_INDEX8,
     9.1 --- a/src/video/windows/SDL_d3drender.c	Mon Jan 31 23:37:30 2011 -0800
     9.2 +++ b/src/video/windows/SDL_d3drender.c	Tue Feb 01 12:19:46 2011 -0800
     9.3 @@ -134,10 +134,7 @@
     9.4      D3D_CreateRenderer,
     9.5      {
     9.6       "d3d",
     9.7 -     (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
     9.8 -      SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
     9.9 -      SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC |
    9.10 -      SDL_RENDERER_ACCELERATED),
    9.11 +     (SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
    9.12       0,
    9.13       {0},
    9.14       0,
    9.15 @@ -472,19 +469,9 @@
    9.16      } else {
    9.17          pparams.BackBufferFormat = D3DFMT_UNKNOWN;
    9.18      }
    9.19 -    if (flags & SDL_RENDERER_PRESENTFLIP2) {
    9.20 -        pparams.BackBufferCount = 2;
    9.21 -        pparams.SwapEffect = D3DSWAPEFFECT_FLIP;
    9.22 -    } else if (flags & SDL_RENDERER_PRESENTFLIP3) {
    9.23 -        pparams.BackBufferCount = 3;
    9.24 -        pparams.SwapEffect = D3DSWAPEFFECT_FLIP;
    9.25 -    } else if (flags & SDL_RENDERER_PRESENTCOPY) {
    9.26 -        pparams.BackBufferCount = 1;
    9.27 -        pparams.SwapEffect = D3DSWAPEFFECT_COPY;
    9.28 -    } else {
    9.29 -        pparams.BackBufferCount = 1;
    9.30 -        pparams.SwapEffect = D3DSWAPEFFECT_DISCARD;
    9.31 -    }
    9.32 +    pparams.BackBufferCount = 1;
    9.33 +    pparams.SwapEffect = D3DSWAPEFFECT_DISCARD;
    9.34 +
    9.35      if (window->flags & SDL_WINDOW_FULLSCREEN) {
    9.36          pparams.Windowed = FALSE;
    9.37          pparams.FullScreen_RefreshRateInHz =
    9.38 @@ -534,24 +521,6 @@
    9.39          return NULL;
    9.40      }
    9.41      IDirect3DSwapChain9_Release(chain);
    9.42 -    switch (pparams.SwapEffect) {
    9.43 -    case D3DSWAPEFFECT_COPY:
    9.44 -        renderer->info.flags |= SDL_RENDERER_PRESENTCOPY;
    9.45 -        break;
    9.46 -    case D3DSWAPEFFECT_FLIP:
    9.47 -        switch (pparams.BackBufferCount) {
    9.48 -        case 2:
    9.49 -            renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2;
    9.50 -            break;
    9.51 -        case 3:
    9.52 -            renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3;
    9.53 -            break;
    9.54 -        }
    9.55 -        break;
    9.56 -    case D3DSWAPEFFECT_DISCARD:
    9.57 -        renderer->info.flags |= SDL_RENDERER_PRESENTDISCARD;
    9.58 -        break;
    9.59 -    }
    9.60      if (pparams.PresentationInterval == D3DPRESENT_INTERVAL_ONE) {
    9.61          renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
    9.62      }
    10.1 --- a/test/common.c	Mon Jan 31 23:37:30 2011 -0800
    10.2 +++ b/test/common.c	Tue Feb 01 12:19:46 2011 -0800
    10.3 @@ -6,7 +6,7 @@
    10.4  #include "common.h"
    10.5  
    10.6  #define VIDEO_USAGE \
    10.7 -"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display N] [--fullscreen | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab] [--double] [--triple]"
    10.8 +"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display N] [--fullscreen | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]"
    10.9  
   10.10  #define AUDIO_USAGE \
   10.11  "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]"
   10.12 @@ -211,14 +211,6 @@
   10.13          state->render_flags |= SDL_RENDERER_PRESENTVSYNC;
   10.14          return 1;
   10.15      }
   10.16 -    if (SDL_strcasecmp(argv[index], "--double") == 0) {
   10.17 -        state->render_flags |= SDL_RENDERER_PRESENTFLIP2;
   10.18 -        return 1;
   10.19 -    }
   10.20 -    if (SDL_strcasecmp(argv[index], "--triple") == 0) {
   10.21 -        state->render_flags |= SDL_RENDERER_PRESENTFLIP3;
   10.22 -        return 1;
   10.23 -    }
   10.24      if (SDL_strcasecmp(argv[index], "--noframe") == 0) {
   10.25          state->window_flags |= SDL_WINDOW_BORDERLESS;
   10.26          return 1;
   10.27 @@ -329,21 +321,6 @@
   10.28  PrintRendererFlag(Uint32 flag)
   10.29  {
   10.30      switch (flag) {
   10.31 -    case SDL_RENDERER_SINGLEBUFFER:
   10.32 -        fprintf(stderr, "SingleBuffer");
   10.33 -        break;
   10.34 -    case SDL_RENDERER_PRESENTCOPY:
   10.35 -        fprintf(stderr, "PresentCopy");
   10.36 -        break;
   10.37 -    case SDL_RENDERER_PRESENTFLIP2:
   10.38 -        fprintf(stderr, "PresentFlip2");
   10.39 -        break;
   10.40 -    case SDL_RENDERER_PRESENTFLIP3:
   10.41 -        fprintf(stderr, "PresentFlip3");
   10.42 -        break;
   10.43 -    case SDL_RENDERER_PRESENTDISCARD:
   10.44 -        fprintf(stderr, "PresentDiscard");
   10.45 -        break;
   10.46      case SDL_RENDERER_PRESENTVSYNC:
   10.47          fprintf(stderr, "PresentVSync");
   10.48          break;
    11.1 --- a/test/testshape.c	Mon Jan 31 23:37:30 2011 -0800
    11.2 +++ b/test/testshape.c	Tue Feb 01 12:19:46 2011 -0800
    11.3 @@ -102,7 +102,7 @@
    11.4  		printf("Could not create shaped window for SDL_Shape.\n");
    11.5  		exit(-4);
    11.6  	}
    11.7 -	if(SDL_CreateRenderer(window,-1,SDL_RENDERER_PRESENTFLIP2) == -1) {
    11.8 +	if(SDL_CreateRenderer(window,-1,0) == -1) {
    11.9  		SDL_DestroyWindow(window);
   11.10  		for(i=0;i<num_pictures;i++)
   11.11  			SDL_FreeSurface(pictures[i].surface);