~mmach/netext73/webkit2gtk

« back to all changes in this revision

Viewing changes to Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.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) 2019 Google Inc. All rights reserved.
 
3
 *
 
4
 * Redistribution and use in source and binary forms, with or without
 
5
 * modification, are permitted provided that the following conditions
 
6
 * are met:
 
7
 *
 
8
 * 1.  Redistributions of source code must retain the above copyright
 
9
 *     notice, this list of conditions and the following disclaimer.
 
10
 * 2.  Redistributions in binary form must reproduce the above copyright
 
11
 *     notice, this list of conditions and the following disclaimer in the
 
12
 *     documentation and/or other materials provided with the distribution.
 
13
 *
 
14
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 
15
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
16
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
17
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 
18
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
19
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
20
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 
21
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
24
 */
 
25
 
 
26
#pragma once
 
27
 
 
28
#include "ExtensionsGL.h"
 
29
 
 
30
#include "GraphicsContextGLOpenGL.h"
 
31
#include <wtf/text/StringHash.h>
 
32
 
 
33
namespace WebCore {
 
34
 
 
35
class ExtensionsGLANGLE : public ExtensionsGL {
 
36
    WTF_MAKE_FAST_ALLOCATED;
 
37
public:
 
38
    // This class only needs to be instantiated by GraphicsContextGLOpenGL implementations.
 
39
    ExtensionsGLANGLE(GraphicsContextGLOpenGL*, bool useIndexedGetString = false);
 
40
    virtual ~ExtensionsGLANGLE();
 
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;
 
49
    void deleteVertexArrayOES(PlatformGLObject) override;
 
50
    GCGLboolean isVertexArrayOES(PlatformGLObject) override;
 
51
    void bindVertexArrayOES(PlatformGLObject) override;
 
52
    void insertEventMarkerEXT(const String&) override;
 
53
    void pushGroupMarkerEXT(const String&) override;
 
54
    void popGroupMarkerEXT(void) override;
 
55
    void drawBuffersEXT(GCGLsizei, const GCGLenum*) override;
 
56
 
 
57
    String getTranslatedShaderSourceANGLE(PlatformGLObject) override;
 
58
 
 
59
    void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter) override;
 
60
    void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) override;
 
61
 
 
62
    void drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) override;
 
63
    void drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount) override;
 
64
    void vertexAttribDivisor(GCGLuint index, GCGLuint divisor) override;
 
65
 
 
66
    // EXT Robustness - uses getGraphicsResetStatusARB()
 
67
    void readnPixelsEXT(int x, int y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, void *data) override;
 
68
    void getnUniformfvEXT(GCGLuint program, int location, GCGLsizei bufSize, float *params) override;
 
69
    void getnUniformivEXT(GCGLuint program, int location, GCGLsizei bufSize, int *params) override;
 
70
 
 
71
    bool isNVIDIA() override { return m_isNVIDIA; }
 
72
    bool isAMD() override { return m_isAMD; }
 
73
    bool isIntel() override { return m_isIntel; }
 
74
    bool isImagination() override { return m_isImagination; }
 
75
    String vendor() override { return m_vendor; }
 
76
 
 
77
    bool requiresBuiltInFunctionEmulation() override { return m_requiresBuiltInFunctionEmulation; }
 
78
    bool requiresRestrictedMaximumTextureSize() override { return m_requiresRestrictedMaximumTextureSize; }
 
79
 
 
80
private:
 
81
    bool supportsExtension(const WTF::String&);
 
82
    String getExtensions();
 
83
 
 
84
    virtual void initializeAvailableExtensions();
 
85
    bool m_initializedAvailableExtensions;
 
86
    HashSet<String> m_availableExtensions;
 
87
    HashSet<String> m_requestableExtensions;
 
88
    HashSet<String> m_enabledExtensions;
 
89
 
 
90
    // Weak pointer back to GraphicsContextGLOpenGL.
 
91
    GraphicsContextGLOpenGL* m_context;
 
92
 
 
93
    bool m_isNVIDIA;
 
94
    bool m_isAMD;
 
95
    bool m_isIntel;
 
96
    bool m_isImagination;
 
97
    bool m_requiresBuiltInFunctionEmulation;
 
98
    bool m_requiresRestrictedMaximumTextureSize;
 
99
 
 
100
    bool m_useIndexedGetString { false };
 
101
 
 
102
    String m_vendor;
 
103
    String m_renderer;
 
104
};
 
105
 
 
106
} // namespace WebCore