Skip to content

Commit c24bbee

Browse files
committed
Update ANGLE binaries.
- the binaries are pulled from Chrome 131 binary dirs - load the entry points via a loader, using code from ANGLE - use the WebGL compatibility mode extension in ANGLE - replace Linux and Mac gyp builds with binaries - enable requested ANGLE WebGL extensions on demand - force ANGLE to use a GLES 2.0 context for WebGL - turn on more extension conformance tests - work around ANGLE multisample ext enum bug - remove the ANGLE submodule since it's no longer used This contribution is funded by https://higharc.com/
1 parent c16e31e commit c24bbee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+31048
-719
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "angle"]
2-
path = angle
3-
url = https://github.com/stackgl/angle.git

angle

Lines changed: 0 additions & 1 deletion
This file was deleted.

binding.gyp

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,20 @@
1616
'sources': [
1717
'src/native/bindings.cc',
1818
'src/native/webgl.cc',
19-
'src/native/procs.cc'
19+
'src/native/SharedLibrary.cc',
20+
'src/native/angle-loader/egl_loader.cc',
21+
'src/native/angle-loader/gles_loader.cc'
2022
],
2123
'include_dirs': [
2224
"<!(node -e \"require('nan')\")",
2325
'<(module_root_dir)/deps/include',
24-
"angle/include"
26+
"src/native/angle-includes"
2527
],
2628
'library_dirs': [
2729
'<(module_root_dir)/deps/<(platform)'
2830
],
2931
'conditions': [
3032
['OS=="mac"', {
31-
'dependencies':
32-
[
33-
'angle/src/angle.gyp:libEGL',
34-
'angle/src/angle.gyp:libGLESv2'
35-
],
3633
'libraries': [
3734
'-framework QuartzCore',
3835
'-framework Quartz'
@@ -45,22 +42,28 @@
4542
'CLANG_CXX_LANGUAGE_STANDARD':'c++17',
4643
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0'
4744
},
45+
"copies": [
46+
{
47+
'destination': '<(PRODUCT_DIR)',
48+
'files': [
49+
'<(module_root_dir)/deps/darwin/dylib/libEGL.dylib',
50+
'<(module_root_dir)/deps/darwin/dylib/libGLESv2.dylib',
51+
]
52+
}
53+
]
4854
}],
4955
['OS=="linux"', {
50-
'dependencies':
51-
[
52-
'angle/src/angle.gyp:libEGL',
53-
'angle/src/angle.gyp:libGLESv2'
54-
]
56+
"copies": [
57+
{
58+
'destination': '<(PRODUCT_DIR)',
59+
'files': [
60+
'<(module_root_dir)/deps/linux/so/libEGL.so',
61+
'<(module_root_dir)/deps/linux/so/libGLESv2.so',
62+
]
63+
}
64+
]
5565
}],
5666
['OS=="win"', {
57-
'library_dirs': [
58-
'<(module_root_dir)/deps/windows/lib/<(target_arch)',
59-
],
60-
'libraries': [
61-
'libEGL.lib',
62-
'libGLESv2.lib'
63-
],
6467
'defines' : [
6568
'WIN32_LEAN_AND_MEAN',
6669
'VC_EXTRALEAN'
@@ -102,11 +105,11 @@
102105
},
103106
"copies": [
104107
{
105-
'destination': '$(SolutionDir)$(ConfigurationName)',
108+
'destination': '<(PRODUCT_DIR)',
106109
'files': [
107-
'<(module_root_dir)/deps/windows/dll/<(target_arch)/libEGL.dll',
108-
'<(module_root_dir)/deps/windows/dll/<(target_arch)/libGLESv2.dll',
109-
'<(module_root_dir)/deps/windows/dll/<(target_arch)/d3dcompiler_47.dll'
110+
'<(module_root_dir)/deps/windows/dll/libEGL.dll',
111+
'<(module_root_dir)/deps/windows/dll/libGLESv2.dll',
112+
'<(module_root_dir)/deps/windows/dll/d3dcompiler_47.dll'
110113
]
111114
}
112115
]

deps/darwin/dylib/libEGL.dylib

479 KB
Binary file not shown.

deps/darwin/dylib/libGLESv2.dylib

14.4 MB
Binary file not shown.

deps/linux/so/libEGL.so

235 KB
Binary file not shown.

deps/linux/so/libGLESv2.so

6.62 MB
Binary file not shown.

deps/windows/dll/d3dcompiler_47.dll

4.69 MB
Binary file not shown.

deps/windows/dll/libEGL.dll

493 KB
Binary file not shown.

deps/windows/dll/libGLESv2.dll

7.86 MB
Binary file not shown.
-3.98 MB
Binary file not shown.

deps/windows/dll/x64/libEGL.dll

-85.5 KB
Binary file not shown.

deps/windows/dll/x64/libGLESv2.dll

-2.6 MB
Binary file not shown.

deps/windows/lib/x64/libEGL.lib

-12.6 KB
Binary file not shown.

deps/windows/lib/x64/libGLESv2.lib

-166 KB
Binary file not shown.

src/javascript/extensions/angle-instanced-arrays.js

Lines changed: 6 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -1,159 +1,21 @@
11
const { gl } = require('../native-gl')
2-
const { vertexCount } = require('../utils')
32

43
class ANGLEInstancedArrays {
54
constructor (ctx) {
65
this.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88fe
76
this.ctx = ctx
87

9-
this._drawArraysInstanced = gl._drawArraysInstanced.bind(ctx)
10-
this._drawElementsInstanced = gl._drawElementsInstanced.bind(ctx)
11-
this._vertexAttribDivisor = gl._vertexAttribDivisor.bind(ctx)
8+
this._drawArraysInstancedANGLE = gl._drawArraysInstancedANGLE.bind(ctx)
9+
this._drawElementsInstancedANGLE = gl._drawElementsInstancedANGLE.bind(ctx)
10+
this._vertexAttribDivisorANGLE = gl._vertexAttribDivisorANGLE.bind(ctx)
1211
}
1312

1413
drawArraysInstancedANGLE (mode, first, count, primCount) {
15-
const { ctx } = this
16-
mode |= 0
17-
first |= 0
18-
count |= 0
19-
primCount |= 0
20-
if (first < 0 || count < 0 || primCount < 0) {
21-
ctx.setError(gl.INVALID_VALUE)
22-
return
23-
}
24-
if (!ctx._checkStencilState()) {
25-
return
26-
}
27-
const reducedCount = vertexCount(mode, count)
28-
if (reducedCount < 0) {
29-
ctx.setError(gl.INVALID_ENUM)
30-
return
31-
}
32-
if (!ctx._framebufferOk()) {
33-
return
34-
}
35-
if (count === 0 || primCount === 0) {
36-
return
37-
}
38-
let maxIndex = first
39-
if (count > 0) {
40-
maxIndex = (count + first - 1) >>> 0
41-
}
42-
if (this.checkInstancedVertexAttribState(maxIndex, primCount)) {
43-
return this._drawArraysInstanced(mode, first, reducedCount, primCount)
44-
}
14+
this._drawArraysInstancedANGLE(mode, first, count, primCount)
4515
}
4616

4717
drawElementsInstancedANGLE (mode, count, type, ioffset, primCount) {
48-
const { ctx } = this
49-
mode |= 0
50-
count |= 0
51-
type |= 0
52-
ioffset |= 0
53-
primCount |= 0
54-
55-
if (count < 0 || ioffset < 0 || primCount < 0) {
56-
ctx.setError(gl.INVALID_VALUE)
57-
return
58-
}
59-
60-
if (!ctx._checkStencilState()) {
61-
return
62-
}
63-
64-
const elementBuffer = ctx._vertexObjectState._elementArrayBufferBinding
65-
if (!elementBuffer) {
66-
ctx.setError(gl.INVALID_OPERATION)
67-
return
68-
}
69-
70-
// Unpack element data
71-
let elementData = null
72-
let offset = ioffset
73-
if (type === gl.UNSIGNED_SHORT) {
74-
if (offset % 2) {
75-
ctx.setError(gl.INVALID_OPERATION)
76-
return
77-
}
78-
offset >>= 1
79-
elementData = new Uint16Array(elementBuffer._elements.buffer)
80-
} else if (ctx._extensions.oes_element_index_uint && type === gl.UNSIGNED_INT) {
81-
if (offset % 4) {
82-
ctx.setError(gl.INVALID_OPERATION)
83-
return
84-
}
85-
offset >>= 2
86-
elementData = new Uint32Array(elementBuffer._elements.buffer)
87-
} else if (type === gl.UNSIGNED_BYTE) {
88-
elementData = elementBuffer._elements
89-
} else {
90-
ctx.setError(gl.INVALID_ENUM)
91-
return
92-
}
93-
94-
let reducedCount = count
95-
switch (mode) {
96-
case gl.TRIANGLES:
97-
if (count % 3) {
98-
reducedCount -= (count % 3)
99-
}
100-
break
101-
case gl.LINES:
102-
if (count % 2) {
103-
reducedCount -= (count % 2)
104-
}
105-
break
106-
case gl.POINTS:
107-
break
108-
case gl.LINE_LOOP:
109-
case gl.LINE_STRIP:
110-
if (count < 2) {
111-
ctx.setError(gl.INVALID_OPERATION)
112-
return
113-
}
114-
break
115-
case gl.TRIANGLE_FAN:
116-
case gl.TRIANGLE_STRIP:
117-
if (count < 3) {
118-
ctx.setError(gl.INVALID_OPERATION)
119-
return
120-
}
121-
break
122-
default:
123-
ctx.setError(gl.INVALID_ENUM)
124-
return
125-
}
126-
127-
if (!ctx._framebufferOk()) {
128-
return
129-
}
130-
131-
if (count === 0 || primCount === 0) {
132-
this.checkInstancedVertexAttribState(0, 0)
133-
return
134-
}
135-
136-
if ((count + offset) >>> 0 > elementData.length) {
137-
ctx.setError(gl.INVALID_OPERATION)
138-
return
139-
}
140-
141-
// Compute max index
142-
let maxIndex = -1
143-
for (let i = offset; i < offset + count; ++i) {
144-
maxIndex = Math.max(maxIndex, elementData[i])
145-
}
146-
147-
if (maxIndex < 0) {
148-
this.checkInstancedVertexAttribState(0, 0)
149-
return
150-
}
151-
152-
if (this.checkInstancedVertexAttribState(maxIndex, primCount)) {
153-
if (reducedCount > 0) {
154-
this._drawElementsInstanced(mode, reducedCount, type, ioffset, primCount)
155-
}
156-
}
18+
this._drawElementsInstancedANGLE(mode, count, type, ioffset, primCount)
15719
}
15820

15921
vertexAttribDivisorANGLE (index, divisor) {
@@ -167,53 +29,7 @@ class ANGLEInstancedArrays {
16729
}
16830
const attrib = ctx._vertexObjectState._attribs[index]
16931
attrib._divisor = divisor
170-
this._vertexAttribDivisor(index, divisor)
171-
}
172-
173-
checkInstancedVertexAttribState (maxIndex, primCount) {
174-
const { ctx } = this
175-
const program = ctx._activeProgram
176-
if (!program) {
177-
ctx.setError(gl.INVALID_OPERATION)
178-
return false
179-
}
180-
181-
const attribs = ctx._vertexObjectState._attribs
182-
let hasZero = false
183-
for (let i = 0; i < attribs.length; ++i) {
184-
const attrib = attribs[i]
185-
if (attrib._isPointer) {
186-
const buffer = attrib._pointerBuffer
187-
if (program._attributes.indexOf(i) >= 0) {
188-
if (!buffer) {
189-
ctx.setError(gl.INVALID_OPERATION)
190-
return false
191-
}
192-
let maxByte = 0
193-
if (attrib._divisor === 0) {
194-
hasZero = true
195-
maxByte = attrib._pointerStride * maxIndex +
196-
attrib._pointerSize +
197-
attrib._pointerOffset
198-
} else {
199-
maxByte = attrib._pointerStride * (Math.ceil(primCount / attrib._divisor) - 1) +
200-
attrib._pointerSize +
201-
attrib._pointerOffset
202-
}
203-
if (maxByte > buffer._size) {
204-
ctx.setError(gl.INVALID_OPERATION)
205-
return false
206-
}
207-
}
208-
}
209-
}
210-
211-
if (!hasZero) {
212-
ctx.setError(gl.INVALID_OPERATION)
213-
return false
214-
}
215-
216-
return true
32+
this._vertexAttribDivisorANGLE(index, divisor)
21733
}
21834
}
21935

src/javascript/webgl-rendering-context.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext {
851851
gl.STREAM_DRAW)
852852
super.enableVertexAttribArray(0)
853853
super.vertexAttribPointer(0, 4, gl.FLOAT, false, 0, 0)
854-
super._vertexAttribDivisor(0, 1)
854+
super._vertexAttribDivisorANGLE(0, 1)
855855
}
856856

857857
_endAttrib0Hack () {
@@ -868,7 +868,7 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext {
868868
attrib._pointerNormal,
869869
attrib._inputStride,
870870
attrib._pointerOffset)
871-
super._vertexAttribDivisor(0, attrib._divisor)
871+
super._vertexAttribDivisorANGLE(0, attrib._divisor)
872872
super.disableVertexAttribArray(0)
873873
if (this._vertexGlobalState._arrayBufferBinding) {
874874
super.bindBuffer(gl.ARRAY_BUFFER, this._vertexGlobalState._arrayBufferBinding._)
@@ -1184,6 +1184,7 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext {
11841184
const ext = availableExtensions[str] ? availableExtensions[str](this) : null
11851185
if (ext) {
11861186
this._extensions[str] = ext
1187+
super.getExtension(str)
11871188
}
11881189
return ext
11891190
}
@@ -1213,15 +1214,15 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext {
12131214
exts.push('OES_texture_float_linear')
12141215
}
12151216

1216-
if (supportedExts.indexOf('EXT_draw_buffers') >= 0) {
1217+
if (supportedExts.indexOf('GL_EXT_draw_buffers') >= 0) {
12171218
exts.push('WEBGL_draw_buffers')
12181219
}
12191220

1220-
if (supportedExts.indexOf('EXT_blend_minmax') >= 0) {
1221+
if (supportedExts.indexOf('GL_EXT_blend_minmax') >= 0) {
12211222
exts.push('EXT_blend_minmax')
12221223
}
12231224

1224-
if (supportedExts.indexOf('EXT_texture_filter_anisotropic') >= 0) {
1225+
if (supportedExts.indexOf('GL_EXT_texture_filter_anisotropic') >= 0) {
12251226
exts.push('EXT_texture_filter_anisotropic')
12261227
}
12271228

@@ -1607,7 +1608,9 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext {
16071608
object._checkDelete()
16081609
return
16091610
}
1610-
this.setError(gl.INVALID_OPERATION)
1611+
if (object !== null) {
1612+
this.setError(gl.INVALID_OPERATION)
1613+
}
16111614
}
16121615

16131616
deleteBuffer (buffer) {
@@ -1863,7 +1866,7 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext {
18631866
return super.drawArrays(mode, first, reducedCount)
18641867
} else {
18651868
this._beginAttrib0Hack()
1866-
super._drawArraysInstanced(mode, first, reducedCount, 1)
1869+
super._drawArraysInstancedANGLE(mode, first, reducedCount, 1)
18671870
this._endAttrib0Hack()
18681871
}
18691872
}
@@ -1984,7 +1987,7 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext {
19841987
return super.drawElements(mode, reducedCount, type, ioffset)
19851988
} else {
19861989
this._beginAttrib0Hack()
1987-
super._drawElementsInstanced(mode, reducedCount, type, ioffset, 1)
1990+
super._drawElementsInstancedANGLE(mode, reducedCount, type, ioffset, 1)
19881991
this._endAttrib0Hack()
19891992
}
19901993
}

0 commit comments

Comments
 (0)