Skip to content

Commit

Permalink
opengl support for memory64
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippMuigg committed Jun 12, 2023
1 parent 7301dcd commit 4c3a66e
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 163 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -592,3 +592,4 @@ a license to everyone to use it as detailed in LICENSE.)
* Alexandra Cherdantseva <neluhus.vagus@gmail.com>
* Michael Schmuki <michael@schmuki.io>
* Skye Gibney <skyejgibney@gmail.com>
* Philipp Muigg <philipp.muigg@siemens.com> (copyright owned by Siemens)
9 changes: 5 additions & 4 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2854,10 +2854,11 @@ def get_full_import_name(name):

# check if we can address the 2GB mark and higher: either if we start at
# 2GB, or if we allow growth to either any amount or to 2GB or more.
if settings.INITIAL_MEMORY > 2 * 1024 * 1024 * 1024 or \
(settings.ALLOW_MEMORY_GROWTH and
(settings.MAXIMUM_MEMORY < 0 or
settings.MAXIMUM_MEMORY > 2 * 1024 * 1024 * 1024)):
if settings.MEMORY64 == 0 and \
(settings.INITIAL_MEMORY > 2 * 1024 * 1024 * 1024 or
(settings.ALLOW_MEMORY_GROWTH and
(settings.MAXIMUM_MEMORY < 0 or
settings.MAXIMUM_MEMORY > 2 * 1024 * 1024 * 1024))):
settings.CAN_ADDRESS_2GB = 1

settings.EMSCRIPTEN_VERSION = shared.EMSCRIPTEN_VERSION
Expand Down
4 changes: 4 additions & 0 deletions src/embind/embind.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,11 @@ var LibraryEmbind = {
} else {
throw new TypeError("Unknown boolean type size: " + name);
}
#if MEMORY64
return this['fromWireType'](heap[pointer / (1 << shift)]);
#else
return this['fromWireType'](heap[pointer >> shift]);
#endif
},
destructorFunction: null, // This type does not need a destructor
});
Expand Down
8 changes: 4 additions & 4 deletions src/library_html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,10 @@ var LibraryHTML5 = {
if (targetThread) {
var mouseEventData = _malloc( {{{ C_STRUCTS.EmscriptenMouseEvent.__size__ }}} ); // This allocated block is passed as satellite data to the proxied function call, so the call frees up the data block when done.
fillMouseEventData(mouseEventData, e, target);
JSEvents.queueEventHandlerOnThread_iiii(targetThread, callbackfunc, eventTypeId, mouseEventData, userData);
JSEvents.queueEventHandlerOnThread_iipp(targetThread, callbackfunc, eventTypeId, mouseEventData, userData);
} else
#endif
if ({{{ makeDynCall('iiii', 'callbackfunc') }}}(eventTypeId, JSEvents.mouseEvent, userData)) e.preventDefault();
if ({{{ makeDynCall('iipp', 'callbackfunc') }}}(eventTypeId, JSEvents.mouseEvent, userData)) e.preventDefault();
};

var eventHandler = {
Expand Down Expand Up @@ -635,7 +635,7 @@ var LibraryHTML5 = {
if (targetThread) JSEvents.queueEventHandlerOnThread_iiii(targetThread, callbackfunc, eventTypeId, wheelEvent, userData);
else
#endif
if ({{{ makeDynCall('iiii', 'callbackfunc') }}}(eventTypeId, wheelEvent, userData)) e.preventDefault();
if ({{{ makeDynCall('iipp', 'callbackfunc') }}}(eventTypeId, wheelEvent, userData)) e.preventDefault();
};
#if MIN_IE_VERSION <= 8 || MIN_SAFARI_VERSION < 60100 // Browsers that do not support https://caniuse.com/#feat=mdn-api_wheelevent
// The 'mousewheel' event as implemented in Safari 6.0.5
Expand All @@ -647,7 +647,7 @@ var LibraryHTML5 = {
{{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaY, 'wheelDeltaY', 'double') }}};
{{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaZ, '0 /* Not available */', 'double') }}};
{{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaMode, '0 /* DOM_DELTA_PIXEL */', 'i32') }}};
var shouldCancel = {{{ makeDynCall('iiii', 'callbackfunc') }}}( eventTypeId, JSEvents.wheelEvent, userData);
var shouldCancel = {{{ makeDynCall('iipp', 'callbackfunc') }}}( eventTypeId, JSEvents.wheelEvent, userData);
if (shouldCancel) {
e.preventDefault();
}
Expand Down
Loading

0 comments on commit 4c3a66e

Please sign in to comment.