forked from KhronosGroup/WebGL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test that vertex attribute is preserved across context switches (Khro…
…nosGroup#2843) See http://crbug.com/920033 for rationale for this test.
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
sdk/tests/conformance/attribs/gl-vertex-attrib-context-switch.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<!-- | ||
/* | ||
** Copyright (c) 2019 The Khronos Group Inc. | ||
** | ||
** Permission is hereby granted, free of charge, to any person obtaining a | ||
** copy of this software and/or associated documentation files (the | ||
** "Materials"), to deal in the Materials without restriction, including | ||
** without limitation the rights to use, copy, modify, merge, publish, | ||
** distribute, sublicense, and/or sell copies of the Materials, and to | ||
** permit persons to whom the Materials are furnished to do so, subject to | ||
** the following conditions: | ||
** | ||
** The above copyright notice and this permission notice shall be included | ||
** in all copies or substantial portions of the Materials. | ||
** | ||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. | ||
*/ | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>WebGL Vertex Attrib Context Switch Test</title> | ||
<link rel="stylesheet" href="../../resources/js-test-style.css"/> | ||
<script src="../../js/js-test-pre.js"></script> | ||
<script src="../../js/webgl-test-utils.js"> </script> | ||
</head> | ||
<body> | ||
<canvas id="one" width="50" height="50"> | ||
</canvas> | ||
<canvas id="two" width="50" height="50"> | ||
</canvas> | ||
<div id="description"></div> | ||
<div id="console"></div> | ||
<script> | ||
"use strict"; | ||
description("tests that vertex attrib value is preserved across context switches"); | ||
var wtu = WebGLTestUtils; | ||
var positionLocation = 0; | ||
var colorLocation = 1; | ||
var gridRes = 1; | ||
|
||
var canvas1 = document.getElementById("one"); | ||
var gl1 = wtu.create3DContext(canvas1); | ||
var program1 = wtu.setupSimpleVertexColorProgram(gl1, positionLocation, colorLocation); | ||
gl1.vertexAttrib4f(colorLocation, 0.0, 1.0, 0.0, 1.0); | ||
wtu.setupIndexedQuad(gl1, gridRes, positionLocation); | ||
wtu.clearAndDrawIndexedQuad(gl1, gridRes); | ||
wtu.checkCanvas(gl1, [0, 255, 0, 255], "should be green 1"); | ||
|
||
var canvas2 = document.getElementById("two"); | ||
var gl2 = wtu.create3DContext(canvas2); | ||
var program2 = wtu.setupSimpleVertexColorProgram(gl2, positionLocation, colorLocation); | ||
wtu.setupIndexedQuad(gl2, gridRes, positionLocation); | ||
wtu.clearAndDrawIndexedQuad(gl2, gridRes); | ||
wtu.checkCanvas(gl2, [0, 0, 0, 255], "should be black 1"); | ||
|
||
wtu.checkCanvas(gl1, [0, 255, 0, 255], "should be green 2"); | ||
|
||
wtu.clearAndDrawIndexedQuad(gl2, gridRes); | ||
wtu.checkCanvas(gl2, [0, 0, 0, 255], "should be black 2"); | ||
|
||
wtu.clearAndDrawIndexedQuad(gl1, gridRes); | ||
wtu.checkCanvas(gl1, [0, 255, 0, 255], "should be green 3"); | ||
|
||
var successfullyParsed = true; | ||
</script> | ||
<script src="../../js/js-test-post.js"></script> | ||
|
||
</body> | ||
</html> | ||
|