Skip to content

Commit 5c2a5a2

Browse files
committed
Run test_subdata in webgl2 mode.
This involved improving the emulation in glTexSubImage2D. Sadly I needed to disable this new tests in 4gb+ mode since it runs into a chromium bug.
1 parent b4f224e commit 5c2a5a2

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/library_webgl.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,6 +1663,9 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
16631663
if (internalFormat == 0x84f9 /*GL_DEPTH_STENCIL*/) {
16641664
internalFormat = 0x88F0 /*GL_DEPTH24_STENCIL8*/;
16651665
}
1666+
if (internalFormat == 0x1908 /*GL_RGBA*/ && type == 0x1406 /*GL_FLOAT*/) {
1667+
internalFormat = 0x8814 /*GL_RGBA32F*/;
1668+
}
16661669
}
16671670
#endif
16681671
if ({{{ isCurrentContextWebGL2() }}}) {
@@ -1672,7 +1675,8 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
16721675
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, pixels);
16731676
} else if (pixels) {
16741677
var heap = heapObjectForWebGLType(type);
1675-
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, heap, toTypedArrayIndex(pixels, heap));
1678+
var index = toTypedArrayIndex(pixels, heap);
1679+
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, heap, index);
16761680
} else {
16771681
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, null);
16781682
}

test/test_browser.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,8 +2323,14 @@ def test_float_tex(self):
23232323
self.btest('float_tex.c', reference='float_tex.png', args=['-lGL', '-lglut'])
23242324

23252325
@requires_graphics_hardware
2326-
def test_subdata(self):
2327-
self.btest('gl_subdata.c', reference='float_tex.png', args=['-lGL', '-lglut'])
2326+
@parameterized({
2327+
'': ([],),
2328+
'es2': (['-sMIN_WEBGL_VERSION=2', '-sFULL_ES2', '-sWEBGL2_BACKWARDS_COMPATIBILITY_EMULATION'],),
2329+
})
2330+
def test_subdata(self, args):
2331+
if self.is_4gb() and args:
2332+
self.skipTest('texSubImage2D fails: https://crbug.com/325090165')
2333+
self.btest('gl_subdata.c', reference='float_tex.png', args=['-lGL', '-lglut'] + args)
23282334

23292335
@requires_graphics_hardware
23302336
def test_perspective(self):

0 commit comments

Comments
 (0)