Skip to content

Commit

Permalink
Run test_subdata in webgl2 mode.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sbc100 committed Feb 22, 2024
1 parent b4f224e commit 5c2a5a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/library_webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,9 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
if (internalFormat == 0x84f9 /*GL_DEPTH_STENCIL*/) {
internalFormat = 0x88F0 /*GL_DEPTH24_STENCIL8*/;
}
if (internalFormat == 0x1908 /*GL_RGBA*/ && type == 0x1406 /*GL_FLOAT*/) {
internalFormat = 0x8814 /*GL_RGBA32F*/;
}
}
#endif
if ({{{ isCurrentContextWebGL2() }}}) {
Expand All @@ -1672,7 +1675,8 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, pixels);
} else if (pixels) {
var heap = heapObjectForWebGLType(type);
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, heap, toTypedArrayIndex(pixels, heap));
var index = toTypedArrayIndex(pixels, heap);
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, heap, index);
} else {
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, null);
}
Expand Down
10 changes: 8 additions & 2 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2323,8 +2323,14 @@ def test_float_tex(self):
self.btest('float_tex.c', reference='float_tex.png', args=['-lGL', '-lglut'])

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

@requires_graphics_hardware
def test_perspective(self):
Expand Down

0 comments on commit 5c2a5a2

Please sign in to comment.