You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ifnotoptions.ignore_dynamic_linking: logging.warning('ignoring dynamic library %s because not compiling to JS or HTML, remember to link it when compiling to JS or HTML at the end', os.path.basename(input_file))
logging.debug("running: "+' '.join(shared.Building.doublequote_spaces(args))) # NOTE: Printing this line here in this specific format is important, it is parsed to implement the "emcc --cflags" command
1295
1294
execute(args) # let compiler frontend print directly, so colors are saved (PIPE kills that)
1296
1295
ifnotos.path.exists(output_file):
1297
1296
logging.error('compiler frontend failed to generate LLVM bitcode, halting')
@@ -1663,7 +1662,6 @@ def repl(m):
1663
1662
)
1664
1663
withToolchainProfiler.profile_block('js opts'):
1665
1664
# It is useful to run several js optimizer passes together, to save on unneeded unparsing/reparsing
logging.error('Unrecognized BINARYEN_METHOD "'+m.strip() +'" specified! Please pass a comma-delimited list containing one or more of: '+','.join(valid_methods))
Copy file name to clipboardExpand all lines: site/source/docs/porting/multimedia_and_graphics/OpenGL-support.rst
+13-7
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,8 @@ OpenGL support in Emscripten
6
6
7
7
Emscripten provides three OpenGL modes:
8
8
9
-
- :ref:`opengl-support-webgl-subset` (default) — supports the set of OpenGL ES commands that map directly to WebGL.
10
-
- :ref:`opengl-support-opengl-es2-0-emulation` — support for some emulated OpenGL ES 2.0 features that are not present in WebGL.
9
+
- :ref:`opengl-support-webgl-subset` (default) — supports the set of OpenGL ES 2.0/3.0 commands that map directly to WebGL 1/2.
10
+
- :ref:`opengl-support-opengl-es2-0-emulation` — support for some emulated OpenGL ES 2.0/3.0 features that are not present in WebGL.
11
11
- :ref:`opengl-support-legacy_and_mobile` — support for a number of legacy GL 1.x features and commands.
12
12
13
13
This topic provides information about the modes, and how they are enabled.
@@ -16,21 +16,23 @@ This topic provides information about the modes, and how they are enabled.
16
16
17
17
.. _opengl-support-webgl-subset:
18
18
19
-
WebGL-friendly subset of OpenGL ES
20
-
==================================
19
+
WebGL-friendly subset of OpenGL ES 2.0/3.0
20
+
==========================================
21
21
22
22
By default, Emscripten targets the WebGL-friendly subset of OpenGL ES 2.0. This is the set of GL ES commands that map directly to WebGL, so that each GL command has a roughly direct mapping to WebGL. It includes almost all of OpenGL ES 2.0, with the notable exception of client-side arrays, and some other features that are listed in `WebGL 1.0 Specification/Chapter 6 <https://www.khronos.org/registry/webgl/specs/1.0/#6>`_.
23
23
24
24
To program against the WebGL subset of OpenGL ES, one uses the GL ES 2.0 header files and the GL ES 2.0 API, while adhering to the limitations specified in Chapter 6 of the WebGL specification.
25
25
26
26
This mode is used by default because it best matches the WebGL features brovided by browsers.
27
27
28
+
To target WebGL 2, pass the linker flag ``-s USE_WEBGL2=1``. Specifying this flag enables (and defaults to, unless otherwise specified at context creation time) the creation of WebGL 2 contexts at runtime, but it is still possible to create WebGL 1 contexts, so applications can choose whether to require WebGL 2 or whether to support a fallback to WebGL 1.
29
+
28
30
.. _opengl-support-opengl-es2-0-emulation:
29
31
30
-
OpenGL ES 2.0 emulation
31
-
=======================
32
+
OpenGL ES 2.0/3.0 emulation
33
+
===========================
32
34
33
-
This build mode emulates some features of OpenGL ES 2.0 that are not part of the core WebGL 1 specification.
35
+
This build mode emulates some features of OpenGL ES 2.0/3.0 that are not part of the core WebGL 1 specification.
34
36
35
37
In particular, this mode emulates client-side arrays that are missing [#f1]_ from the :ref:`opengl-support-webgl-subset`.
36
38
@@ -40,6 +42,8 @@ This allows you to use functions `glDrawArrays <https://www.opengl.org/sdk/docs/
40
42
41
43
To enable *OpenGL ES 2.0 emulation*, specify the :ref:`emcc <emcc-s-option-value>` option ``-s FULL_ES2=1`` when linking the final executable (.js/.html) of the project.
42
44
45
+
To enable *OpenGL ES 3.0 emulation*, specify the :ref:`emcc <emcc-s-option-value>` option ``-s FULL_ES3=1`` when linking the final executable (.js/.html) of the project. This adds emulation for mapping memory blocks to client side memory. The flags ``-s FULL_ES2=1`` and ``-s FULL_ES3=1`` are orthogonal, so either one or both can be specified to emulate different features.
46
+
43
47
.. _opengl-support-legacy_and_mobile:
44
48
45
49
Emulation of older Desktop OpenGL API features
@@ -72,6 +76,8 @@ When porting code, it should be noted that desktop OpenGL, OpenGL ES and WebGL e
72
76
73
77
Additionally, in WebGL, unlike in desktop or mobile OpenGL, extensions must be activated first before the features they expose take effect. If you use one of the native APIs SDL, EGL, GLUT or GLFW to create your GL context, this will be done automatically for most extensions. If instead you use the HTML5 WebGL context creation API, you must explicitly choose whether to autoenable WebGL extensions. If an extension was not automatically enabled at context creation time, the HTML5 API function `emscripten_webgl_enable_extension` can be used to activate it. Debugging related extensions, draft extensions and vendor-prefixed extensions (MOZ_*, WEBKIT_*) are never enabled automatically at context creation time, but must always be activated manually.
74
78
79
+
When migrating from WebGL 1 to WebGL 2, take note that some WebGL 1 extensions are migrated to core WebGL 2, and therefore their functionality is no longer advertised as GL extensions. This does not mean that the features would be missing, but that it is possible to utilize these features in WebGL 2 without needing to feature test the presence of a GL extension first.
Copy file name to clipboardExpand all lines: src/embind/embind.js
+3-1
Original file line number
Diff line number
Diff line change
@@ -536,6 +536,8 @@ var LibraryEmbind = {
536
536
};
537
537
}
538
538
539
+
varisUnsignedType=(name.indexOf('unsigned')!=-1);
540
+
539
541
registerType(primitiveType,{
540
542
name: name,
541
543
'fromWireType': fromWireType,
@@ -548,7 +550,7 @@ var LibraryEmbind = {
548
550
if(value<minRange||value>maxRange){
549
551
thrownewTypeError('Passing a number "'+_embind_repr(value)+'" from JS side to C/C++ side to an argument of type "'+name+'", which is outside the valid range ['+minRange+', '+maxRange+']!');
throw"failed to load wasm binary file at '"+wasmBinaryFile+"'";
2235
2237
}
@@ -2404,12 +2406,16 @@ function integrateWasmJS(Module) {
2404
2406
Module['asmPreload']=Module['asm'];
2405
2407
2406
2408
// Memory growth integration code
2407
-
Module['reallocBuffer']=function(size){
2409
+
2410
+
varasmjsReallocBuffer=Module['reallocBuffer'];
2411
+
2412
+
varwasmReallocBuffer=function(size){
2408
2413
varPAGE_MULTIPLE=Module["usingWasm"] ? WASM_PAGE_SIZE : ASMJS_PAGE_SIZE;// In wasm, heap size must be a multiple of 64KB. In asm.js, they need to be multiples of 16MB.
2409
2414
size=alignUp(size,PAGE_MULTIPLE);// round up to wasm page size
2410
2415
varold=Module['buffer'];
2411
2416
varoldSize=old.byteLength;
2412
2417
if(Module["usingWasm"]){
2418
+
// native wasm support
2413
2419
try{
2414
2420
varresult=Module['wasmMemory'].grow((size-oldSize)/wasmPageSize);// .grow() takes a delta compared to the previous size
2415
2421
if(result!==(-1|0)){
@@ -2425,12 +2431,24 @@ function integrateWasmJS(Module) {
2425
2431
returnnull;
2426
2432
}
2427
2433
}else{
2434
+
// wasm interpreter support
2428
2435
exports['__growWasmMemory']((size-oldSize)/wasmPageSize);// tiny wasm method that just does grow_memory
2429
2436
// in interpreter, we replace Module.buffer if we allocate
2430
2437
returnModule['buffer']!==old ? Module['buffer'] : null;// if it was reallocated, it changed
2431
2438
}
2432
2439
};
2433
2440
2441
+
Module['reallocBuffer']=function(size){
2442
+
if(finalMethod==='asmjs'){
2443
+
returnasmjsReallocBuffer(size);
2444
+
}else{
2445
+
returnwasmReallocBuffer(size);
2446
+
}
2447
+
};
2448
+
2449
+
// we may try more than one; this is the final one, that worked and we are using
2450
+
varfinalMethod='';
2451
+
2434
2452
// Provide an "asm.js function" for the application, called to "link" the asm.js module. We instantiate
2435
2453
// the wasm module at that time, and it receives imports and provides exports and so forth, the app
2436
2454
// doesn't need to care that it is wasm or olyfilled wasm or asm.js.
@@ -2475,6 +2493,8 @@ function integrateWasmJS(Module) {
0 commit comments