src/video/SDL_egl.c
changeset 11983 3a50eb90e4b2
parent 11872 e917e911dab6
child 12028 8aa5a79c8805
     1.1 --- a/src/video/SDL_egl.c	Thu May 17 12:50:46 2018 -0400
     1.2 +++ b/src/video/SDL_egl.c	Fri May 18 13:09:30 2018 -0700
     1.3 @@ -446,6 +446,64 @@
     1.4      return 0;
     1.5  }
     1.6  
     1.7 +#ifdef DUMP_EGL_CONFIG
     1.8 +
     1.9 +#define ATTRIBUTE(_attr) { _attr, #_attr }
    1.10 +
    1.11 +typedef struct {
    1.12 +    EGLint attribute;
    1.13 +    char const* name;
    1.14 +} Attribute;
    1.15 +
    1.16 +Attribute attributes[] = {
    1.17 +        ATTRIBUTE( EGL_BUFFER_SIZE ),
    1.18 +        ATTRIBUTE( EGL_ALPHA_SIZE ),
    1.19 +        ATTRIBUTE( EGL_BLUE_SIZE ),
    1.20 +        ATTRIBUTE( EGL_GREEN_SIZE ),
    1.21 +        ATTRIBUTE( EGL_RED_SIZE ),
    1.22 +        ATTRIBUTE( EGL_DEPTH_SIZE ),
    1.23 +        ATTRIBUTE( EGL_STENCIL_SIZE ),
    1.24 +        ATTRIBUTE( EGL_CONFIG_CAVEAT ),
    1.25 +        ATTRIBUTE( EGL_CONFIG_ID ),
    1.26 +        ATTRIBUTE( EGL_LEVEL ),
    1.27 +        ATTRIBUTE( EGL_MAX_PBUFFER_HEIGHT ),
    1.28 +        ATTRIBUTE( EGL_MAX_PBUFFER_WIDTH ),
    1.29 +        ATTRIBUTE( EGL_MAX_PBUFFER_PIXELS ),
    1.30 +        ATTRIBUTE( EGL_NATIVE_RENDERABLE ),
    1.31 +        ATTRIBUTE( EGL_NATIVE_VISUAL_ID ),
    1.32 +        ATTRIBUTE( EGL_NATIVE_VISUAL_TYPE ),
    1.33 +        ATTRIBUTE( EGL_SAMPLES ),
    1.34 +        ATTRIBUTE( EGL_SAMPLE_BUFFERS ),
    1.35 +        ATTRIBUTE( EGL_SURFACE_TYPE ),
    1.36 +        ATTRIBUTE( EGL_TRANSPARENT_TYPE ),
    1.37 +        ATTRIBUTE( EGL_TRANSPARENT_BLUE_VALUE ),
    1.38 +        ATTRIBUTE( EGL_TRANSPARENT_GREEN_VALUE ),
    1.39 +        ATTRIBUTE( EGL_TRANSPARENT_RED_VALUE ),
    1.40 +        ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGB ),
    1.41 +        ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGBA ),
    1.42 +        ATTRIBUTE( EGL_MIN_SWAP_INTERVAL ),
    1.43 +        ATTRIBUTE( EGL_MAX_SWAP_INTERVAL ),
    1.44 +        ATTRIBUTE( EGL_LUMINANCE_SIZE ),
    1.45 +        ATTRIBUTE( EGL_ALPHA_MASK_SIZE ),
    1.46 +        ATTRIBUTE( EGL_COLOR_BUFFER_TYPE ),
    1.47 +        ATTRIBUTE( EGL_RENDERABLE_TYPE ),
    1.48 +        ATTRIBUTE( EGL_MATCH_NATIVE_PIXMAP ),
    1.49 +        ATTRIBUTE( EGL_CONFORMANT ),
    1.50 +};
    1.51 +
    1.52 +
    1.53 +static void dumpconfig(_THIS, EGLConfig config)
    1.54 +{
    1.55 +    int attr;
    1.56 +    for (attr = 0 ; attr<sizeof(attributes)/sizeof(Attribute) ; attr++) {
    1.57 +        EGLint value;
    1.58 +        _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, config, attributes[attr].attribute, &value);
    1.59 +        SDL_Log("\t%-32s: %10d (0x%08x)\n", attributes[attr].name, value, value);
    1.60 +    }
    1.61 +}
    1.62 +
    1.63 +#endif /* DUMP_EGL_CONFIG */
    1.64 +
    1.65  int
    1.66  SDL_EGL_ChooseConfig(_THIS) 
    1.67  {
    1.68 @@ -570,6 +628,10 @@
    1.69              break; /* we found an exact match! */
    1.70          }
    1.71      }
    1.72 +
    1.73 +#ifdef DUMP_EGL_CONFIG
    1.74 +    dumpconfig(_this, _this->egl_data->egl_config);
    1.75 +#endif
    1.76      
    1.77      return 0;
    1.78  }