<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>

<script>
description("Verifies that the array conversion code for WebGLRenderingContext.uniform* does not crash.");

array = [ ];
for (var i = 0; i < 1 << 15; ++i)
    array[i] = 0x0c0c0c0c;
array.length = 0x80000000;

context = create3DContext();
intProgram = loadProgram(context, "resources/intArrayUniformShader2.vert", "resources/noopUniformShader.frag");
floatProgram = loadProgram(context, "resources/floatArrayUniformShader.vert", "resources/noopUniformShader.frag");
intLocation = context.getUniformLocation(intProgram, "u_ints");
floatLocation = context.getUniformLocation(floatProgram, "u_floats");

context.useProgram(intProgram);
try {
    context.uniform4iv(intLocation, array);
} catch (e) { }

context.useProgram(floatProgram);
try {
    context.uniform4fv(floatLocation, array);
} catch (e) { }
</script>
</body>
</html>
