aboutsummaryrefslogtreecommitdiff
path: root/src/sdl/log-renderer-info.c
blob: 9ff2ef8d2a931361fe1af8f467f5389206b042ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "util.h"
#include "log-renderer-info.h"

void
log_renderer_info(
  SDL_Renderer * const renderer
) {
  SDL_RendererInfo info;

  // get renderer info
  if (SDL_GetRendererInfo(renderer, &info)) {
    die("SDL_GetRendererInfo(): %s", SDL_GetError());
  }

  // log renderer info
  SDL_Log(
    "renderer:\n"
    "  name = \"%s\"\n"
    "  flags = 0x%04X%s%s%s%s\n"
    "  max_texture_width = %d\n"
    "  max_texture_height = %d\n"
    "  num_texture_formats = %u",
    info.name,
    info.flags,
    info.flags & SDL_RENDERER_SOFTWARE ? ", SOFTWARE" : "",
    info.flags & SDL_RENDERER_ACCELERATED ? ", ACCELERATED" : "",
    info.flags & SDL_RENDERER_PRESENTVSYNC ? ", PRESENTVSYNC" : "",
    info.flags & SDL_RENDERER_TARGETTEXTURE ? ", TARGETTEXTURE" : "",
    info.max_texture_width,
    info.max_texture_height,
    info.num_texture_formats
  );
}