|
Line 0
a/LayoutTests/fast/canvas/webgl/attrib-name-aliasing-bug.html_sec1
|
|
|
1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<title>WebGL attrib location length tests</title> |
| 6 |
<script src="../../../resources/js-test.js"></script> |
| 7 |
<script src="resources/webgl-test.js"> </script> |
| 8 |
<script src="resources/webgl-test-utils.js"> </script> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<canvas id="example" width="50" height="50"> |
| 12 |
There is supposed to be an example drawing here, but it's not important. |
| 13 |
</canvas> |
| 14 |
<div id="description">Verify limits on the lengths of attrib locations.</div> |
| 15 |
<div id="console"></div> |
| 16 |
<script id="vertexShader" type="x-shader/x-vertex"> |
| 17 |
// A vertex shader where the needed attrib location is long, but not over the limit. |
| 18 |
attribute vec4 attrib_name; |
| 19 |
attribute vec4 name; |
| 20 |
|
| 21 |
void main() |
| 22 |
{ |
| 23 |
gl_Position = attrib_name + name; |
| 24 |
} |
| 25 |
</script> |
| 26 |
<script id="fragmentShader" type="x-shader/x-fragment"> |
| 27 |
precision mediump float; |
| 28 |
|
| 29 |
void main() { |
| 30 |
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); |
| 31 |
} |
| 32 |
</script> |
| 33 |
<script> |
| 34 |
if (window.initNonKhronosFramework) { |
| 35 |
window.initNonKhronosFramework(false); |
| 36 |
} |
| 37 |
if (window.internals) |
| 38 |
window.internals.settings.setWebGLErrorsToConsoleEnabled(false); |
| 39 |
|
| 40 |
var wtu = WebGLTestUtils; |
| 41 |
var gl = wtu.create3DContext(document.getElementById("example")); |
| 42 |
|
| 43 |
debug("Test attrib names not incorrectly identified during renaming"); |
| 44 |
var program = wtu.loadProgramFromScript(gl, "vertexShader", "fragmentShader"); |
| 45 |
shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true'); |
| 46 |
var attribLoc = gl.getAttribLocation(program, "attrib_name"); |
| 47 |
var attribLoc2 = gl.getAttribLocation(program, "name"); |
| 48 |
if (attribLoc == -1) { |
| 49 |
testFailed("attrib location was -1, should not be"); |
| 50 |
} else { |
| 51 |
testPassed("attrib location should not be -1"); |
| 52 |
} |
| 53 |
if (attribLoc2 == -1) { |
| 54 |
testFailed("attrib 2 location was -1, should not be"); |
| 55 |
} else { |
| 56 |
testPassed("attrib 2 location should not be -1"); |
| 57 |
} |
| 58 |
wtu.glErrorShouldBe(gl, gl.NONE); |
| 59 |
|
| 60 |
|
| 61 |
</script> |
| 62 |
</body> |
| 63 |
</html> |