summaryrefslogtreecommitdiffstats
path: root/src/core/macos_context_type_helper.mm
blob: 9bdd360857e627a3dba7daef69da52ef9b22eb23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

#include "macos_context_type_helper.h"

bool isCurrentContextSoftware()
{
    int rendererID = 0;
    [NSOpenGLContext.currentContext getValues:&rendererID forParameter:NSOpenGLContextParameterCurrentRendererID];
    return (rendererID & kCGLRendererIDMatchingMask) == kCGLRendererGenericFloatID;
}

void* cglContext(NSOpenGLContext *nsOpenGLContext)
{
   return [nsOpenGLContext CGLContextObj];
}