mirror of https://github.com/libsdl-org/SDL
[emscripten] Fixes for data addresses above 2gb
This includes both wasm64 and wasm32 when addressing more than 2gb of memory. Fixes: #9052
This commit is contained in:
parent
da19244f7f
commit
3deb07ea39
|
@ -269,7 +269,7 @@ typedef uint64_t Uint64;
|
|||
#define SDL_PRIs64 "I64d"
|
||||
#elif defined(PRIs64)
|
||||
#define SDL_PRIs64 PRIs64
|
||||
#elif defined(__LP64__) && !defined(__APPLE__)
|
||||
#elif defined(__LP64__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
|
||||
#define SDL_PRIs64 "ld"
|
||||
#else
|
||||
#define SDL_PRIs64 "lld"
|
||||
|
|
|
@ -39,6 +39,12 @@ static void FeedAudioDevice(_THIS, const void *buf, const int buflen)
|
|||
/* *INDENT-OFF* */ /* clang-format off */
|
||||
MAIN_THREAD_EM_ASM({
|
||||
var SDL2 = Module['SDL2'];
|
||||
/* Convert incoming buf pointer to a HEAPF32 offset. */
|
||||
#ifdef __wasm64__
|
||||
var buf = $0 / 4;
|
||||
#else
|
||||
var buf = $0 >>> 2;
|
||||
#endif
|
||||
var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels'];
|
||||
for (var c = 0; c < numChannels; ++c) {
|
||||
var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c);
|
||||
|
@ -47,7 +53,7 @@ static void FeedAudioDevice(_THIS, const void *buf, const int buflen)
|
|||
}
|
||||
|
||||
for (var j = 0; j < $1; ++j) {
|
||||
channelData[j] = HEAPF32[$0 + ((j*numChannels + c) << 2) >> 2]; /* !!! FIXME: why are these shifts here? */
|
||||
channelData[j] = HEAPF32[buf + (j*numChannels + c)];
|
||||
}
|
||||
}
|
||||
}, buf, buflen / framelen);
|
||||
|
|
|
@ -89,7 +89,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect
|
|||
SDL2.imageCtx = SDL2.ctx;
|
||||
}
|
||||
var data = SDL2.image.data;
|
||||
var src = pixels >> 2;
|
||||
var src = pixels / 4;
|
||||
var dst = 0;
|
||||
var num;
|
||||
if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) {
|
||||
|
|
|
@ -98,7 +98,7 @@ static SDL_Cursor *Emscripten_CreateCursor(SDL_Surface *surface, int hot_x, int
|
|||
|
||||
var image = ctx.createImageData(w, h);
|
||||
var data = image.data;
|
||||
var src = pixels >> 2;
|
||||
var src = pixels / 4;
|
||||
var dst = 0;
|
||||
var num;
|
||||
if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) {
|
||||
|
|
Loading…
Reference in New Issue