@@ -88,41 +88,53 @@ var WebGlPlugins =
88
88
89
89
_GetTotalMemorySize : function ( )
90
90
{
91
- if ( typeof TOTAL_MEMORY !== 'undefined' ) {
91
+ if ( typeof HEAP8 !== 'undefined' ) {
92
+ return HEAP8 . length ;
93
+ }
94
+ if ( typeof TOTAL_MEMORY !== 'undefined' ) { // Legacy support
92
95
return TOTAL_MEMORY ;
93
96
}
94
97
95
- console . warn ( "Problem with retrieving unity value. TOTAL_MEMORY: " + typeof TOTAL_MEMORY ) ;
98
+ console . warn ( "Problem with retrieving total memory size" ) ;
96
99
return - 1 ;
97
100
} ,
98
101
99
102
_GetTotalStackSize : function ( )
100
103
{
101
- if ( typeof TOTAL_STACK !== 'undefined' ) {
104
+ if ( typeof Module !== 'undefined' && typeof Module . STACK_SIZE !== 'undefined' ) {
105
+ return Module . STACK_SIZE ;
106
+ }
107
+ if ( typeof TOTAL_STACK !== 'undefined' ) { // Legacy support
102
108
return TOTAL_STACK ;
103
109
}
104
110
105
- console . warn ( "Problem with retrieving unity value. TOTAL_STACK: " + typeof TOTAL_STACK ) ;
111
+ console . warn ( "Problem with retrieving stack size" ) ;
106
112
return - 1 ;
107
113
} ,
108
114
109
115
_GetStaticMemorySize : function ( )
110
116
{
111
- if ( typeof STATICTOP !== 'undefined' && typeof STATIC_BASE !== 'undefined' ) {
117
+ if ( typeof Module !== 'undefined' && typeof Module . staticAlloc !== 'undefined' ) {
118
+ return Module . staticAlloc ;
119
+ }
120
+ if ( typeof STATICTOP !== 'undefined' && typeof STATIC_BASE !== 'undefined' ) { // Legacy support
112
121
return STATICTOP - STATIC_BASE ;
113
122
}
114
123
115
- console . warn ( "Problem with retrieving unity value. STATICTOP: " + typeof STATICTOP + ", STATIC_BASE: " + typeof STATIC_BASE ) ;
124
+ console . warn ( "Problem with retrieving static memory size" ) ;
116
125
return - 1 ;
117
126
} ,
118
127
119
128
_GetDynamicMemorySize : function ( )
120
129
{
121
- if ( typeof HEAP32 !== 'undefined' && typeof DYNAMICTOP_PTR !== 'undefined' && typeof DYNAMIC_BASE !== 'undefined' ) {
130
+ if ( typeof Module !== 'undefined' && typeof Module . dynamicAlloc !== 'undefined' ) {
131
+ return Module . dynamicAlloc ;
132
+ }
133
+ if ( typeof HEAP32 !== 'undefined' && typeof DYNAMICTOP_PTR !== 'undefined' && typeof DYNAMIC_BASE !== 'undefined' ) { // Legacy support
122
134
return HEAP32 [ DYNAMICTOP_PTR >> 2 ] - DYNAMIC_BASE ;
123
135
}
124
136
125
- console . warn ( "Problem with retrieving unity value. HEAP32: " + typeof HEAP32 + ", DYNAMICTOP_PTR: " + typeof DYNAMICTOP_PTR + ", DYNAMIC_BASE: " + typeof DYNAMIC_BASE ) ;
137
+ console . warn ( "Problem with retrieving dynamic memory size" ) ;
126
138
return - 1 ;
127
139
}
128
140
} ;
0 commit comments