2
* Copyright (C) 2019 Google Inc. All rights reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
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.
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.
28
#include "ExtensionsGL.h"
30
#include "GraphicsContextGLOpenGL.h"
31
#include <wtf/text/StringHash.h>
35
class ExtensionsGLANGLE : public ExtensionsGL {
36
WTF_MAKE_FAST_ALLOCATED;
38
// This class only needs to be instantiated by GraphicsContextGLOpenGL implementations.
39
ExtensionsGLANGLE(GraphicsContextGLOpenGL*, bool useIndexedGetString = false);
40
virtual ~ExtensionsGLANGLE();
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;
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;
57
String getTranslatedShaderSourceANGLE(PlatformGLObject) override;
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;
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;
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;
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; }
77
bool requiresBuiltInFunctionEmulation() override { return m_requiresBuiltInFunctionEmulation; }
78
bool requiresRestrictedMaximumTextureSize() override { return m_requiresRestrictedMaximumTextureSize; }
81
bool supportsExtension(const WTF::String&);
82
String getExtensions();
84
virtual void initializeAvailableExtensions();
85
bool m_initializedAvailableExtensions;
86
HashSet<String> m_availableExtensions;
87
HashSet<String> m_requestableExtensions;
88
HashSet<String> m_enabledExtensions;
90
// Weak pointer back to GraphicsContextGLOpenGL.
91
GraphicsContextGLOpenGL* m_context;
97
bool m_requiresBuiltInFunctionEmulation;
98
bool m_requiresRestrictedMaximumTextureSize;
100
bool m_useIndexedGetString { false };
106
} // namespace WebCore