@@ -39,32 +39,44 @@ namespace Testing
3939
4040NativeWindow GPUTestingEnvironment::CreateNativeWindow ()
4141{
42- LOG_INFO_MESSAGE (" XOpenDisplay" );
43- auto * display = XOpenDisplay (0 );
44- LOG_INFO_MESSAGE (" XOpenDisplay completed" );
42+ LOG_INFO_MESSAGE (" XOpenDisplay" );
43+ auto * display = XOpenDisplay (0 );
44+ LOG_INFO_MESSAGE (" XOpenDisplay completed" );
4545
46+ // GLXFBConfig* fbc = nullptr;
47+ {
48+ LOG_INFO_MESSAGE (" Getting available GLXFBConfigs" );
49+ int fbcount = 0 ;
50+ GLXFBConfig* fbcs = glXGetFBConfigs (display, DefaultScreen (display), &fbcount);
51+ if (fbcount > 0 )
52+ LOG_INFO_MESSAGE (" Available framebuffer configs: " , fbcount);
53+ else
54+ LOG_ERROR_MESSAGE (" No framebuffer configs found" );
55+
56+ for (int i = 0 ; i < fbcount; i++)
4657 {
47- LOG_INFO_MESSAGE (" Getting available GLXFBConfigs" );
48- int fbcount = 0 ;
49- GLXFBConfig* fbcs = glXGetFBConfigs (display, DefaultScreen (display), &fbcount);
50- if (fbcount > 0 )
51- LOG_INFO_MESSAGE (" Available framebuffer configs: " , fbcount);
52- else
53- LOG_ERROR_MESSAGE (" No framebuffer configs found" );
54-
55- for (int i = 0 ; i < fbcount; i++) {
56- int red, green, blue, alpha, depth;
57- glXGetFBConfigAttrib (display, fbcs[i], GLX_RED_SIZE, &red);
58- glXGetFBConfigAttrib (display, fbcs[i], GLX_GREEN_SIZE, &green);
59- glXGetFBConfigAttrib (display, fbcs[i], GLX_BLUE_SIZE, &blue);
60- glXGetFBConfigAttrib (display, fbcs[i], GLX_ALPHA_SIZE, &alpha);
61- glXGetFBConfigAttrib (display, fbcs[i], GLX_DEPTH_SIZE, &depth);
62-
63- LOG_INFO_MESSAGE (" FBConfig " , i, " : R" , red, " G" , green, " B" , blue, " A" , alpha, " Depth" , depth);
64- }
58+ int red, green, blue, alpha, depth, samples, render_type, double_buffer, drawable_type;
59+ glXGetFBConfigAttrib (display, fbcs[i], GLX_RED_SIZE, &red);
60+ glXGetFBConfigAttrib (display, fbcs[i], GLX_GREEN_SIZE, &green);
61+ glXGetFBConfigAttrib (display, fbcs[i], GLX_BLUE_SIZE, &blue);
62+ glXGetFBConfigAttrib (display, fbcs[i], GLX_ALPHA_SIZE, &alpha);
63+ glXGetFBConfigAttrib (display, fbcs[i], GLX_DEPTH_SIZE, &depth);
64+ glXGetFBConfigAttrib (display, fbcs[i], GLX_SAMPLES, &samples);
65+ glXGetFBConfigAttrib (display, fbcs[i], GLX_RENDER_TYPE, &render_type);
66+ glXGetFBConfigAttrib (display, fbcs[i], GLX_DOUBLEBUFFER, &double_buffer);
67+ glXGetFBConfigAttrib (display, fbcs[i], GLX_DRAWABLE_TYPE, &drawable_type);
68+
69+ LOG_INFO_MESSAGE (" FBConfig " , i, " : R" , red, " G" , green, " B" , blue, " A" , alpha, " D" , depth, " S" , samples,
70+ " T " , render_type, " DB " , double_buffer, " DT " , drawable_type);
71+
72+ // if (fbc == nullptr && red == 8 && depth == 24 && render_type == GLX_RGBA_BIT && double_buffer != 0)
73+ // fbc = &fbcs[i];
6574 }
6675
67- // clang-format off
76+ XFree (fbcs);
77+ }
78+
79+ // clang-format off
6880 static int visual_attribs[] =
6981 {
7082 GLX_RENDER_TYPE, GLX_RGBA_BIT,
@@ -80,22 +92,22 @@ NativeWindow GPUTestingEnvironment::CreateNativeWindow()
8092 GLX_ALPHA_SIZE, 8 ,
8193
8294 // The largest available depth buffer of at least GLX_DEPTH_SIZE size is preferred
83- GLX_DEPTH_SIZE, 32 ,
95+ GLX_DEPTH_SIZE, 24 ,
8496
8597 // GLX_SAMPLE_BUFFERS, 1,
86- GLX_SAMPLES, 1 ,
98+ // GLX_SAMPLES, 1,
8799 None
88100 };
89- // clang-format on
101+ // clang-format on
90102
91- int fbcount = 0 ;
92- LOG_INFO_MESSAGE (" glXChooseFBConfig" );
93- GLXFBConfig* fbc = glXChooseFBConfig (display, DefaultScreen (display), visual_attribs, &fbcount);
94- LOG_INFO_MESSAGE (" glXChooseFBConfig completed" );
95- if (!fbc)
96- {
97- LOG_ERROR_AND_THROW (" Failed to retrieve a framebuffer config" );
98- }
103+ int fbcount = 0 ;
104+ LOG_INFO_MESSAGE (" glXChooseFBConfig" );
105+ GLXFBConfig* fbc = glXChooseFBConfig (display, DefaultScreen (display), visual_attribs, &fbcount);
106+ LOG_INFO_MESSAGE (" glXChooseFBConfig completed" );
107+ if (!fbc)
108+ {
109+ LOG_ERROR_AND_THROW (" Failed to retrieve a framebuffer config" );
110+ }
99111
100112 LOG_INFO_MESSAGE (" glXGetVisualFromFBConfig" );
101113 XVisualInfo* vi = glXGetVisualFromFBConfig (display, fbc[0 ]);
@@ -186,7 +198,7 @@ NativeWindow GPUTestingEnvironment::CreateNativeWindow()
186198 {
187199 LOG_ERROR_AND_THROW (" Failed to create GL context." );
188200 }
189- XFree (fbc);
201+ // XFree(fbc);
190202
191203 LOG_INFO_MESSAGE (" glXMakeCurrent" );
192204 glXMakeCurrent (display, win, ctx);
0 commit comments