dav1dplay: Print more error messages when window/context creation fails
This commit is contained in:
@@ -140,6 +140,9 @@ static inline SDL_Window *dp_create_sdl_window(int window_flags)
|
||||
|
||||
win = SDL_CreateWindow("Dav1dPlay", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
WINDOW_WIDTH, WINDOW_HEIGHT, window_flags);
|
||||
if (!win)
|
||||
return NULL;
|
||||
|
||||
SDL_SetWindowResizable(win, SDL_TRUE);
|
||||
|
||||
return win;
|
||||
|
||||
@@ -86,17 +86,20 @@ static Dav1dPlayRendererPrivateContext*
|
||||
|
||||
// Create Window
|
||||
SDL_Window *sdlwin = dp_create_sdl_window(window_flags | SDL_WINDOW_RESIZABLE);
|
||||
if (sdlwin == NULL)
|
||||
if (sdlwin == NULL) {
|
||||
fprintf(stderr, "Creating SDL window failed: %s\n", SDL_GetError());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_ShowCursor(0);
|
||||
|
||||
// Alloc
|
||||
Dav1dPlayRendererPrivateContext *const rd_priv_ctx =
|
||||
calloc(1, sizeof(Dav1dPlayRendererPrivateContext));
|
||||
if (rd_priv_ctx == NULL)
|
||||
if (rd_priv_ctx == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
|
||||
}
|
||||
rd_priv_ctx->win = sdlwin;
|
||||
|
||||
// Init libplacebo
|
||||
@@ -109,6 +112,7 @@ static Dav1dPlayRendererPrivateContext*
|
||||
#endif
|
||||
));
|
||||
if (rd_priv_ctx->log == NULL) {
|
||||
fprintf(stderr, "pl_log_create failed!\n");
|
||||
free(rd_priv_ctx);
|
||||
return NULL;
|
||||
}
|
||||
@@ -143,6 +147,10 @@ static void *placebo_renderer_create_gl(const Dav1dPlaySettings *settings)
|
||||
sdlwin = rd_priv_ctx->win;
|
||||
|
||||
rd_priv_ctx->gl_context = SDL_GL_CreateContext(sdlwin);
|
||||
if (!rd_priv_ctx->gl_context) {
|
||||
fprintf(stderr, "Failed creating opengl context: %s\n", SDL_GetError());
|
||||
exit(2);
|
||||
}
|
||||
SDL_GL_MakeCurrent(sdlwin, rd_priv_ctx->gl_context);
|
||||
|
||||
rd_priv_ctx->gl = pl_opengl_create(rd_priv_ctx->log, pl_opengl_params(
|
||||
|
||||
@@ -50,14 +50,16 @@ static void *sdl_renderer_create(const Dav1dPlaySettings *settings)
|
||||
window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
|
||||
SDL_Window *win = dp_create_sdl_window(window_flags);
|
||||
if (win == NULL)
|
||||
if (win == NULL) {
|
||||
fprintf(stderr, "Creating SDL window failed: %s\n", SDL_GetError());
|
||||
return NULL;
|
||||
|
||||
}
|
||||
SDL_ShowCursor(0);
|
||||
|
||||
// Alloc
|
||||
Dav1dPlayRendererPrivateContext *rd_priv_ctx = malloc(sizeof(Dav1dPlayRendererPrivateContext));
|
||||
if (rd_priv_ctx == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
}
|
||||
rd_priv_ctx->win = win;
|
||||
|
||||
Reference in New Issue
Block a user