@@ -96,6 +96,9 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
96
96
$webgl_enable_ANGLE_instanced_arrays: ( ctx ) => {
97
97
// Extension available in WebGL 1 from Firefox 26 and Google Chrome 30 onwards. Core feature in WebGL 2.
98
98
var ext = ctx . getExtension ( 'ANGLE_instanced_arrays' ) ;
99
+ // Because this extension is a core function in WebGL 2, assign the extension entry points in place of
100
+ // where the core functions will reside in WebGL 2. This way the calling code can call these without
101
+ // having to dynamically branch depending if running against WebGL 1 or WebGL 2.
99
102
if ( ext ) {
100
103
ctx [ 'vertexAttribDivisor' ] = ( index , divisor ) => ext [ 'vertexAttribDivisorANGLE' ] ( index , divisor ) ;
101
104
ctx [ 'drawArraysInstanced' ] = ( mode , first , count , primcount ) => ext [ 'drawArraysInstancedANGLE' ] ( mode , first , count , primcount ) ;
@@ -143,6 +146,27 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
143
146
emscripten_webgl_enable_WEBGL_multi_draw__deps : [ '$webgl_enable_WEBGL_multi_draw' ] ,
144
147
emscripten_webgl_enable_WEBGL_multi_draw : ( ctx ) => webgl_enable_WEBGL_multi_draw ( GL . contexts [ ctx ] . GLctx ) ,
145
148
149
+ $webgl_enable_EXT_polygon_offset_clamp : ( ctx ) => {
150
+ return ! ! ( ctx . extPolygonOffsetClamp = ctx . getExtension ( 'EXT_polygon_offset_clamp' ) ) ;
151
+ } ,
152
+
153
+ emscripten_webgl_enable_EXT_polygon_offset_clamp__deps : [ '$webgl_enable_EXT_polygon_offset_clamp' ] ,
154
+ emscripten_webgl_enable_EXT_polygon_offset_clamp : ( ctx ) => webgl_enable_EXT_polygon_offset_clamp ( GL . contexts [ ctx ] . GLctx ) ,
155
+
156
+ $webgl_enable_EXT_clip_control : ( ctx ) => {
157
+ return ! ! ( ctx . extClipControl = ctx . getExtension ( 'EXT_clip_control' ) ) ;
158
+ } ,
159
+
160
+ emscripten_webgl_enable_EXT_clip_control__deps : [ '$webgl_enable_EXT_clip_control' ] ,
161
+ emscripten_webgl_enable_EXT_clip_control : ( ctx ) => webgl_enable_EXT_clip_control ( GL . contexts [ ctx ] . GLctx ) ,
162
+
163
+ $webgl_enable_WEBGL_polygon_mode : ( ctx ) => {
164
+ return ! ! ( ctx . webglPolygonMode = ctx . getExtension ( 'WEBGL_polygon_mode' ) ) ;
165
+ } ,
166
+
167
+ emscripten_webgl_enable_WEBGL_polygon_mode__deps : [ '$webgl_enable_WEBGL_polygon_mode' ] ,
168
+ emscripten_webgl_enable_WEBGL_polygon_mode : ( ctx ) => webgl_enable_WEBGL_polygon_mode ( GL . contexts [ ctx ] . GLctx ) ,
169
+
146
170
$getEmscriptenSupportedExtensions__internal : true ,
147
171
$getEmscriptenSupportedExtensions : ( ctx ) => {
148
172
// Restrict the list of advertised extensions to those that we actually
@@ -177,9 +201,11 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
177
201
'WEBGL_clip_cull_distance' ,
178
202
#endif
179
203
// WebGL 1 and WebGL 2 extensions
204
+ 'EXT_clip_control' ,
180
205
'EXT_color_buffer_half_float' ,
181
206
'EXT_depth_clamp' ,
182
207
'EXT_float_blend' ,
208
+ 'EXT_polygon_offset_clamp' ,
183
209
'EXT_texture_compression_bptc' ,
184
210
'EXT_texture_compression_rgtc' ,
185
211
'EXT_texture_filter_anisotropic' ,
@@ -195,6 +221,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
195
221
'WEBGL_debug_shaders' ,
196
222
'WEBGL_lose_context' ,
197
223
'WEBGL_multi_draw' ,
224
+ 'WEBGL_polygon_mode'
198
225
] ;
199
226
// .getSupportedExtensions() can return null if context is lost, so coerce to empty array.
200
227
return ( ctx . getSupportedExtensions ( ) || [ ] ) . filter ( ext => supportedExtensions . includes ( ext ) ) ;
@@ -219,6 +246,9 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
219
246
'$webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance' ,
220
247
'$webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance' ,
221
248
#endif
249
+ '$webgl_enable_EXT_polygon_offset_clamp' ,
250
+ '$webgl_enable_EXT_clip_control' ,
251
+ '$webgl_enable_WEBGL_polygon_mode' ,
222
252
'$webgl_enable_WEBGL_multi_draw' ,
223
253
'$getEmscriptenSupportedExtensions' ,
224
254
#endif // GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS
@@ -802,6 +832,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
802
832
}
803
833
disableHalfFloatExtensionIfBroken ( ctx ) ;
804
834
#endif
835
+
805
836
return handle ;
806
837
} ,
807
838
@@ -1184,6 +1215,11 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
1184
1215
context . anisotropicExt = GLctx . getExtension ( 'EXT_texture_filter_anisotropic' ) ;
1185
1216
#endif
1186
1217
1218
+ // Extensions that are available in both WebGL 1 and WebGL 2
1219
+ webgl_enable_WEBGL_multi_draw ( GLctx ) ;
1220
+ webgl_enable_EXT_polygon_offset_clamp ( GLctx ) ;
1221
+ webgl_enable_EXT_clip_control ( GLctx ) ;
1222
+ webgl_enable_WEBGL_polygon_mode ( GLctx ) ;
1187
1223
#if MIN_WEBGL_VERSION == 1
1188
1224
// Extensions that are only available in WebGL 1 (the calls will be no-ops
1189
1225
// if called on a WebGL 2 context active)
@@ -1195,9 +1231,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
1195
1231
// Extensions that are available from WebGL >= 2 (no-op if called on a WebGL 1 context active)
1196
1232
webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance ( GLctx ) ;
1197
1233
webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance ( GLctx ) ;
1198
- #endif
1199
1234
1200
- #if MAX_WEBGL_VERSION >= 2
1201
1235
// On WebGL 2, EXT_disjoint_timer_query is replaced with an alternative
1202
1236
// that's based on core APIs, and exposes only the queryCounterEXT()
1203
1237
// entrypoint.
@@ -1214,8 +1248,6 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
1214
1248
GLctx . disjointTimerQueryExt = GLctx . getExtension ( "EXT_disjoint_timer_query" ) ;
1215
1249
}
1216
1250
1217
- webgl_enable_WEBGL_multi_draw ( GLctx ) ;
1218
-
1219
1251
getEmscriptenSupportedExtensions ( GLctx ) . forEach ( ( ext ) => {
1220
1252
// WEBGL_lose_context, WEBGL_debug_renderer_info and WEBGL_debug_shaders
1221
1253
// are not enabled by default.
@@ -4214,6 +4246,30 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
4214
4246
return 1 ;
4215
4247
} ,
4216
4248
#endif
4249
+
4250
+ glPolygonOffsetClampEXT__sig : 'vfff' ,
4251
+ glPolygonOffsetClampEXT : ( factor , units , clamp ) = > {
4252
+ #if GL_ASSERTIONS
4253
+ assert ( GLctx . extPolygonOffsetClamp , "EXT_polygon_offset_clamp not supported, or not enabled. Before calling glPolygonOffsetClampEXT(), call emscripten_webgl_enable_EXT_polygon_offset_clamp() to enable this extension, and verify that it returns true to indicate support. (alternatively, build with -sGL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=1 to enable all GL extensions by default)" ) ;
4254
+ #endif
4255
+ GLctx . extPolygonOffsetClamp [ 'polygonOffsetClampEXT' ] ( factor , units , clamp ) ;
4256
+ } ,
4257
+
4258
+ glClipControlEXT__sig : 'vii ',
4259
+ glClipControlEXT : ( origin , depth ) = > {
4260
+ #if GL_ASSERTIONS
4261
+ assert ( GLctx . extClipControl , "EXT_clip_control not supported, or not enabled. Before calling glClipControlEXT(), call emscripten_webgl_enable_EXT_clip_control() to enable this extension, and verify that it returns true to indicate support. (alternatively, build with -sGL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=1 to enable all GL extensions by default)" ) ;
4262
+ #endif
4263
+ GLctx . extClipControl [ 'clipControlEXT' ] ( origin , depth ) ;
4264
+ } ,
4265
+
4266
+ glPolygonModeWEBGL__sig : 'vii ',
4267
+ glPolygonModeWEBGL : ( face , mode ) = > {
4268
+ #if GL_ASSERTIONS
4269
+ assert ( GLctx . webglPolygonMode , "WEBGL_polygon_mode not supported, or not enabled. Before calling glPolygonModeWEBGL(), call emscripten_webgl_enable_WEBGL_polygon_mode() to enable this extension, and verify that it returns true to indicate support. (alternatively, build with -sGL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=1 to enable all GL extensions by default)" ) ;
4270
+ #endif
4271
+ GLctx . webglPolygonMode [ 'polygonModeWEBGL' ] ( face , mode ) ;
4272
+ } ,
4217
4273
} ;
4218
4274
4219
4275
#if ! GL_ENABLE_GET_PROC_ADDRESS
0 commit comments