Skip to content
Permalink
Browse files

Added an event SDL_RENDER_DEVICE_RESET, which is triggered on Direct3…

…D 11 when the device has been lost and all textures need to be recreated.
  • Loading branch information
slouken committed Mar 24, 2014
1 parent 25919bf commit 26823b1bb4da8cfb2e68939484e0bb1328ee2806
Showing with 10 additions and 3 deletions.
  1. +2 −1 include/SDL_events.h
  2. +1 −2 src/render/direct3d11/SDL_render_d3d11.c
  3. +7 −0 src/test/SDL_test_common.c
@@ -135,7 +135,8 @@ typedef enum
SDL_DROPFILE = 0x1000, /**< The system requests a file open */

/* Render events */
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset */
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */

/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
* and should be allocated with SDL_RegisterEvents()
@@ -1593,9 +1593,8 @@ D3D11_HandleDeviceLost(SDL_Renderer * renderer)

/* Let the application know that the device has been reset */
{
/* TODO/FIXME: consider adding a new SDL event to indicate that the entire rendering device has been reset, not just render targets! */
SDL_Event event;
event.type = SDL_RENDER_TARGETS_RESET;
event.type = SDL_RENDER_DEVICE_RESET;
SDL_PushEvent(&event);
}

@@ -1198,6 +1198,13 @@ SDLTest_PrintEvent(SDL_Event * event)
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
break;

case SDL_RENDER_DEVICE_RESET:
SDL_Log("SDL EVENT: render device reset");
break;
case SDL_RENDER_TARGETS_RESET:
SDL_Log("SDL EVENT: render targets reset");
break;

case SDL_QUIT:
SDL_Log("SDL EVENT: Quit requested");
break;

0 comments on commit 26823b1

Please sign in to comment.