src/video/SDL_egl.c
changeset 11983 3a50eb90e4b2
parent 11872 e917e911dab6
child 12028 8aa5a79c8805
equal deleted inserted replaced
11982:7babfecee045 11983:3a50eb90e4b2
   444     }
   444     }
   445     
   445     
   446     return 0;
   446     return 0;
   447 }
   447 }
   448 
   448 
       
   449 #ifdef DUMP_EGL_CONFIG
       
   450 
       
   451 #define ATTRIBUTE(_attr) { _attr, #_attr }
       
   452 
       
   453 typedef struct {
       
   454     EGLint attribute;
       
   455     char const* name;
       
   456 } Attribute;
       
   457 
       
   458 Attribute attributes[] = {
       
   459         ATTRIBUTE( EGL_BUFFER_SIZE ),
       
   460         ATTRIBUTE( EGL_ALPHA_SIZE ),
       
   461         ATTRIBUTE( EGL_BLUE_SIZE ),
       
   462         ATTRIBUTE( EGL_GREEN_SIZE ),
       
   463         ATTRIBUTE( EGL_RED_SIZE ),
       
   464         ATTRIBUTE( EGL_DEPTH_SIZE ),
       
   465         ATTRIBUTE( EGL_STENCIL_SIZE ),
       
   466         ATTRIBUTE( EGL_CONFIG_CAVEAT ),
       
   467         ATTRIBUTE( EGL_CONFIG_ID ),
       
   468         ATTRIBUTE( EGL_LEVEL ),
       
   469         ATTRIBUTE( EGL_MAX_PBUFFER_HEIGHT ),
       
   470         ATTRIBUTE( EGL_MAX_PBUFFER_WIDTH ),
       
   471         ATTRIBUTE( EGL_MAX_PBUFFER_PIXELS ),
       
   472         ATTRIBUTE( EGL_NATIVE_RENDERABLE ),
       
   473         ATTRIBUTE( EGL_NATIVE_VISUAL_ID ),
       
   474         ATTRIBUTE( EGL_NATIVE_VISUAL_TYPE ),
       
   475         ATTRIBUTE( EGL_SAMPLES ),
       
   476         ATTRIBUTE( EGL_SAMPLE_BUFFERS ),
       
   477         ATTRIBUTE( EGL_SURFACE_TYPE ),
       
   478         ATTRIBUTE( EGL_TRANSPARENT_TYPE ),
       
   479         ATTRIBUTE( EGL_TRANSPARENT_BLUE_VALUE ),
       
   480         ATTRIBUTE( EGL_TRANSPARENT_GREEN_VALUE ),
       
   481         ATTRIBUTE( EGL_TRANSPARENT_RED_VALUE ),
       
   482         ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGB ),
       
   483         ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGBA ),
       
   484         ATTRIBUTE( EGL_MIN_SWAP_INTERVAL ),
       
   485         ATTRIBUTE( EGL_MAX_SWAP_INTERVAL ),
       
   486         ATTRIBUTE( EGL_LUMINANCE_SIZE ),
       
   487         ATTRIBUTE( EGL_ALPHA_MASK_SIZE ),
       
   488         ATTRIBUTE( EGL_COLOR_BUFFER_TYPE ),
       
   489         ATTRIBUTE( EGL_RENDERABLE_TYPE ),
       
   490         ATTRIBUTE( EGL_MATCH_NATIVE_PIXMAP ),
       
   491         ATTRIBUTE( EGL_CONFORMANT ),
       
   492 };
       
   493 
       
   494 
       
   495 static void dumpconfig(_THIS, EGLConfig config)
       
   496 {
       
   497     int attr;
       
   498     for (attr = 0 ; attr<sizeof(attributes)/sizeof(Attribute) ; attr++) {
       
   499         EGLint value;
       
   500         _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, config, attributes[attr].attribute, &value);
       
   501         SDL_Log("\t%-32s: %10d (0x%08x)\n", attributes[attr].name, value, value);
       
   502     }
       
   503 }
       
   504 
       
   505 #endif /* DUMP_EGL_CONFIG */
       
   506 
   449 int
   507 int
   450 SDL_EGL_ChooseConfig(_THIS) 
   508 SDL_EGL_ChooseConfig(_THIS) 
   451 {
   509 {
   452 /* 64 seems nice. */
   510 /* 64 seems nice. */
   453     EGLint attribs[64];
   511     EGLint attribs[64];
   568 
   626 
   569         if (bitdiff == 0) {
   627         if (bitdiff == 0) {
   570             break; /* we found an exact match! */
   628             break; /* we found an exact match! */
   571         }
   629         }
   572     }
   630     }
       
   631 
       
   632 #ifdef DUMP_EGL_CONFIG
       
   633     dumpconfig(_this, _this->egl_data->egl_config);
       
   634 #endif
   573     
   635     
   574     return 0;
   636     return 0;
   575 }
   637 }
   576 
   638 
   577 SDL_GLContext
   639 SDL_GLContext