~mmach/netext73/webkit2gtk

« back to all changes in this revision

Viewing changes to Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.h

  • Committer: mmach
  • Date: 2023-06-16 17:21:37 UTC
  • Revision ID: netbit73@gmail.com-20230616172137-2rqx6yr96ga9g3kp
1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2011 Google Inc. All rights reserved.
 
3
 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions
 
7
 * are met:
 
8
 *
 
9
 * 1.  Redistributions of source code must retain the above copyright
 
10
 *     notice, this list of conditions and the following disclaimer.
 
11
 * 2.  Redistributions in binary form must reproduce the above copyright
 
12
 *     notice, this list of conditions and the following disclaimer in the
 
13
 *     documentation and/or other materials provided with the distribution.
 
14
 *
 
15
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 
16
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
17
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
18
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 
19
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
20
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
21
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 
22
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
25
 */
 
26
 
 
27
#pragma once
 
28
 
 
29
#include "ExtensionsGL.h"
 
30
 
 
31
#include "GraphicsContextGLOpenGL.h"
 
32
#include <wtf/HashSet.h>
 
33
#include <wtf/text/StringHash.h>
 
34
 
 
35
namespace WebCore {
 
36
 
 
37
class ExtensionsGLOpenGLCommon : public ExtensionsGL {
 
38
    WTF_MAKE_FAST_ALLOCATED;
 
39
public:
 
40
    virtual ~ExtensionsGLOpenGLCommon();
 
41
 
 
42
    // ExtensionsGL methods.
 
43
    bool supports(const String&) override;
 
44
    void ensureEnabled(const String&) override;
 
45
    bool isEnabled(const String&) override;
 
46
    int getGraphicsResetStatusARB() override;
 
47
 
 
48
    PlatformGLObject createVertexArrayOES() override = 0;
 
49
    void deleteVertexArrayOES(PlatformGLObject) override = 0;
 
50
    GCGLboolean isVertexArrayOES(PlatformGLObject) override = 0;
 
51
    void bindVertexArrayOES(PlatformGLObject) override = 0;
 
52
 
 
53
    void drawBuffersEXT(GCGLsizei, const GCGLenum*) override = 0;
 
54
 
 
55
    String getTranslatedShaderSourceANGLE(PlatformGLObject) override;
 
56
 
 
57
    // EXT Robustness - uses getGraphicsResetStatusARB()
 
58
    void readnPixelsEXT(int x, int y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, void *data) override;
 
59
    void getnUniformfvEXT(GCGLuint program, int location, GCGLsizei bufSize, float *params) override;
 
60
    void getnUniformivEXT(GCGLuint program, int location, GCGLsizei bufSize, int *params) override;
 
61
 
 
62
    bool isNVIDIA() override { return m_isNVIDIA; }
 
63
    bool isAMD() override { return m_isAMD; }
 
64
    bool isIntel() override { return m_isIntel; }
 
65
    bool isImagination() override { return m_isImagination; }
 
66
    String vendor() override { return m_vendor; }
 
67
 
 
68
    bool requiresBuiltInFunctionEmulation() override { return m_requiresBuiltInFunctionEmulation; }
 
69
    bool requiresRestrictedMaximumTextureSize() override { return m_requiresRestrictedMaximumTextureSize; }
 
70
 
 
71
protected:
 
72
    friend class ExtensionsGLOpenGLES;
 
73
    ExtensionsGLOpenGLCommon(GraphicsContextGLOpenGL*, bool useIndexedGetString);
 
74
 
 
75
    virtual bool supportsExtension(const String&) = 0;
 
76
    virtual String getExtensions() = 0;
 
77
 
 
78
    virtual void initializeAvailableExtensions();
 
79
    bool m_initializedAvailableExtensions;
 
80
    HashSet<String> m_availableExtensions;
 
81
 
 
82
    // Weak pointer back to GraphicsContextGLOpenGL
 
83
    GraphicsContextGLOpenGL* m_context;
 
84
 
 
85
    bool m_isNVIDIA;
 
86
    bool m_isAMD;
 
87
    bool m_isIntel;
 
88
    bool m_isImagination;
 
89
    bool m_requiresBuiltInFunctionEmulation;
 
90
    bool m_requiresRestrictedMaximumTextureSize;
 
91
 
 
92
    bool m_useIndexedGetString { false };
 
93
 
 
94
    String m_vendor;
 
95
    String m_renderer;
 
96
};
 
97
 
 
98
} // namespace WebCore