Skip to content

Commit 58bbbe2

Browse files
committed
[Wasm64] Get test_anisotropic with MEMORY64
This required fixing some basic SDL and OpenGL operations.
1 parent b9131b0 commit 58bbbe2

File tree

8 files changed

+22
-21
lines changed

8 files changed

+22
-21
lines changed

src/library_glemu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,7 @@ var LibraryGLEmulation = {
417417
(GL.currentContext.compressionExt ? ' GL_ARB_texture_compression GL_EXT_texture_compression_s3tc' : '') +
418418
(GL.currentContext.anisotropicExt ? ' GL_EXT_texture_filter_anisotropic' : '')
419419
);
420-
GL.stringCache[name_] = ret;
421-
return ret;
420+
return GL.stringCache[name_] = {{{ to64('ret') }}};
422421
}
423422
return glGetString(name_);
424423
};
@@ -3674,6 +3673,7 @@ var LibraryGLEmulation = {
36743673
},
36753674

36763675
glLoadMatrixf: function(matrix) {
3676+
{{{ from64('matrix') }}}
36773677
#if GL_DEBUG
36783678
if (GL.debug) dbg('glLoadMatrixf receiving: ' + Array.prototype.slice.call(HEAPF32.subarray(matrix >> 2, (matrix >> 2) + 16)));
36793679
#endif

src/library_sdl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ var LibrarySDL = {
14611461

14621462
SDL_SetVideoMode__deps: ['$GL'],
14631463
SDL_SetVideoMode__proxy: 'sync',
1464-
SDL_SetVideoMode__sig: 'iiiii',
1464+
SDL_SetVideoMode__sig: 'piiii',
14651465
SDL_SetVideoMode: function(width, height, depth, flags) {
14661466
['touchstart', 'touchend', 'touchmove', 'mousedown', 'mouseup', 'mousemove', 'DOMMouseScroll', 'mousewheel', 'wheel', 'mouseout'].forEach(function(event) {
14671467
Module['canvas'].addEventListener(event, SDL.receiveEvent, true);

src/library_webgl.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,9 +1149,10 @@ var LibraryGL = {
11491149
GLctx.pixelStorei(pname, param);
11501150
},
11511151

1152-
glGetString__sig: 'ii',
1152+
glGetString__sig: 'pi',
11531153
glGetString__deps: ['$stringToNewUTF8'],
11541154
glGetString: function(name_) {
1155+
err('glGetString');
11551156
var ret = GL.stringCache[name_];
11561157
if (!ret) {
11571158
switch (name_) {
@@ -1400,25 +1401,25 @@ var LibraryGL = {
14001401
}
14011402
},
14021403

1403-
glGetIntegerv__sig: 'vii',
1404+
glGetIntegerv__sig: 'vip',
14041405
glGetIntegerv__deps: ['$emscriptenWebGLGet'],
14051406
glGetIntegerv: function(name_, p) {
14061407
emscriptenWebGLGet(name_, p, {{{ cDefine('EM_FUNC_SIG_PARAM_I') }}});
14071408
},
14081409

1409-
glGetFloatv__sig: 'vii',
1410+
glGetFloatv__sig: 'vip',
14101411
glGetFloatv__deps: ['$emscriptenWebGLGet'],
14111412
glGetFloatv: function(name_, p) {
14121413
emscriptenWebGLGet(name_, p, {{{ cDefine('EM_FUNC_SIG_PARAM_F') }}});
14131414
},
14141415

1415-
glGetBooleanv__sig: 'vii',
1416+
glGetBooleanv__sig: 'vip',
14161417
glGetBooleanv__deps: ['$emscriptenWebGLGet'],
14171418
glGetBooleanv: function(name_, p) {
14181419
emscriptenWebGLGet(name_, p, {{{ cDefine('EM_FUNC_SIG_PARAM_B') }}});
14191420
},
14201421

1421-
glDeleteTextures__sig: 'vii',
1422+
glDeleteTextures__sig: 'vip',
14221423
glDeleteTextures: function(n, textures) {
14231424
for (var i = 0; i < n; i++) {
14241425
var id = {{{ makeGetValue('textures', 'i*4', 'i32') }}};
@@ -1430,7 +1431,7 @@ var LibraryGL = {
14301431
}
14311432
},
14321433

1433-
glCompressedTexImage2D__sig: 'viiiiiiii',
1434+
glCompressedTexImage2D__sig: 'viiiiiiip',
14341435
glCompressedTexImage2D: function(target, level, internalFormat, width, height, border, imageSize, data) {
14351436
#if MAX_WEBGL_VERSION >= 2
14361437
if ({{{ isCurrentContextWebGL2() }}}) { // WebGL 2 provides new garbage-free entry points to call to WebGL. Use those always when possible.
@@ -1633,7 +1634,7 @@ var LibraryGL = {
16331634
GLctx.bindTexture(target, GL.textures[texture]);
16341635
},
16351636

1636-
glGetTexParameterfv__sig: 'viii',
1637+
glGetTexParameterfv__sig: 'viip',
16371638
glGetTexParameterfv: function(target, pname, params) {
16381639
if (!params) {
16391640
// GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense
@@ -1647,7 +1648,7 @@ var LibraryGL = {
16471648
{{{ makeSetValue('params', '0', 'GLctx.getTexParameter(target, pname)', 'float') }}};
16481649
},
16491650

1650-
glGetTexParameteriv__sig: 'viii',
1651+
glGetTexParameteriv__sig: 'viip',
16511652
glGetTexParameteriv: function(target, pname, params) {
16521653
if (!params) {
16531654
// GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense
@@ -1684,7 +1685,6 @@ var LibraryGL = {
16841685
// merge the functions together to only have one generated copy of this. 'createFunction' refers to the WebGL context function name to do
16851686
// the actual creation, 'objectTable' points to the GL object table where to populate the created objects, and 'functionName' carries
16861687
// the name of the caller for debug information.
1687-
_glGenObject__sig: 'vii',
16881688
_glGenObject: function(n, buffers, createFunction, objectTable
16891689
#if GL_ASSERTIONS
16901690
, functionName
@@ -1707,7 +1707,7 @@ var LibraryGL = {
17071707
},
17081708

17091709
glGenBuffers__deps: ['_glGenObject'],
1710-
glGenBuffers__sig: 'vii',
1710+
glGenBuffers__sig: 'vip',
17111711
glGenBuffers: function(n, buffers) {
17121712
__glGenObject(n, buffers, 'createBuffer', GL.buffers
17131713
#if GL_ASSERTIONS
@@ -1717,7 +1717,7 @@ var LibraryGL = {
17171717
},
17181718

17191719
glGenTextures__deps: ['_glGenObject'],
1720-
glGenTextures__sig: 'vii',
1720+
glGenTextures__sig: 'vip',
17211721
glGenTextures: function(n, textures) {
17221722
__glGenObject(n, textures, 'createTexture', GL.textures
17231723
#if GL_ASSERTIONS
@@ -1726,7 +1726,7 @@ var LibraryGL = {
17261726
);
17271727
},
17281728

1729-
glDeleteBuffers__sig: 'vii',
1729+
glDeleteBuffers__sig: 'vip',
17301730
glDeleteBuffers: function(n, buffers) {
17311731
for (var i = 0; i < n; i++) {
17321732
var id = {{{ makeGetValue('buffers', 'i*4', 'i32') }}};
@@ -3615,7 +3615,7 @@ var LibraryGL = {
36153615
GL.textures[texture], level);
36163616
},
36173617

3618-
glGetFramebufferAttachmentParameteriv__sig: 'viiii',
3618+
glGetFramebufferAttachmentParameteriv__sig: 'viiip',
36193619
glGetFramebufferAttachmentParameteriv: function(target, attachment, pname, params) {
36203620
var result = GLctx.getFramebufferAttachmentParameter(target, attachment, pname);
36213621
if (result instanceof WebGLRenderbuffer ||
@@ -4059,7 +4059,7 @@ var LibraryGL = {
40594059
return mem;
40604060
},
40614061

4062-
glGetBufferPointerv__sig: 'viii',
4062+
glGetBufferPointerv__sig: 'viip',
40634063
glGetBufferPointerv__deps: ['$emscriptenWebGLGetBufferBinding'],
40644064
glGetBufferPointerv: function(target, pname, params) {
40654065
if (pname == 0x88BD/*GL_BUFFER_MAP_POINTER*/) {

src/library_webgl2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
var LibraryWebGL2 = {
88
glGetStringi__deps: ['$stringToNewUTF8'],
9-
glGetStringi__sig: 'iii',
9+
glGetStringi__sig: 'pii',
1010
glGetStringi: function(name, index) {
1111
if (GL.currentContext.version < 2) {
1212
GL.recordError(0x502 /* GL_INVALID_OPERATION */); // Calling GLES3/WebGL2 function with a GLES2/WebGL1 context
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/test_browser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,9 +2256,10 @@ def test_s3tc_ffp_only(self):
22562256
self.btest('s3tc.c', reference='s3tc.png', args=['--preload-file', 'screenshot.dds', '-sLEGACY_GL_EMULATION', '-sGL_FFP_ONLY', '-lGL', '-lSDL'])
22572257

22582258
@requires_graphics_hardware
2259-
def test_aniso(self):
2260-
shutil.copyfile(test_file('water.dds'), 'water.dds')
2261-
self.btest('aniso.c', reference='aniso.png', reference_slack=2, args=['--preload-file', 'water.dds', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL', '-Wno-incompatible-pointer-types'])
2259+
@also_with_wasm64
2260+
def test_anisotropic(self):
2261+
shutil.copyfile(test_file('browser/water.dds'), 'water.dds')
2262+
self.btest('browser/test_anisotropic.c', reference='browser/test_anisotropic.png', reference_slack=2, args=['--preload-file', 'water.dds', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL', '-Wno-incompatible-pointer-types'])
22622263

22632264
@requires_graphics_hardware
22642265
def test_tex_nonbyte(self):

0 commit comments

Comments
 (0)