MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / enum_renderer_pixel_formats

Function enum_renderer_pixel_formats

platform/mac/pixelformat.cpp:307–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305
306
307static void enum_renderer_pixel_formats(renderer_properties renderer, CFMutableArrayRef pixel_format_array, CFMutableSetRef pixel_format_set)
308{
309 CGLPixelFormatAttribute attribs[64];
310 attribs[0] = kCGLPFAMinimumPolicy;
311 attribs[1] = kCGLPFAClosestPolicy;
312 attribs[2] = kCGLPFARendererID;
313 attribs[3] = (CGLPixelFormatAttribute)renderer.renderer_id;
314 attribs[4] = kCGLPFASingleRenderer;
315 int n = 5, n_stack[16], n_stack_idx = -1;
316 unsigned int tried_pixel_formats = 0, failed_pixel_formats = 0, dupe_pixel_formats = 0,
317 new_pixel_formats = 0;
318 pixel_format request;
319 unsigned int double_buffer;
320 unsigned int accelerated = renderer.accelerated;
321
322 if (accelerated) {
323 attribs[n++] = kCGLPFAAccelerated;
324 attribs[n++] = kCGLPFANoRecovery;
325 } else if (!allow_software_rendering) {
326 klog("ignoring software renderer because AllowSoftwareRendering is off\n");
327 return;
328 }
329
330 n_stack[++n_stack_idx] = n;
331 for (double_buffer = 0; double_buffer <= 1; double_buffer++) {
332 unsigned int aux;
333
334 n = n_stack[n_stack_idx];
335
336 if ((!double_buffer && !(renderer.buffer_modes & kCGLSingleBufferBit)) || (double_buffer && !(renderer.buffer_modes & kCGLDoubleBufferBit))) {
337 continue;
338 }
339 if (double_buffer) {
340 attribs[n++] = kCGLPFADoubleBuffer;
341 }
342 memset(&request, 0, sizeof(request));
343 request.accelerated = accelerated;
344 request.double_buffer = double_buffer;
345
346 /* Don't bother with in-between aux buffers values: either 0 or max. */
347 n_stack[++n_stack_idx] = n;
348 for (aux = 0; aux <= renderer.max_aux_buffers; aux += renderer.max_aux_buffers) {
349 unsigned int color_mode;
350
351 n = n_stack[n_stack_idx];
352
353 attribs[n++] = kCGLPFAAuxBuffers;
354 attribs[n++] = (CGLPixelFormatAttribute)aux;
355 request.aux_buffers = aux;
356
357 n_stack[++n_stack_idx] = n;
358 for (color_mode = 0; color_mode < ARRAY_SIZE(color_modes); color_mode++) {
359 unsigned int depth_mode;
360
361 n = n_stack[n_stack_idx];
362
363 if (!(renderer.color_modes & color_modes[color_mode].mode)) {
364 continue;

Callers 1

init_pixel_formatsFunction · 0.85

Calls 7

klogFunction · 0.85
maxFunction · 0.85
best_color_modeFunction · 0.85
best_accum_modeFunction · 0.85
code_for_pixel_formatFunction · 0.85
CFReleaseFunction · 0.85
klog_fmtFunction · 0.85

Tested by

no test coverage detected