<!--Copyright (c) 2024 The Khronos Group Inc.Use of this source code is governed by an MIT-style license that can befound in the LICENSE.txt file.--><!DOCTYPE html><html><head><metacharset="utf-8"><title>getBufferSubData test to Wasm Memory 4GB in size.</title><linkrel="stylesheet"href="../../resources/js-test-style.css"/><scriptsrc="../../js/js-test-pre.js"></script><scriptsrc="../../js/webgl-test-utils.js"></script></head><body><canvasid="canvas"width="2"height="2"style="width: 40px; height: 40px;"></canvas><divid="description"></div><divid="console"></div><script>"use strict";description(document.title);debug("Tests that getBufferSubData can be called on WebAssembly Memory of 4GB in size.");debug("");letwtu=WebGLTestUtils;letgl=wtu.create3DContext("canvas",undefined,2);constPAGE=65536;constSIZE=4*1024*1024*1024-PAGE;letview=newUint8Array(newWebAssembly.Memory({initial:SIZE/PAGE}).buffer);letexpectedData=newUint8Array([1,2,3,4]);letbuf=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,buf);gl.bufferData(gl.ARRAY_BUFFER,expectedData,gl.STATIC_DRAW);constlength=expectedData.length;constoffset=SIZE-length;gl.getBufferSubData(gl.ARRAY_BUFFER,0,view,offset,length);wtu.glErrorShouldBe(gl,gl.NO_ERROR);for(leti=0;i<length;i++){shouldBe(`view[${i+offset}]`,`expectedData[${i}]`);}varsuccessfullyParsed=true;</script><scriptsrc="../../js/js-test-post.js"></script></body></html>