@@ -14,6 +14,8 @@ const EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR: i32 = 0x0001;
1414const EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT : i32 = 0x30BF ;
1515const EGL_PLATFORM_WAYLAND_KHR : u32 = 0x31D8 ;
1616const EGL_PLATFORM_X11_KHR : u32 = 0x31D5 ;
17+ const EGL_PLATFORM_XCB_EXT : u32 = 0x31DC ;
18+ const EGL_PLATFORM_XCB_SCREEN_EXT : u32 = 0x31DE ;
1719const EGL_PLATFORM_ANGLE_ANGLE : u32 = 0x3202 ;
1820const EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE : u32 = 0x348F ;
1921const EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED : u32 = 0x3451 ;
@@ -812,7 +814,27 @@ impl crate::Instance for Instance {
812814 . map_err ( instance_err ( "failed to get Angle display" ) ) ?;
813815 ( display, WindowKind :: AngleX11 )
814816 }
815- ( Some ( Rdh :: Xcb ( _xcb_display_handle) ) , Some ( _egl) ) => todo ! ( "xcb" ) ,
817+ ( Some ( Rdh :: Xcb ( xcb_display_handle) ) , Some ( egl) )
818+ if client_ext_str. contains ( "EGL_EXT_platform_xcb" ) =>
819+ {
820+ log:: debug!( "Using XCB platform" ) ;
821+ let display_attributes = [
822+ EGL_PLATFORM_XCB_SCREEN_EXT as khronos_egl:: Attrib ,
823+ xcb_display_handle. screen as khronos_egl:: Attrib ,
824+ khronos_egl:: ATTRIB_NONE ,
825+ ] ;
826+ let display = unsafe {
827+ egl. get_platform_display (
828+ EGL_PLATFORM_XCB_EXT ,
829+ xcb_display_handle
830+ . connection
831+ . map_or ( khronos_egl:: DEFAULT_DISPLAY , ptr:: NonNull :: as_ptr) ,
832+ & display_attributes,
833+ )
834+ }
835+ . map_err ( instance_err ( "failed to get XCB display" ) ) ?;
836+ ( display, WindowKind :: X11 )
837+ }
816838 x if client_ext_str. contains ( "EGL_MESA_platform_surfaceless" ) => {
817839 log:: debug!(
818840 "No (or unknown) windowing system ({x:?}) present. Using surfaceless platform"
0 commit comments