Added an event SDL_RENDER_DEVICE_RESET, which is triggered on Direct3D 11 when the device has been lost and all textures need to be recreated.
authorSam Lantinga <slouken@libsdl.org>
Sun, 23 Mar 2014 23:09:22 -0700
changeset 8674d7d2e69a0b08
parent 8673 50135c28f7cf
child 8675 7680f784d850
Added an event SDL_RENDER_DEVICE_RESET, which is triggered on Direct3D 11 when the device has been lost and all textures need to be recreated.
include/SDL_events.h
src/render/direct3d11/SDL_render_d3d11.c
src/test/SDL_test_common.c
     1.1 --- a/include/SDL_events.h	Sun Mar 23 23:08:26 2014 -0700
     1.2 +++ b/include/SDL_events.h	Sun Mar 23 23:09:22 2014 -0700
     1.3 @@ -135,7 +135,8 @@
     1.4      SDL_DROPFILE        = 0x1000, /**< The system requests a file open */
     1.5  
     1.6      /* Render events */
     1.7 -    SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset */
     1.8 +    SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
     1.9 +    SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
    1.10  
    1.11      /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
    1.12       *  and should be allocated with SDL_RegisterEvents()
     2.1 --- a/src/render/direct3d11/SDL_render_d3d11.c	Sun Mar 23 23:08:26 2014 -0700
     2.2 +++ b/src/render/direct3d11/SDL_render_d3d11.c	Sun Mar 23 23:09:22 2014 -0700
     2.3 @@ -1593,9 +1593,8 @@
     2.4  
     2.5      /* Let the application know that the device has been reset */
     2.6      {
     2.7 -        /* TODO/FIXME: consider adding a new SDL event to indicate that the entire rendering device has been reset, not just render targets! */
     2.8          SDL_Event event;
     2.9 -        event.type = SDL_RENDER_TARGETS_RESET;
    2.10 +        event.type = SDL_RENDER_DEVICE_RESET;
    2.11          SDL_PushEvent(&event);
    2.12      }
    2.13  
     3.1 --- a/src/test/SDL_test_common.c	Sun Mar 23 23:08:26 2014 -0700
     3.2 +++ b/src/test/SDL_test_common.c	Sun Mar 23 23:09:22 2014 -0700
     3.3 @@ -1198,6 +1198,13 @@
     3.4                  event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
     3.5          break;
     3.6  
     3.7 +    case SDL_RENDER_DEVICE_RESET:
     3.8 +        SDL_Log("SDL EVENT: render device reset");
     3.9 +        break;
    3.10 +    case SDL_RENDER_TARGETS_RESET:
    3.11 +        SDL_Log("SDL EVENT: render targets reset");
    3.12 +        break;
    3.13 +
    3.14      case SDL_QUIT:
    3.15          SDL_Log("SDL EVENT: Quit requested");
    3.16          break;