summaryrefslogtreecommitdiffstats
path: root/src/core/ozone/gl_share_context_qt.h
blob: 89be00421186261d17878fec56bb35f3330488e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// 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

#ifndef GL_SHARE_CONTEXT_QT
#define GL_SHARE_CONTEXT_QT

#include "ui/gl/gpu_timing.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_share_group.h"
#include "qtwebenginecoreglobal.h"

QT_FORWARD_DECLARE_CLASS(QOpenGLContext)

namespace QtWebEngineCore {

class QtShareGLContext : public gl::GLContext
{

public:
    QtShareGLContext(QOpenGLContext *qtContext);
    void *GetHandle() override { return m_handle; }
    unsigned int CheckStickyGraphicsResetStatusImpl() override;
    // We don't care about the rest, this context shouldn't be used except for its handle.
    bool Initialize(gl::GLSurface *, const gl::GLContextAttribs &) override
    {
        Q_UNREACHABLE();
        return false;
    }
    bool MakeCurrentImpl(gl::GLSurface *) override
    {
        Q_UNREACHABLE();
        return false;
    }
    void ReleaseCurrent(gl::GLSurface *) override { Q_UNREACHABLE(); }
    bool IsCurrent(gl::GLSurface *) override
    {
        Q_UNREACHABLE();
        return false;
    }
    scoped_refptr<gl::GPUTimingClient> CreateGPUTimingClient() override { return nullptr; }
    const gfx::ExtensionSet &GetExtensions() override
    {
        static const gfx::ExtensionSet s_emptySet;
        return s_emptySet;
    }
    void ResetExtensions() override {}

private:
    void *m_handle;
};

class ShareGroupQt : public gl::GLShareGroup
{

public:
    gl::GLContext *GetContext() override { return m_shareContextQt.get(); }
    void AboutToAddFirstContext() override;

private:
    scoped_refptr<gl::GLContext> m_shareContextQt;
};
} // namespace
#endif