Skip to content

Commit

Permalink
Use C/C++ bool type to implement EM_BOOL
Browse files Browse the repository at this point in the history
This reduces the size of several structs and results in code size
savings in some cases.

This change is split of from a larger change I have planned to remove
the use of EM_BOOL completely: #22155.
  • Loading branch information
sbc100 committed Jun 27, 2024
1 parent b8c6e23 commit e695c61
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 197 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ See docs/process.md for more on how version tagging works.

3.1.62 (in development)
-----------------------
- The `EM_BOOL` type changed from `int/u32` to `bool/u8`. This changes the
layout and size of some structs in the emscripten API. (#22157)
- The `EMSCRIPTEN_FETCH_WAITABLE` flag along with the `emscripten_fetch_wait`
API were marked a deprecated. These feature have not functions for several
years now. (#22138)
Expand Down
146 changes: 73 additions & 73 deletions src/generated_struct_info32.json
Original file line number Diff line number Diff line change
Expand Up @@ -493,15 +493,15 @@
"nodeName": 0
},
"EmscriptenFullscreenChangeEvent": {
"__size__": 280,
"elementHeight": 268,
"elementWidth": 264,
"fullscreenEnabled": 4,
"id": 136,
"__size__": 276,
"elementHeight": 264,
"elementWidth": 260,
"fullscreenEnabled": 1,
"id": 130,
"isFullscreen": 0,
"nodeName": 8,
"screenHeight": 276,
"screenWidth": 272
"nodeName": 2,
"screenHeight": 272,
"screenWidth": 268
},
"EmscriptenFullscreenStrategy": {
"__size__": 24,
Expand All @@ -513,53 +513,53 @@
"scaleMode": 0
},
"EmscriptenGamepadEvent": {
"__size__": 1432,
"__size__": 1240,
"analogButton": 528,
"axis": 16,
"connected": 1296,
"connected": 1104,
"digitalButton": 1040,
"id": 1304,
"index": 1300,
"mapping": 1368,
"id": 1112,
"index": 1108,
"mapping": 1176,
"numAxes": 8,
"numButtons": 12,
"timestamp": 0
},
"EmscriptenKeyboardEvent": {
"__size__": 176,
"altKey": 20,
"charCode": 32,
"charValue": 108,
"code": 76,
"__size__": 160,
"altKey": 14,
"charCode": 20,
"charValue": 96,
"code": 64,
"ctrlKey": 12,
"key": 44,
"keyCode": 36,
"locale": 140,
"key": 32,
"keyCode": 24,
"locale": 128,
"location": 8,
"metaKey": 24,
"repeat": 28,
"shiftKey": 16,
"metaKey": 15,
"repeat": 16,
"shiftKey": 13,
"timestamp": 0,
"which": 40
"which": 28
},
"EmscriptenMouseEvent": {
"__size__": 72,
"altKey": 32,
"button": 40,
"buttons": 42,
"canvasX": 60,
"canvasY": 64,
"__size__": 64,
"altKey": 26,
"button": 28,
"buttons": 30,
"canvasX": 48,
"canvasY": 52,
"clientX": 16,
"clientY": 20,
"ctrlKey": 24,
"metaKey": 36,
"movementX": 44,
"movementY": 48,
"metaKey": 27,
"movementX": 32,
"movementY": 36,
"screenX": 8,
"screenY": 12,
"shiftKey": 28,
"targetX": 52,
"targetY": 56,
"shiftKey": 25,
"targetX": 40,
"targetY": 44,
"timestamp": 0
},
"EmscriptenOrientationChangeEvent": {
Expand All @@ -568,36 +568,36 @@
"orientationIndex": 0
},
"EmscriptenPointerlockChangeEvent": {
"__size__": 260,
"id": 132,
"__size__": 257,
"id": 129,
"isActive": 0,
"nodeName": 4
"nodeName": 1
},
"EmscriptenTouchEvent": {
"__size__": 1696,
"altKey": 20,
"__size__": 1552,
"altKey": 14,
"ctrlKey": 12,
"metaKey": 24,
"metaKey": 15,
"numTouches": 8,
"shiftKey": 16,
"shiftKey": 13,
"timestamp": 0,
"touches": 28
"touches": 16
},
"EmscriptenTouchPoint": {
"__size__": 52,
"canvasX": 44,
"canvasY": 48,
"__size__": 48,
"canvasX": 40,
"canvasY": 44,
"clientX": 12,
"clientY": 16,
"identifier": 0,
"isChanged": 28,
"onTarget": 32,
"onTarget": 29,
"pageX": 20,
"pageY": 24,
"screenX": 4,
"screenY": 8,
"targetX": 36,
"targetY": 40
"targetX": 32,
"targetY": 36
},
"EmscriptenUiEvent": {
"__size__": 36,
Expand All @@ -617,26 +617,26 @@
"visibilityState": 4
},
"EmscriptenWebGLContextAttributes": {
"__size__": 56,
"__size__": 36,
"alpha": 0,
"antialias": 12,
"depth": 4,
"enableExtensionsByDefault": 40,
"explicitSwapControl": 44,
"failIfMajorPerformanceCaveat": 28,
"majorVersion": 32,
"minorVersion": 36,
"powerPreference": 24,
"premultipliedAlpha": 16,
"preserveDrawingBuffer": 20,
"proxyContextToMainThread": 48,
"renderViaOffscreenBackBuffer": 52,
"stencil": 8
"antialias": 3,
"depth": 1,
"enableExtensionsByDefault": 24,
"explicitSwapControl": 25,
"failIfMajorPerformanceCaveat": 12,
"majorVersion": 16,
"minorVersion": 20,
"powerPreference": 8,
"premultipliedAlpha": 4,
"preserveDrawingBuffer": 5,
"proxyContextToMainThread": 28,
"renderViaOffscreenBackBuffer": 32,
"stencil": 2
},
"EmscriptenWebSocketCloseEvent": {
"__size__": 524,
"code": 8,
"reason": 10,
"__size__": 520,
"code": 6,
"reason": 8,
"wasClean": 4
},
"EmscriptenWebSocketCreateAttributes": {
Expand All @@ -650,11 +650,11 @@
"numBytes": 8
},
"EmscriptenWheelEvent": {
"__size__": 104,
"deltaMode": 96,
"deltaX": 72,
"deltaY": 80,
"deltaZ": 88,
"__size__": 96,
"deltaMode": 88,
"deltaX": 64,
"deltaY": 72,
"deltaZ": 80,
"mouse": 0
},
"SDL_AudioSpec": {
Expand Down
Loading

0 comments on commit e695c61

Please sign in to comment.