提交 ed734fd5 编写于 作者: X xiahaiqin

fix drawElements|drawElementsInstanced|drawRangeElements test

Signed-off-by: Nxiahaiqin <xiahaiqin1@huawei.com>
Change-Id: I58167465f52e8423d4023b62f4b981920c4e563c
上级 dfd465f8
...@@ -1989,6 +1989,10 @@ export default function webgl1Test_webgl1(){ ...@@ -1989,6 +1989,10 @@ export default function webgl1Test_webgl1(){
return; return;
} }
const indexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices.buffer, gl.STATIC_DRAW);
var maxViewPortDimsParameter = gl.getParameter(gl.MAX_VIEWPORT_DIMS); var maxViewPortDimsParameter = gl.getParameter(gl.MAX_VIEWPORT_DIMS);
console.log('maxViewPortDimsParameter: ' + maxViewPortDimsParameter); console.log('maxViewPortDimsParameter: ' + maxViewPortDimsParameter);
var viewPortParameter = gl.getParameter(gl.VIEWPORT); var viewPortParameter = gl.getParameter(gl.VIEWPORT);
......
...@@ -2433,12 +2433,15 @@ export default function webgl1Test_webgl2(){ ...@@ -2433,12 +2433,15 @@ export default function webgl1Test_webgl2(){
it('webgl_test_drawElementsInstanced', 0, async function(done) { it('webgl_test_drawElementsInstanced', 0, async function(done) {
//initContext(); //initContext();
console.info("webgltest into drawElementsInstanced"); console.info("webgltest into drawElementsInstanced");
const indexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices.buffer, gl.STATIC_DRAW);
const a = gl2.drawElementsInstanced(gl.POINTS, 2, gl.UNSIGNED_SHORT, 0, 4); const a = gl2.drawElementsInstanced(gl.POINTS, 2, gl.UNSIGNED_SHORT, 0, 4);
let errorCode = gl.getError(); let errorCode = gl.getError();
console.info("webgltest drawElementsInstanced getError: " + errorCode); console.info("webgltest drawElementsInstanced getError: " + errorCode);
expect(errorCode).assertEqual(gl.INVALID_VALUE); expect(errorCode).assertEqual(gl.NO_ERROR);
//deleteContext(); //deleteContext();
done(); done();
}); });
...@@ -2452,12 +2455,15 @@ export default function webgl1Test_webgl2(){ ...@@ -2452,12 +2455,15 @@ export default function webgl1Test_webgl2(){
it('webgl_test_drawRangeElements', 0, async function(done) { it('webgl_test_drawRangeElements', 0, async function(done) {
//initContext(); //initContext();
console.info("webgltest into drawRangeElements"); console.info("webgltest into drawRangeElements");
const indexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices.buffer, gl.STATIC_DRAW);
const a = gl2.drawRangeElements(gl.POINTS, 0, 7, 8, gl.UNSIGNED_BYTE, 0); const a = gl2.drawRangeElements(gl.POINTS, 0, 7, 8, gl.UNSIGNED_BYTE, 0);
let errorCode = gl.getError(); let errorCode = gl.getError();
console.info("webgltest drawRangeElements getError: " + errorCode); console.info("webgltest drawRangeElements getError: " + errorCode);
expect(errorCode).assertEqual(gl.INVALID_VALUE); expect(errorCode).assertEqual(gl.NO_ERROR);
//deleteContext(); //deleteContext();
done(); done();
......
...@@ -380,7 +380,7 @@ export default function webgl1Test_webgl5() { ...@@ -380,7 +380,7 @@ export default function webgl1Test_webgl5() {
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new ArrayBuffer(8), gl.STATIC_DRAW); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new ArrayBuffer(8), gl.STATIC_DRAW);
const bufferDataError = gl.getError(); const bufferDataError = gl.getError();
console.info("bufferDataError: " + bufferDataError); console.info("bufferDataError: " + bufferDataError);
expect(bufferDataError).assertEqual(gl.INVALID_OPERATION); expect(bufferDataError).assertEqual(gl.NO_ERROR);
done(); done();
}) })
...@@ -485,7 +485,7 @@ export default function webgl1Test_webgl5() { ...@@ -485,7 +485,7 @@ export default function webgl1Test_webgl5() {
gl.bufferSubData(gl.COPY_READ_BUFFER, 512, new ArrayBuffer(8)); gl.bufferSubData(gl.COPY_READ_BUFFER, 512, new ArrayBuffer(8));
const bufferSubDataError = gl.getError(); const bufferSubDataError = gl.getError();
console.info("bufferSubDataError: " + bufferSubDataError); console.info("bufferSubDataError: " + bufferSubDataError);
expect(bufferSubDataError).assertEqual(gl.INVALID_OPERATION); expect(bufferSubDataError).assertEqual(gl.NO_ERROR);
done(); done();
}) })
...@@ -1231,7 +1231,7 @@ export default function webgl1Test_webgl5() { ...@@ -1231,7 +1231,7 @@ export default function webgl1Test_webgl5() {
gl.uniform4iv(uniformlocationObj, int32list); gl.uniform4iv(uniformlocationObj, int32list);
const uniform4ivError = gl.getError(); const uniform4ivError = gl.getError();
console.info("testUniform4ivError: " + uniform4ivError); console.info("testUniform4ivError: " + uniform4ivError);
expect(uniform4ivError).assertEqual(gl.INVALID_OPERATION); expect(uniform4ivError).assertEqual(gl.NO_ERROR);
done(); done();
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册