diff options
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/conformance/textures')
122 files changed, 11259 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/00_test_list.txt new file mode 100644 index 000000000..8af9a1384 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/00_test_list.txt @@ -0,0 +1,14 @@ +misc/00_test_list.txt +canvas/00_test_list.txt +--min-version 1.0.4 canvas_sub_rectangle/00_test_list.txt +image/00_test_list.txt +image_data/00_test_list.txt +--min-version 1.0.4 svg_image/00_test_list.txt +video/00_test_list.txt +webgl_canvas/00_test_list.txt +// image_bitmap_from_image_data/00_test_list.txt +// image_bitmap_from_image/00_test_list.txt +// image_bitmap_from_video/00_test_list.txt +// image_bitmap_from_canvas/00_test_list.txt +// image_bitmap_from_blob/00_test_list.txt +// image_bitmap_from_image_bitmap/00_test_list.txt diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..73ff34d33 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..3e2d1935a --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..7165150e8 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..38b4ec8fe --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..09819c299 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..e1dc7a51b --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-canvas-sub-rectangle.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..cb08f2123 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-canvas-sub-rectangle.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..a61dd03d2 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-canvas-sub-rectangle.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..1050125c6 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-canvas-sub-rectangle.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..46a3888f5 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/canvas_sub_rectangle/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-canvas-sub-rectangle.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..389d24113 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..3377531b4 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..2bfe11ca8 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..89bfefe93 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..99dc50712 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..6755871ce --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-blob.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..5174b0234 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-blob.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..85c3461fc --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-blob.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..d04819d42 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-blob.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..4532ef4a0 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-blob.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..de01ffdb9 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..3bcdc7a9e --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..afb442655 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..8b1a3fdb4 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..e675b7b3c --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..5dd21fb36 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..1323f7c23 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..88bf5fe40 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..b1a9d1c19 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..36f6d02a5 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..d8f9a773a --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image-bitmap.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..e18773fb7 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image-bitmap.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..b896329ba --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image-bitmap.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..ecd52d07b --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image-bitmap.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..70a1f0e1a --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image-bitmap.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..901d1ce28 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image-data.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..39d2e0c13 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image-data.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..231972ea1 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image-data.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..d8c6bb45a --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image-data.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..3d5df92a2 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-image-data.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..1057e4397 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-video.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..31b178f66 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-video.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..5e3492f53 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-video.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..65896e7f2 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-video.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..fdc4c39d6 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_bitmap_from_video/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-bitmap-from-video.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..e9c9684a4 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-data.js"></script> +</head> +<body> +<canvas id="texcanvas" width="2" height="2"></canvas> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..e1c20e9f6 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-data.js"></script> +</head> +<body> +<canvas id="texcanvas" width="2" height="2"></canvas> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..2b3a9720c --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-data.js"></script> +</head> +<body> +<canvas id="texcanvas" width="2" height="2"></canvas> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..33f76ff6f --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-data.js"></script> +</head> +<body> +<canvas id="texcanvas" width="2" height="2"></canvas> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..e60051e80 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,58 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-image-data.js"></script> +</head> +<body> +<canvas id="texcanvas" width="2" height="2"></canvas> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/00_test_list.txt new file mode 100644 index 000000000..505826de4 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/00_test_list.txt @@ -0,0 +1,42 @@ +--max-version 1.9.9 compressed-tex-image.html +copy-tex-image-and-sub-image-2d.html +--min-version 1.0.2 copy-tex-image-2d-formats.html +--min-version 1.0.4 copy-tex-sub-image-2d-partial-texture.html +--min-version 1.0.4 cube-incomplete-fbo.html +--min-version 1.0.3 default-texture.html +--min-version 1.0.2 --max-version 1.9.9 gl-get-tex-parameter.html +gl-pixelstorei.html +gl-teximage.html +origin-clean-conformance.html +tex-image-and-sub-image-2d-with-array-buffer-view.html +tex-image-and-uniform-binding-bugs.html +--min-version 1.0.3 tex-image-canvas-corruption.html +--min-version 1.0.2 tex-image-webgl.html +tex-image-with-format-and-type.html +tex-image-with-invalid-data.html +--max-version 1.9.9 tex-input-validation.html +tex-sub-image-2d-bad-args.html +tex-sub-image-2d.html +texparameter-test.html +texture-active-bind-2.html +texture-active-bind.html +--min-version 1.0.2 texture-attachment-formats.html +--min-version 1.0.2 texture-clear.html +texture-complete.html +--min-version 1.0.3 texture-copying-feedback-loops.html +--min-version 1.0.4 texture-cube-as-fbo-attachment.html +--min-version 1.0.2 texture-hd-dpi.html +--min-version 1.0.2 --max-version 1.9.9 texture-formats-test.html +texture-mips.html +--max-version 1.9.9 texture-npot-video.html +--max-version 1.9.9 texture-npot.html +texture-size.html +texture-size-cube-maps.html +--min-version 1.0.2 texture-size-limit.html +--min-version 1.0.2 texture-sub-image-cube-maps.html +texture-transparent-pixels-initialized.html +--min-version 1.0.2 texture-upload-cube-maps.html +--min-version 1.0.3 texture-upload-size.html +--min-version 1.0.2 mipmap-fbo.html +--min-version 1.0.3 --max-version 1.9.9 texture-fakeblack.html +--min-version 1.0.3 texture-draw-with-2d-and-cube.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/compressed-tex-image.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/compressed-tex-image.html new file mode 100644 index 000000000..80ab3109c --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/compressed-tex-image.html @@ -0,0 +1,82 @@ +<!-- + +/* +** Copyright (c) 2012 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 CompressedTexImage and CompressedTexSubImage Tests</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> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description("This test ensures WebGL implementations correctly implement compressedTexImage2D and compressedTexSubImage2D."); + +debug(""); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext(); + +var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; +var COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; +var COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; +var ETC1_RGB8_OES = 0x8D64; +var COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00; +var COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02; + +var formats = null; + +if (!gl) { + testFailed("context does not exist"); +} else { + testPassed("context exists"); + + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + + wtu.shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8))"); + wtu.shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8))"); + wtu.shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_S3TC_DXT5_EXT, 4, 4, 0, new Uint8Array(16))"); + wtu.shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ETC1_RGB8_OES, 4, 4, 0, new Uint8Array(8))"); + wtu.shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 8, 8, 0, new Uint8Array(8))"); + wtu.shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 8, 8, 0, new Uint8Array(8))"); + + wtu.shouldGenerateGLError(gl, gl.NO_ERROR, "formats = gl.getParameter(gl.COMPRESSED_TEXTURE_FORMATS)"); + shouldBeNonNull("formats"); + shouldBe("formats.length", "0"); +} + +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/copy-tex-image-2d-formats.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/copy-tex-image-2d-formats.html new file mode 100644 index 000000000..49cf33499 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/copy-tex-image-2d-formats.html @@ -0,0 +1,194 @@ +<!-- + +/* +** Copyright (c) 2012 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> +<title>Verify copyTexImage2D follows format restictions</title> +<meta charset="utf-8"> +<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> +<div id="description"></div> +<canvas id="canvas" width="2" height="2"></canvas> +<canvas id="canvasNoAlpha" width="2" height="2"></canvas> +<div id="console"></div> +<script> +"use strict"; + +function getChannelsFromFormat(format) { + switch (gl[format]) { + case gl.ALPHA: + return 0x0001; + case gl.LUMINANCE: + case gl.RGB: + return 0x1110; + case gl.LUMINANCE_ALPHA: + case gl.RGBA: + return 0x1111; + default: + return 0; + } +} + +var formats = [ + 'ALPHA', + 'LUMINANCE', + 'LUMINANCE_ALPHA', + 'RGB', + 'RGBA' +]; + +var isRenderable = { + 'ALPHA': false, + 'LUMINANCE': false, + 'LUMINANCE_ALPHA': false, + 'RGB': true, + 'RGBA': true +}; + +var gl = null; +var wtu = WebGLTestUtils; + +description(); + +var canvas = document.getElementById("canvas"); +var canvasNoAlpha = document.getElementById("canvasNoAlpha"); +var gl = wtu.create3DContext(canvas, {alpha:true}); +var glNoAlpha = wtu.create3DContext(canvasNoAlpha, {alpha:false}); + +debug("test with an RGBA backbuffer"); +var program = wtu.setupTexturedQuad(gl); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "During Initialization"); +testFormats('RGBA'); + +testBackbufferFormats(); + +debug("test with an RGB backbuffer"); +var gl = glNoAlpha; +var program = wtu.setupTexturedQuad(gl); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "During Initialization"); +testFormats('RGB'); + +function testBackbufferFormats() { + var fbo = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + + for (var ii = 0; ii < formats.length; ++ii) { + var backFormat = formats[ii]; + + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D(gl.TEXTURE_2D, 0, gl[backFormat], 2, 2, 0, gl[backFormat], gl.UNSIGNED_BYTE, null); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0); + var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); + + debug(''); + if (status == gl.FRAMEBUFFER_COMPLETE) { + if (!isRenderable[backFormat]) { + testFailed('Creating framebuffer from ' + backFormat + ' texture succeeded even though it is not a renderable format'); + } else { + debug('test with ' + backFormat + ' fbo'); + testFormats(backFormat); + } + } else { + debug(backFormat + ' not supported as a renderbuffer attachment'); + } + } +} + +function testFormats(backFormat) { + for (var ii = 0; ii < formats.length; ++ii) { + testCopyTexImage2D(backFormat, formats[ii]); + } +} + +function toChannels(value) { + return ((value & 0x1000) ? 'R' : '_') + + ((value & 0x0100) ? 'G' : '_') + + ((value & 0x0010) ? 'B' : '_') + + ((value & 0x0001) ? 'A' : '_'); +} + +function testCopyTexImage2D(backFormat, texFormat) { + var need = getChannelsFromFormat(texFormat); + var have = getChannelsFromFormat(backFormat); + var shouldPass = (need & have) == need; + + //debug("need: " + toChannels(need)); + //debug("have: " + toChannels(have)); + //debug("both: " + toChannels(have & need)); + + // clear backbuffer + gl.clearColor(0.25, 1, 0.75, 0.5); + gl.clear(gl.COLOR_BUFFER_BIT); + + var texture = gl.createTexture(); + // Bind the texture to texture unit 0 + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + + gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl[texFormat], 0, 0, 2, 2, 0); + if (!shouldPass) { + wtu.glErrorShouldBe( + gl, gl.INVALID_OPERATION, + "should not be able to copyTexImage2D " + texFormat + " from " + backFormat); + return; + } + + wtu.glErrorShouldBe( + gl, gl.NO_ERROR, + "should be able to copyTexImage2D " + texFormat + " from " + backFormat); + + // Draw + wtu.clearAndDrawUnitQuad(gl); + + var expectedColors = { + 'ALPHA': [0, 0, 0, 127], + 'LUMINANCE': [64, 64, 64, 255], + 'LUMINANCE_ALPHA': [64, 64, 64, 127], + 'RGB': [64, 255, 191, 255], + 'RGBA': [64, 255, 191, 127] + }; + + var color = expectedColors[texFormat]; + + wtu.checkCanvas(gl, color, "should be " + color, 16); + + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be no errors"); +} +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/copy-tex-image-and-sub-image-2d.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/copy-tex-image-and-sub-image-2d.html new file mode 100644 index 000000000..bc5e2310c --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/copy-tex-image-and-sub-image-2d.html @@ -0,0 +1,158 @@ +<!-- + +/* +** Copyright (c) 2012 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"> +<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> + +<script> +"use strict"; +var successfullyParsed = false; + +function init() +{ + description('Verify copyTexImage2D and copyTexSubImage2D'); + + runTest(); +} + +var gl = null; +var wtu = WebGLTestUtils; + +function runTestIteration(antialias) +{ + var canvas = document.getElementById( + antialias ? "antialiasOn" : "antialiasOff"); + var attribs = antialias ? { antialias: true } : { antialias: false }; + gl = wtu.create3DContext(canvas, attribs); + var program = wtu.setupTexturedQuad(gl); + var textureLoc = gl.getUniformLocation(program, "tex"); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "During Initialization"); + + gl.colorMask(1, 1, 1, 1); + gl.disable(gl.BLEND); + debug('Testing copyTexImage2D'); + + // Red canvas + gl.clearColor(1, 0, 0, 1); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + + var texture = gl.createTexture(); + // Bind the texture to texture unit 0 + gl.bindTexture(gl.TEXTURE_2D, texture); + // Set up texture + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.uniform1i(textureLoc, 0); + + var colors = [ + [1, 0, 0, 1], + [0, 1, 0, 1], + [0, 0, 1, 1], + [0.5, 0.5, 0.5, 0.5], + ]; + var data = new Uint8Array(2 * 2 * 4); + for (var ii = 0; ii < 2 * 2 * 4; ++ii) + data[ii] = 136; // A random number other than 0. + var count = 0; + for (var yy = -2; yy <= 2; ++yy) { + for (var xx = -2; xx <= 2; ++xx) { + for (var ii = 0; ii < 2; ++ii) { + var texColor = colors[count]; + var clearColor = colors[(count + 1) % colors.length]; + // clear to some color + gl.clearColor(texColor[0], texColor[1], texColor[2], texColor[3]); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + + // copy that color to the texture. + switch (ii) { + case 0: + gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, xx, yy, 2, 2, 0); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "using copyTexImage2D: x = " + xx + ", y = " + yy); + break; + case 1: + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); + gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, xx, yy, 2, 2); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "using copyTexSubImage2D: x = " + xx + ", y = " + yy); + break; + } + + // clear to some other color. + gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + + // Draw the triangles + wtu.clearAndDrawUnitQuad(gl); + + // check the rendering results + for (var iy = 0; iy < 2; ++iy) { + for (var ix = 0; ix < 2; ++ix) { + var x = xx + ix; + var y = yy + iy; + var expectedColor = (x < 0 || y < 0 || x >= 2 || y >= 2) ? + (ii == 0 ? [0, 0, 0, 0] : [136, 136, 136, 136]) : + [Math.floor(255 * texColor[0]), + Math.floor(255 * texColor[1]), + Math.floor(255 * texColor[2]), + Math.floor(255 * texColor[3])]; + wtu.checkCanvasRect(gl, ix, iy, 1, 1, expectedColor, + "" + ix + ", " + iy + " should render " + expectedColor + " (+/-1)", 1); + } + } + count = (count + 1) % colors.length; + } + } + } + + debug(""); +} + +function runTest(antialias) +{ + debug("Testing with antialias on"); + runTestIteration(true); + debug("Testing with antialias off"); + runTestIteration(false); + + finishTest(); +} +</script> +</head> +<body onload="init()"> +<canvas id="antialiasOn" width="2" height="2"></canvas> +<canvas id="antialiasOff" width="2" height="2"></canvas> +<div id="description"></div> +<div id="console"></div> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/copy-tex-sub-image-2d-partial-texture.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/copy-tex-sub-image-2d-partial-texture.html new file mode 100644 index 000000000..3fa47a4c0 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/copy-tex-sub-image-2d-partial-texture.html @@ -0,0 +1,191 @@ +<!-- + +/* +** Copyright (c) 2016 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>CopyTexSubImage2D partial destination texture 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> +<div id="description"></div> +<canvas id="canvas"></canvas> +<div id="console"></div> + +<script> +"use strict"; +description("Verifies that copyTexSubImage2D redefining part of the destination texture works as expected."); + +//// + +var kWidth = 16; +var kHeight = 16; + +//// + +var wtu = WebGLTestUtils; +var canvas = document.getElementById("canvas"); + +canvas.width = kWidth; +canvas.height = kHeight; +var gl = wtu.create3DContext(canvas); + +//// + +function clearTo(color) { + gl.clearColor(color[0], color[1], color[2], color[3]); + gl.clear(gl.COLOR_BUFFER_BIT); +} + +function readInto(view) { + gl.readPixels(0, 0, kWidth, kHeight, gl.RGBA, gl.UNSIGNED_BYTE, + new Uint8Array(view.buffer)); +} + +//// + +function runTest() { + gl.enable(gl.SCISSOR_TEST); + + gl.scissor(0, 0, kWidth/2, kHeight/2); + clearTo([1,0,0,1]); + gl.scissor(kWidth/2, 0, kWidth/2, kHeight/2); + clearTo([0,1,0,1]); + gl.scissor(0, kHeight/2, kWidth/2, kHeight/2); + clearTo([0,0,1,1]); + gl.scissor(kWidth/2, kHeight/2, kWidth/2, kHeight/2); + clearTo([0,1,1,1]); + + var srcData = new Uint32Array(kWidth * kHeight); + readInto(srcData); + console.log('0x' + srcData[0].toString(16)); + + //// + + var dstTex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, dstTex); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, kWidth, kHeight, + 0, gl.RGBA, gl.UNSIGNED_BYTE, null); // Uploads zeros. + var dstRefData = new Uint32Array(kWidth * kHeight); // Also cleared to zeros! + var dstTestData = new Uint32Array(kWidth * kHeight); + + var dstFB = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, dstFB); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, + gl.TEXTURE_2D, dstTex, 0); + + //// + + function pixelPos(x, y) { + return y * kWidth + x; + } + + function testCmd(tuple) { + var dstX0, dstY0, srcX0, srcY0, width, height; + [dstX0, dstY0, srcX0, srcY0, width, height] = tuple + debug("copyTexSubImage2D(" + + [dstX0+','+dstY0, srcX0+','+srcY0, width+','+height].join(', ') + + ")"); + + // Test + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, + dstX0, dstY0, srcX0, srcY0, width, height); + + // Emulate for reference + for (var x = 0; x < width; x++) { + var srcX = srcX0 + x; + var dstX = dstX0 + x; + if (srcX < 0 || srcX >= kWidth || + dstX < 0 || dstX >= kWidth) + { + continue; + } + + for (var y = 0; y < height; y++) { + var srcY = srcY0 + y; + var dstY = dstY0 + y; + if (srcY < 0 || srcY >= kHeight || + dstY < 0 || dstY >= kHeight) + { + continue; + } + + + var srcPos = pixelPos(srcX, srcY); + var dstPos = pixelPos(dstX, dstY); + dstRefData[dstPos] = srcData[srcPos]; + } + } + + // Compare + gl.bindFramebuffer(gl.FRAMEBUFFER, dstFB); + readInto(dstTestData); + + for (var x = 0; x < kWidth; x++) { + for (var y = 0; y < kHeight; y++) { + var pos = pixelPos(x, y); + var refPixel = dstRefData[pos]; + var testPixel = dstTestData[pos]; + + //console.log([x, y].join(",") + ":", + // testPixel.toString(16), refPixel.toString(16)) + if (testPixel == refPixel) + continue; + + testFailed("Mismatch at (" + [x, y].join(", ") + "): " + + " Should be 0x" + refPixel.toString(16) + + ", was 0x" + testPixel.toString(16)); + return false; + } + } + + return true; + } + + var tests = [ + [0,0, 0,0, 2,3], + [0,0, 5,8, 2,3], + [1,0, 0,0, 2,3], + [1,7, 0,0, 2,3], + ]; + + tests.every(x => testCmd(x)); +} + +runTest(); + +debug(""); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/cube-incomplete-fbo.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/cube-incomplete-fbo.html new file mode 100644 index 000000000..a04e75aed --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/cube-incomplete-fbo.html @@ -0,0 +1,93 @@ +<!-- + +/* +** Copyright (c) 2015 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>Test that cube incomplete textures can not be used as FBO attachments</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="example" width="24" height="24"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; + +var wtu = WebGLTestUtils; +description(); + +var gl = wtu.create3DContext("example"); + +var testIncompleteCubemapFaceInFBO = function() { + // Create a cube map texture that's not cube complete. + var tex2 = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex2); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + + var cube_map_faces = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ]; + // Fill in all but 1 cube map face + for (var i = 0; i < cube_map_faces.length - 1; ++i) { + gl.texImage2D(cube_map_faces[i], 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + } + + var fb2 = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fb2); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X, tex2, 0); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors after attaching cube map face."); + debug("Cubemap has 1 missing face, so framebuffer should not be complete."); + shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT"); + + debug(""); + + // Fill in missing cube map face + gl.texImage2D(cube_map_faces[5], 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + debug("Missing face is added, so framebuffer should become complete."); + shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE"); +} + +testIncompleteCubemapFaceInFBO(); + +var successfullyParsed = true; +finishTest(); + +</script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/default-texture.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/default-texture.html new file mode 100644 index 000000000..a65975b7e --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/default-texture.html @@ -0,0 +1,63 @@ +<!-- + +/* +** Copyright (c) 2014 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>Tests texture access with no texture bound</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="example" width="24" height="24"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; + +var wtu = WebGLTestUtils; +description(); + +var gl = wtu.create3DContext("example"); +var program = wtu.setupTexturedQuad(gl); + +gl.drawArrays(gl.TRIANGLES, 0, 6); + +// When no texture is bound, it is considered an incomplete texture, +// therefore, [0, 0, 0, 1] should be returned. +// See OpenGL ES spec 2.0.25, section F.3.5. +wtu.checkCanvas(gl, [0, 0, 0, 255]); + +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/gl-get-tex-parameter.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/gl-get-tex-parameter.html new file mode 100644 index 000000000..40caea725 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/gl-get-tex-parameter.html @@ -0,0 +1,48 @@ +<!-- + +/* +** Copyright (c) 2012 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 getTexParameter 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="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +var contextVersion = 1; +</script> +<script src="../../../js/tests/gl-get-tex-parameter.js"></script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/gl-pixelstorei.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/gl-pixelstorei.html new file mode 100644 index 000000000..5ec41c965 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/gl-pixelstorei.html @@ -0,0 +1,117 @@ +<!-- + +/* +** Copyright (c) 2012 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 pixelStorei 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="example" width="50" height="50"></canvas> +<canvas id="2d00" width="50" height="50"></canvas> +<canvas id="2d01" width="50" height="50"></canvas> +<canvas id="2d02" width="50" height="50"></canvas> +<canvas id="2d03" width="50" height="50"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader" type="x-shader/x-vertex"> +attribute vec4 vPosition; +void main() { + gl_Position = vPosition; +} +</script> + +<script id="fshader" type="x-shader/x-fragment"> +void main() { + gl_FragColor = vec4(1.0,0.0,0.0,1.0); +} +</script> + +<script> +"use strict"; +function init() { + description("This test checks that drawImage and readPixels are not effected by gl.Pixelstorei(gl.PACK_ALIGNMENT) and visa versa"); + + debug("There should be 5 red triangles on 5 black squares above"); + debug(""); + + var wtu = WebGLTestUtils; + var canvas3d = document.getElementById("example"); + var gl = wtu.create3DContext("example"); + var program = wtu.setupProgram(gl, ["vshader", "fshader"], ["vPosition"]); + + var vertexObject = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.5,0, -0.5,-0.5,0, 0.5,-0.5,0 ]), gl.STATIC_DRAW); + gl.enableVertexAttribArray(0); + gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0); + + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + gl.drawArrays(gl.TRIANGLES, 0, 3); + + function checkData(ctx, name) { + // Test several locations + // First line should be all black + wtu.checkCanvasRect(ctx, 0, 0, 50, 1, [0, 0, 0, 0]); + + // Line 25 should be red for at least 6 red pixels starting 22 pixels in + wtu.checkCanvasRect(ctx, 22, 25, 6, 1, [255, 0, 0, 255]); + + // Last line should be all black + wtu.checkCanvasRect(ctx, 0, 49, 50, 1, [0, 0, 0, 0]); + } + + var ctx2d; + + function checkColors() { + checkData(gl, "3d context"); + checkData(ctx2d, "2d context"); + } + + var table = [1, 2, 4, 8]; + for (var ii = 0; ii < table.length; ++ii) { + gl.pixelStorei(gl.PACK_ALIGNMENT, table[ii]); + ctx2d = document.getElementById("2d0" + ii).getContext("2d"); + ctx2d.globalCompositeOperation = 'copy'; + ctx2d.drawImage(canvas3d, 0, 0); + checkColors(); + assertMsg(gl.getParameter(gl.PACK_ALIGNMENT) == table[ii], + "PACK_ALIGNMENT is " + table[ii]); + } +} + +init(); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/gl-teximage.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/gl-teximage.html new file mode 100644 index 000000000..b6fa01afb --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/gl-teximage.html @@ -0,0 +1,427 @@ +<!-- + +/* +** Copyright (c) 2012 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 texImage2D conformance 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="example" width="256" height="16" style="width: 256px; height: 48px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +enableJSTestPreVerboseLogging(); +description("Test texImage2D conversions."); +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("example"); +gl.disable(gl.DITHER); +var program = wtu.setupTexturedQuad(gl); +var successfullyParsed; + +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + +var imgURLs = [ + '../../../resources/1-channel.jpg', + '../../../resources/gray-ramp-256-with-128-alpha.png', + '../../../resources/gray-ramp-256.png', + '../../../resources/gray-ramp-default-gamma.png', + '../../../resources/gray-ramp-gamma0.1.png', + '../../../resources/gray-ramp-gamma1.0.png', + '../../../resources/gray-ramp-gamma2.0.png', + '../../../resources/gray-ramp-gamma4.0.png', + '../../../resources/gray-ramp-gamma9.0.png', + '../../../resources/gray-ramp.png', + '../../../resources/zero-alpha.png', + '../../../resources/3x3.png', + '../../../resources/blue-1x1.jpg', + '../../../resources/red-indexed.png', + '../../../resources/transparent-on-left-indexed.png', + '../../../resources/green-2x2-16bit.png', + '../../../resources/small-square-with-colorspin-profile.jpg', + '../../../resources/small-square-with-colorspin-profile.png', + '../../../resources/small-square-with-cie-rgb-profile.png', + '../../../resources/small-square-with-colormatch-profile.png', + '../../../resources/small-square-with-e-srgb-profile.png', + '../../../resources/small-square-with-smpte-c-profile.png', + '../../../resources/small-square-with-srgb-iec61966-2.1-profile.png']; + + +wtu.loadImagesAsync(imgURLs, runTests); + +function runTests(imgs) { + var loc = gl.getUniformLocation(program, "tex"); + gl.uniform1i(loc, 0); + + gl.disable(gl.BLEND); + gl.disable(gl.DEPTH_TEST); + + var width = gl.canvas.width; + var height = gl.canvas.height; + + function checkPixel(x, y, color) { + wtu.checkCanvasRect(gl, x, y, 1, 1, color); + } + + function checkPixelRange(x, y, color, allowedRange) { + var msg = "pixel " + x + ", " + y + " should be within " + + allowedRange + " units of " + + color[0] + ", " + + color[1] + ", " + + color[2] + ", " + + color[3]; + wtu.checkCanvasRect(gl, x, y, 1, 1, color, msg, allowedRange); + } + + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + + var buf = new Uint8Array(width * height * 4); + + debug(""); + debug("check pixels are NOT pre-multiplied"); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['../../../resources/zero-alpha.png']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + + var left = 0; + var middle = Math.floor(width / 2); + var right = width - 1; + var bottom = 0; + var center = Math.floor(height / 2); + var top = height - 1; + checkPixel(left, top, [ 0, 0, 0, 255]); + checkPixel(middle, top, [255, 0, 255, 255]); + checkPixel(right, top, [ 0, 0, 255, 255]); + checkPixel(left, center, [128, 128, 128, 255]); + checkPixel(middle, center, [255, 255, 255, 255]); + checkPixel(right, center, [ 0, 255, 255, 255]); + checkPixel(left, bottom, [255, 0, 0, 255]); + checkPixel(middle, bottom, [255, 255, 0, 255]); + checkPixel(right, bottom, [ 0, 255, 0, 255]); + + debug(""); + debug("check quantization"); + var quantInfo = [ + {format: gl.RGBA, type: gl.UNSIGNED_BYTE, counts: [256, 256, 256, 256]}, + {format: gl.RGBA, type: gl.UNSIGNED_SHORT_4_4_4_4, counts: [ 16, 16, 16, 16]}, + {format: gl.RGB, type: gl.UNSIGNED_SHORT_5_6_5, counts: [ 32, 64, 32, 1]}, + {format: gl.RGBA, type: gl.UNSIGNED_SHORT_5_5_5_1, counts: [ 32, 32, 32, 2]}]; + for (var qq = 0; qq < quantInfo.length; ++qq) { + var info = quantInfo[qq]; + gl.texImage2D( + gl.TEXTURE_2D, 0, info.format, info.format, info.type, + imgs['../../../resources/gray-ramp-256.png']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + wtu.clearAndDrawUnitQuad(gl); + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + var counts = [{ }, { }, { }, { }]; + var numUniqueValues = [0, 0, 0, 0]; + // Count the number of unique values in each channel. + for (var ii = 0; ii < width * height * 4; ii += 4) { + for (var jj = 0; jj < 4; ++jj) { + var v = buf[ii + jj]; + if (!counts[jj][v]) { + counts[jj][v] = 1; + ++numUniqueValues[jj]; + } else { + ++counts[jj][v]; + } + } + } + for (var ii = 0; ii < 4; ++ii) { + assertMsg(numUniqueValues[ii] == info.counts[ii], + "There should be " + info.counts[ii] + + " unique values in channel " + ii + ". Found " + + numUniqueValues[ii]); + } + } + + debug(""); + debug("Check that gamma settings don't effect 8bit pngs"); + wtu.failIfGLError(gl, 'gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);'); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['../../../resources/gray-ramp-default-gamma.png']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + wtu.clearAndDrawUnitQuad(gl); + var ref = new Uint8Array(width * height * 4); + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, ref); + + var gammaImages = [ + '../../../resources/gray-ramp-gamma0.1.png', + '../../../resources/gray-ramp-gamma1.0.png', + '../../../resources/gray-ramp-gamma2.0.png', + '../../../resources/gray-ramp-gamma4.0.png', + '../../../resources/gray-ramp-gamma9.0.png']; + for (var ii = 0; ii < gammaImages.length; ++ii) { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs[gammaImages[ii]]); + wtu.clearAndDrawUnitQuad(gl); + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + var same = true; + for (var jj = 0; jj < width * height * 4; ++jj) { + if (buf[jj] != ref[jj]) { + same = false; + break; + } + } + assertMsg(same, "pixels should be same regardless of gamma settings."); + } + + debug(""); + debug("check pixels are UN pre-multiplied"); + for (var ii = 0; ii < 2; ++ii) { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + if (ii == 0) { + var canvas2d = document.createElement("canvas"); + canvas2d.width = 256; + canvas2d.height = 1; + var ctx = canvas2d.getContext("2d"); + ctx.drawImage(imgs['../../../resources/gray-ramp-256-with-128-alpha.png'], 0, 0); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, canvas2d); + } else { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['../../../resources/gray-ramp-256-with-128-alpha.png']); + } + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + wtu.clearAndDrawUnitQuad(gl); + var buf = new Uint8Array(width * height * 4); + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + var lt128Count = [0, 0, 0]; + var ge128Count = [0, 0, 0]; + for (var jj = 0; jj < width; ++jj) { + var off = jj * 4; + for (var cc = 0; cc < 3; ++cc) { + if (buf[off + cc] < 128) { + ++lt128Count[cc]; + } else { + ++ge128Count[cc]; + } + } + } + // Not sure the exact count here because gamma does effect drawing into the + // canvas but it should be close to 50% so I'll pass 45% + for (var jj = 0; jj < 3; ++jj) { + assertMsg(ge128Count[jj] > 256 * 0.45, + "Half the pixels in channel " + jj + + " should be >= 128,128,128. found " + + ((ge128Count[jj] / 256) * 100).toFixed() + "%"); + assertMsg(lt128Count[jj] > 256 * 0.45, + "Half the pixels in channel " + jj + + " should be < 128,128,128. found " + + ((lt128Count[jj] / 256) * 100).toFixed() + "%"); + } + } + + debug(""); + debug("check canvas pixels are UN pre-multiplied"); + var canvas2d = document.createElement("canvas"); + canvas2d.width = 1; + canvas2d.height = 1; + var ctx = canvas2d.getContext("2d"); + ctx.fillStyle ="rgba(255,255,255,0.5)"; + ctx.fillRect(0, 0, 256, 1); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); + wtu.clearAndDrawUnitQuad(gl); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + checkPixelRange(0, 0, [255, 255, 255, 127], 4); + + debug(""); + debug("check canvas pixels are pre-multiplied"); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); + wtu.clearAndDrawUnitQuad(gl); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + checkPixelRange(0, 0, [127, 127, 127, 127], 4); + + + debug(""); + debug("check pixels are pre-multiplied"); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); + // TODO(gman): use different texture that won't pass on failure + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, + imgs['../../../resources/zero-alpha.png']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + + var same = true; + for (var jj = 0; jj < width * height * 4; ++jj) { + if (buf[jj] != 0) { + same = false; + break; + } + } + assertMsg(same, "pixels should all be 0."); + + debug(""); + debug("check pixels are flipped"); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['../../../resources/3x3.png']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + + checkPixel(left, top, [255, 0, 0, 255]); + checkPixel(middle, top, [255, 255, 0, 255]); + checkPixel(right, top, [255, 0, 0, 255]); + checkPixel(left, center, [255, 0, 255, 255]); + checkPixel(middle, center, [255, 0, 0, 255]); + checkPixel(right, center, [ 0, 255, 0, 255]); + checkPixel(left, bottom, [ 0, 0, 0, 255]); + checkPixel(middle, bottom, [ 0, 0, 255, 255]); + checkPixel(right, bottom, [255, 0, 0, 255]); + + debug(""); + debug("check uploading of images with no alpha channel works"); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['../../../resources/blue-1x1.jpg']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + checkPixelRange(middle, center, [ 0, 0, 255, 255], 10); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors"); + + debug(""); + debug("check uploading of 16-bit images"); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['../../../resources/green-2x2-16bit.png']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + checkPixelRange(middle, center, [ 15, 121, 0, 255], 10); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors"); + + debug(""); + debug("check uploading of images with ICC profiles"); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false); + wtu.failIfGLError(gl, 'gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);'); + + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['../../../resources/small-square-with-colorspin-profile.jpg']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + // The image is red. However, if we ignore the color profile, it is blue. + checkPixelRange(middle, center, [ 0, 0, 255, 255], 10); + + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['../../../resources/small-square-with-colorspin-profile.png']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + // The image is red. However, if we ignore the color profile, it is blue. + checkPixelRange(middle, center, [ 0, 0, 255, 255], 10); + + var iccPNGs = [ + '../../../resources/small-square-with-cie-rgb-profile.png', + '../../../resources/small-square-with-colormatch-profile.png', + '../../../resources/small-square-with-e-srgb-profile.png', + '../../../resources/small-square-with-smpte-c-profile.png', + '../../../resources/small-square-with-srgb-iec61966-2.1-profile.png']; + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + for (var ii = 0; ii < iccPNGs.length; ++ii) { + var buf2 = new Uint8Array(width * height * 4); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs[iccPNGs[ii]]); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf2); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors"); + var same = true; + for (var jj = 0; jj < buf.length; ++jj) { + if (buf[jj] != buf2[jj]) { + same = false; + break; + } + } + assertMsg(same, "uploading PNGs with same data but various ICC profiles should generate the same results"); + } + + debug(""); + debug("check uploading of indexed PNG images"); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['../../../resources/red-indexed.png']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + // The image should be red. + checkPixelRange(middle, center, [ 255, 0, 0, 255 ], 10); + + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, + imgs['../../../resources/transparent-on-left-indexed.png']); + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvasRect(gl, 0, 0, 128, 16, [255, 0, 255, 0], "should be transparent purple"); + wtu.checkCanvasRect(gl, 128, 0,128, 16, [255, 255, 0, 255], "should be yellow"); + + debug(""); + debug("check uploading of 1-channel JPG images"); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['../../../resources/1-channel.jpg']); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + // The image should be gray. + checkPixelRange(middle, center, [ 128, 128, 128, 255 ], 28); + + debug("") + debug("check calling texImage2D with NULL clears the texture"); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, + imgs['../../../resources/red-indexed.png'].width, + imgs['../../../resources/red-indexed.png'].height, + 0, gl.RGB, gl.UNSIGNED_BYTE, null); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.clearAndDrawUnitQuad(gl); + // The image should be white. + checkPixelRange(middle, center, [ 0, 0, 0, 255 ], 10); + + debug(""); + debug("check zero size cases"); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, 2, 0, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, new Uint8Array()); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from zero sized textures"); + + debug(""); + successfullyParsed = true; + shouldBeTrue("successfullyParsed"); + debug('<br /><span class="pass">TEST COMPLETE</span>'); + notifyFinishedToHarness(); +} +</script> +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/mipmap-fbo.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/mipmap-fbo.html new file mode 100644 index 000000000..361179f8a --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/mipmap-fbo.html @@ -0,0 +1,130 @@ +<!-- + +/* +** Copyright (c) 2012 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>Test if mipmap incomplete textures can be used as FBO attachments, and mipmap generation on a texture filled by an FBO works correctly</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="example" width="24" height="24"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; + +var wtu = WebGLTestUtils; +description(); + +var gl = wtu.create3DContext("example"); + +function testMipmapGeneration() { + // setup render target texture // + var texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.bindTexture(gl.TEXTURE_2D, null); + + // setup framebuffer // + var fbo = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + // fill the framebuffer // + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + gl.viewport(0, 0, 32, 32); + gl.clearColor(1, 0, 1, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + // generate mipmap // + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.generateMipmap(gl.TEXTURE_2D); + + var program = wtu.setupTexturedQuad(gl); + gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + // readback // + wtu.checkCanvas(gl, [255, 0, 255, 255]); +} + +var testCubemapFaceWithIncompleteMipmapInFBO = function() { + // Create a cube map texture that's not mipmap complete. + var tex2 = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex2); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR); + + var cube_map_faces = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ]; + for (var i = 0; i < cube_map_faces.length; ++i) { + gl.texImage2D(cube_map_faces[i], 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + } + + var fb2 = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fb2); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X, tex2, 0); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors after attaching cube map face."); + shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE"); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); + + var colorProgram = wtu.setupColorQuad(gl); + var colorLocation = gl.getUniformLocation(colorProgram, 'u_color'); + gl.uniform4f(colorLocation, 0.0, 1.0, 0.0, 1.0); + gl.viewport(0, 0, 32, 32); + wtu.drawUnitQuad(gl); + // Read what's in the framebuffer - note that we need to use checkCanvasRect since the + // FB dimensions are different from canvas dimensions. + wtu.checkCanvasRect(gl, 0, 0, 32, 32, [0, 255, 0, 255], + "Framebuffer with a non-mipmap complete cube map attachment should be green"); +} + +testMipmapGeneration(); +debug(""); +testCubemapFaceWithIncompleteMipmapInFBO(); + +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/origin-clean-conformance.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/origin-clean-conformance.html new file mode 100644 index 000000000..9d9acf727 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/origin-clean-conformance.html @@ -0,0 +1,149 @@ +<!-- + +/* +** Copyright (c) 2012 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 Origin Restrictions Conformance Tests</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> +<script> +"use strict"; +var wtu = WebGLTestUtils; + +// Checks if function throws an exception. +function causedException(func) { + var hadException = false; + try { + func(); + } catch(e) { + hadException = true; + } + return hadException; +} + +var defaultImgUrl = "http://www.opengl.org/img/opengl_logo.jpg"; +var localImgUrl = "../../../resources/opengl_logo.jpg"; + +var imgDomain; +var pageDomain; +var successfullyParsed; + +function imageLoaded() { + description("This test ensures WebGL implementations follow proper same-origin restrictions."); + var img = this; + + assertMsg(img.width > 0 && img.height > 0, "img was loaded"); + imgDomain = wtu.getBaseDomain(wtu.getHost(img.src)); + pageDomain = wtu.getBaseDomain(window.location.host); + assertMsg(imgDomain != pageDomain, + "img domain (" + imgDomain + ") and page domain (" + pageDomain + ") are not the same."); + + function makeTexImage2D(gl, src) { + return function() { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, src); + }; + } + + function makeTexSubImage2D(gl, src) { + return function() { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, src); + }; + } + + function makeReadPixels(gl) { + return function() { + var buf = new Uint8Array(4); + gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf); + }; + } + + function makeToDataURL(canvas) { + return function() { + var data = canvas.toDataURL(); + } + } + + var canvas1 = document.getElementById("canvas1"); + var gl = wtu.create3DContext(canvas1); + + debug(""); + debug("check that an attempt to upload an image from another origin throws an exception."); + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 256, 256, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + assertMsg(causedException(makeTexImage2D(gl, img)), + "texImage2D with cross-origin image should throw exception."); + assertMsg(causedException(makeTexSubImage2D(gl, img)), + "texSubImage2D with cross-origin image should throw exception."); + + debug("check that readPixels and toDataURL continue to work against this canvas."); + assertMsg(!causedException(makeReadPixels(gl)), + "readPixels should never throw exception -- not possible to dirty origin of WebGL canvas."); + assertMsg(!causedException(makeToDataURL(canvas1)), + "should not throw exception by toDataURL for WebGL canvas, which should stay origin clean."); + + debug("check that an attempt to upload a tainted canvas throws an exception."); + var canvas2 = document.getElementById("canvas2"); + var ctx2d = canvas2.getContext("2d"); + ctx2d.drawImage(img, 0, 0); + assertMsg(causedException(makeToDataURL(canvas2)), + "should throw exception by toDataURL for NON origin clean canvas."); + assertMsg(causedException(makeTexImage2D(gl, canvas2)), + "texImage2D with NON origin clean canvas should throw exception."); + assertMsg(causedException(makeTexSubImage2D(gl, canvas2)), + "texSubImage2D with NON origin clean canvas should throw exception."); + + debug("check that readPixels and toDataURL continue to work against this canvas."); + assertMsg(!causedException(makeReadPixels(gl)), + "readPixels should never throw exception -- not possible to dirty origin of WebGL canvas."); + assertMsg(!causedException(makeToDataURL(canvas1)), + "should not throw exception by toDataURL for WebGL canvas, which should stay origin clean."); + + // TODO: Should check video. + // TODO: Should check CORS support. + + debug(""); + successfullyParsed = true; + shouldBeTrue("successfullyParsed"); + debug('<br /><span class="pass">TEST COMPLETE</span>'); + notifyFinishedToHarness(); +} + +wtu.setupImageForCrossOriginTest("#img", defaultImgUrl, localImgUrl, imageLoaded); +</script> +</head> +<body> +<div id="description"></div> +<div id="console"></div> +<canvas id="canvas1"></canvas> +<canvas id="canvas2"></canvas> +<img id="img" style="display:none;"> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-and-sub-image-2d-with-array-buffer-view.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-and-sub-image-2d-with-array-buffer-view.html new file mode 100644 index 000000000..40cc019aa --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-and-sub-image-2d-with-array-buffer-view.html @@ -0,0 +1,303 @@ +<!-- + +/* +** Copyright (c) 2012 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"> +<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="example" width="16" height="16"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description('Verifies texImage2D and texSubImage2D code paths taking ArrayBufferView'); + +var wtu = WebGLTestUtils; + +function roundUpToAlignment(value, alignment) { + return Math.floor((value + alignment - 1) / alignment) * alignment; +} + +function generateRGBAData(type, unpackAlignment, sourceData, width, height) +{ + var numColors = sourceData.length / 4; + var colorOffset = function(y) { + return 4 * Math.floor(y * numColors / height); + }; + + switch (type) { + case gl.UNSIGNED_BYTE: { + var rowWidth = roundUpToAlignment(width * 4, unpackAlignment); + var data = new Uint8Array(height * rowWidth); + for (var y = 0; y < height; ++y) { + var index = y * rowWidth; + var offset = colorOffset(y); + for (var element = 0; element < width * 4; ++element) { + data[index + element] = sourceData[offset + element % 4]; + } + } + return data; + } + case gl.UNSIGNED_SHORT_4_4_4_4: { + var rowWidth = roundUpToAlignment(width * 2, unpackAlignment) / 2; + var data = new Uint16Array(height * rowWidth); + for (var y = 0; y < height; ++y) { + var offset = colorOffset(y); + for (var x = 0; x < width; ++x) { + var index = y * rowWidth + x; + data[index] = (((sourceData[offset + 0] & 0xF0) << 8) + | ((sourceData[offset + 1] & 0xF0) << 4) + | ((sourceData[offset + 2] & 0xF0) >> 0) + | ((sourceData[offset + 3] & 0xF0) >> 4)); + } + } + return data; + } + case gl.UNSIGNED_SHORT_5_5_5_1: { + var rowWidth = roundUpToAlignment(width * 2, unpackAlignment) / 2; + var data = new Uint16Array(height * rowWidth); + for (var y = 0; y < height; ++y) { + var offset = colorOffset(y); + for (var x = 0; x < width; ++x) { + var index = y * rowWidth + x; + data[index] = (((sourceData[offset + 0] & 0xF8) << 8) + | ((sourceData[offset + 1] & 0xF8) << 3) + | ((sourceData[offset + 2] & 0xF8) >> 2) + | ((sourceData[offset + 3] & 0x80) >> 7)); + } + } + return data; + } + } +} + +function typeToString(type) +{ + switch (type) { + case gl.UNSIGNED_BYTE: return 'UNSIGNED_BYTE'; + case gl.UNSIGNED_SHORT_5_5_5_1: return 'UNSIGNED_SHORT_5_5_5_1'; + case gl.UNSIGNED_SHORT_4_4_4_4: return 'UNSIGNED_SHORT_4_4_4_4'; + } + return 'Unknown type ' + type; +} + +function runOneIteration(useTexSubImage2D, type, unpackAlignment, flipY, premultiplyAlpha, + topColor, bottomColor, extraColor, bindingTarget, program) +{ + debug('Testing ' + (useTexSubImage2D ? 'texSubImage2D' : 'texImage2D') + + ' with type=' + typeToString(type) + + ', unpackAlignment=' + unpackAlignment + + ', flipY=' + flipY + ', premultiplyAlpha=' + premultiplyAlpha + + ', bindingTarget=' + (bindingTarget == gl.TEXTURE_2D ? 'TEXTURE_2D' : 'TEXTURE_CUBE_MAP')); + gl.colorMask(true, true, true, true); + gl.clearColor(0, 0, 0, 1.0); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + // Enable writes to the RGB channels + gl.colorMask(true, true, true, false); + var texture = gl.createTexture(); + // Bind the texture to texture unit 0 + gl.bindTexture(bindingTarget, texture); + // Set up texture parameters + gl.texParameteri(bindingTarget, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(bindingTarget, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texParameteri(bindingTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(bindingTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + // Set up pixel store parameters + gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, premultiplyAlpha); + // Generate the data + var sourceData = [ 255, 0, 0, 255, + 0, 255, 0, 0 ]; + var texWidth = 5; // this must be mod 4 + 1 to test unpackAlignment + // cube map texture must be square. + if (bindingTarget == gl.TEXTURE_CUBE_MAP) + texWidth = 16; + var texHeight = 16; + var data = generateRGBAData(type, unpackAlignment, sourceData, texWidth, texHeight); + if (gl.getError() != gl.NO_ERROR) + testFailed("GL error before texture upload"); + var targets = [gl.TEXTURE_2D]; + if (bindingTarget == gl.TEXTURE_CUBE_MAP) { + targets = [gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z]; + } + // Upload the image into the texture + for (var tt = 0; tt < targets.length; ++tt) { + if (useTexSubImage2D) { + // Initialize the texture to black first + gl.texImage2D(targets[tt], 0, gl.RGBA, texWidth, texHeight, 0, + gl.RGBA, type, null); + if (gl.getError() != gl.NO_ERROR) + testFailed("GL error after texImage2D(null)"); + gl.texSubImage2D(targets[tt], 0, 0, 0, texWidth, texHeight, gl.RGBA, type, data); + if (gl.getError() != gl.NO_ERROR) + testFailed("GL error after texSubImage2D"); + } else { + gl.texImage2D(targets[tt], 0, gl.RGBA, texWidth, texHeight, 0, gl.RGBA, type, data); + if (gl.getError() != gl.NO_ERROR) + testFailed("GL error after texImage2D"); + } + } + + var testWidth = gl.drawingBufferWidth; + var testHeight = gl.drawingBufferHeight / 2; + + var loc; + if (bindingTarget == gl.TEXTURE_CUBE_MAP) { + loc = gl.getUniformLocation(program, "face"); + } + + for (var tt = 0; tt < targets.length; ++tt) { + if (bindingTarget == gl.TEXTURE_CUBE_MAP) { + gl.uniform1i(loc, targets[tt]); + } + + // Draw the triangles + wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 255]); + + // Check the top pixel and bottom pixel and make sure they have + // the right color. + var rects = [wtu.makeCheckRect(0, 0, testWidth, testHeight, bottomColor, "bottom pixel should be " + bottomColor, 0), + wtu.makeCheckRect(0, testHeight, testWidth, testHeight, topColor, "top pixel should be " + topColor, 0)]; + wtu.checkCanvasRects(gl, rects); + } + + // Change part of the texture. + var partWidth = 16; + var partHeight = 16; + // make texture double res of part. + var data = generateRGBAData(type, unpackAlignment, sourceData, partWidth * 2, partHeight * 2); + for (var tt = 0; tt < targets.length; ++tt) { + gl.texImage2D(targets[tt], 0, gl.RGBA, partWidth * 2, partHeight * 2, 0, gl.RGBA, type, data); + } + // set part. + var extraData = [ + 255, 0, 0, 255, + 0, 0, 255, 0 + ]; + var data = generateRGBAData(type, unpackAlignment, extraData, partWidth, partHeight); + for (var tt = 0; tt < targets.length; ++tt) { + gl.texSubImage2D(targets[tt], 0, 0, 0, partWidth, partHeight, gl.RGBA, type, data); + } + var halfWidth = gl.drawingBufferWidth / 2; + var halfHeight = gl.drawingBufferHeight / 2; + var quarterHeight = gl.drawingBufferHeight / 4; + var red = [255, 0, 0, 255]; + var tcolor0 = flipY ? extraColor : red; + var tcolor1 = flipY ? red : extraColor; + + for (var tt = 0; tt < targets.length; ++tt) { + if (bindingTarget == gl.TEXTURE_CUBE_MAP) { + gl.uniform1i(loc, targets[tt]); + } + + wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 255]); + wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 255]); + var rects = [wtu.makeCheckRect(0, 0, halfWidth, quarterHeight, tcolor0, "bottom left bottom pixels should be " + tcolor0, 0), + wtu.makeCheckRect(0, quarterHeight, halfWidth, quarterHeight, tcolor1, "bottom left top pixels should be " + tcolor1, 0), + wtu.makeCheckRect(halfWidth, 0, halfWidth, halfHeight, bottomColor, "bottom right pixels should be " + bottomColor, 0), + wtu.makeCheckRect(0, halfHeight, testWidth, halfHeight, topColor, "top pixels should be " + topColor, 0)]; + wtu.checkCanvasRects(gl, rects); + } + + // set far corner. + for (var tt = 0; tt < targets.length; ++tt) { + gl.texSubImage2D(targets[tt], 0, partWidth, partHeight, partWidth, partHeight, gl.RGBA, type, data); + } + for (var tt = 0; tt < targets.length; ++tt) { + if (bindingTarget == gl.TEXTURE_CUBE_MAP) { + gl.uniform1i(loc, targets[tt]); + } + + wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 255]); + var rects = [wtu.makeCheckRect(0, 0, halfWidth, quarterHeight, tcolor0, "bottom left bottom pixels should be " + tcolor0, 0), + wtu.makeCheckRect(0, quarterHeight, halfWidth, quarterHeight, tcolor1, "bottom left top pixels should be " + tcolor1, 0), + wtu.makeCheckRect(halfWidth, 0, halfWidth, halfHeight, bottomColor, "bottom left pixels should be " + bottomColor, 0), + wtu.makeCheckRect(0, halfHeight, halfWidth, halfHeight, topColor, "top right pixels should be " + topColor, 0), + wtu.makeCheckRect(halfWidth, halfHeight, halfWidth, quarterHeight, tcolor0, "top right bottom pixels should be " + tcolor0, 0), + wtu.makeCheckRect(halfWidth, halfHeight + quarterHeight, halfWidth, quarterHeight, tcolor1, "top right top pixels should be " + tcolor1, 0)]; + wtu.checkCanvasRects(gl, rects); + } +} + +function runTest(bindingTarget, program) +{ + var red = [255, 0, 0, 255]; + var green = [0, 255, 0, 255]; + var blue = [0, 0, 255, 255]; + var redPremultiplyAlpha = [255, 0, 0, 255]; + var greenPremultiplyAlpha = [0, 0, 0, 255]; + var bluePremultiplyAlpha = [0, 0, 0, 255]; + + var types = [ gl.UNSIGNED_BYTE, gl.UNSIGNED_SHORT_5_5_5_1, gl.UNSIGNED_SHORT_4_4_4_4 ]; + var unpackAlignments = [ 1, 2, 4, 8 ]; + + var cases = [ + { sub: false, flipY: true, premultiplyAlpha: false, topColor: red, bottomColor: green, extraColor: blue }, + { sub: false, flipY: false, premultiplyAlpha: false, topColor: green, bottomColor: red, extraColor: blue }, + { sub: false, flipY: true, premultiplyAlpha: true, topColor: redPremultiplyAlpha, bottomColor: greenPremultiplyAlpha, extraColor: bluePremultiplyAlpha }, + { sub: false, flipY: false, premultiplyAlpha: true, topColor: greenPremultiplyAlpha, bottomColor: redPremultiplyAlpha, extraColor: bluePremultiplyAlpha }, + { sub: true, flipY: true, premultiplyAlpha: false, topColor: red, bottomColor: green, extraColor: blue }, + { sub: true, flipY: false, premultiplyAlpha: false, topColor: green, bottomColor: red, extraColor: blue }, + { sub: true, flipY: true, premultiplyAlpha: true, topColor: redPremultiplyAlpha, bottomColor: greenPremultiplyAlpha, extraColor: bluePremultiplyAlpha }, + { sub: true, flipY: false, premultiplyAlpha: true, topColor: greenPremultiplyAlpha, bottomColor: redPremultiplyAlpha, extraColor: bluePremultiplyAlpha }, + ]; + + for (var i in types) { + for (var j in unpackAlignments) { + for (var k in cases) { + runOneIteration(cases[k].sub, types[i], unpackAlignments[j], cases[k].flipY, cases[k].premultiplyAlpha, + cases[k].topColor, cases[k].bottomColor, cases[k].extraColor, bindingTarget, program); + } + } + } + +} + +var gl = wtu.create3DContext("example"); + +var program = wtu.setupTexturedQuad(gl); +runTest(gl.TEXTURE_2D, program); +program = wtu.setupTexturedQuadWithCubeMap(gl); +runTest(gl.TEXTURE_CUBE_MAP, program); + +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be no errors"); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-and-uniform-binding-bugs.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-and-uniform-binding-bugs.html new file mode 100644 index 000000000..be836e2dc --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-and-uniform-binding-bugs.html @@ -0,0 +1,63 @@ +<!-- +/* +** Copyright (c) 2012 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"> +<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> +<div id="description"></div> +<div id="console"></div> + +<script> +"use strict"; + +description('Tests passing a vec4 to a uniform and a canvas to texImage2D'); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext(); +var floatProgram = wtu.loadProgramFromFile(gl, "../../../resources/floatUniformShader.vert", "../../../resources/noopUniformShader.frag"); +shouldBeUndefined("gl.useProgram(floatProgram)"); +var fval4Loc = gl.getUniformLocation(floatProgram, "fval4"); +wtu.glErrorShouldBe(gl, gl.NO_ERROR); +shouldBeUndefined("gl.uniform4fv(fval4Loc, new Float32Array([0.1, 0.2, 0.4, 1.0]));"); + +var tmpcanvas = document.createElement("canvas"); +tmpcanvas.width = 2; +tmpcanvas.height = 2; +var texture = gl.createTexture(); +shouldBeUndefined("gl.bindTexture(gl.TEXTURE_2D, texture)"); +shouldBeUndefined("gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, tmpcanvas)"); + +var successfullyParsed = true; + +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-canvas-corruption.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-canvas-corruption.html new file mode 100644 index 000000000..1976c53b5 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-canvas-corruption.html @@ -0,0 +1,72 @@ +<!-- + +/* +** Copyright (c) 2014 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>Testing 3D canvas is usable after being used as texImage2D source</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="example" width="512" height="512"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +// Regression test for http://crbug.com/368582 +description(); +var wtu = WebGLTestUtils; +var canvas = document.getElementById("example"); +var ctx = canvas.getContext("2d"); + +var gl = wtu.create3DContext(); +var texture = gl.createTexture(); + +var image = wtu.makeImage('../../../resources/blue-1x1.jpg', function() { + renderToCanvas(); + renderToCanvas(); + wtu.checkCanvas(ctx, [0, 0, 255, 255], "All pixels should be blue", 2); + finishTest(); +}); + +function renderToCanvas() { + // Clear the 2d canvas then draw the image to it (a blue pixel) + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.drawImage(image, 0, 0, canvas.width, canvas.height); + + // Upload the results to a WebGL texture + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas); +} + +var successfullyParsed = true; +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-webgl.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-webgl.html new file mode 100644 index 000000000..829e14af6 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-webgl.html @@ -0,0 +1,99 @@ +<!-- + +/* +** Copyright (c) 2012 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 texImage2D from WebGL conformance 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="example" width="256" height="16" style="width: 256px; height: 48px;"></canvas> +<canvas id="source" width="256" height="16" style="width: 256px; height: 48px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description("Test texImage2D from a webgl canvas."); +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("example"); +gl.disable(gl.DITHER); +var program = wtu.setupTexturedQuad(gl); +var gl1 = wtu.create3DContext("source"); +gl1.disable(gl.DITHER); +gl1.disable(gl.BLEND); +gl1.disable(gl.DEPTH_TEST); + +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); +wtu.glErrorShouldBe(gl1, gl1.NO_ERROR, "Should be no errors from setup."); + +gl.disable(gl.BLEND); +gl.disable(gl.DEPTH_TEST); + +gl1.clearColor(1.0, 0.0, 0.0, 1.0); +gl1.clear(gl1.COLOR_BUFFER_BIT); + +var tex = gl.createTexture(); +gl.bindTexture(gl.TEXTURE_2D, tex); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, gl1.canvas); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); +wtu.clearAndDrawUnitQuad(gl); + +wtu.checkCanvas(gl, [255, 0, 0, 255], "Canvas should be red"); + +gl1.clearColor(0.0, 1.0, 0.0, 1.0); +gl1.clear(gl1.COLOR_BUFFER_BIT); + +var program1 = wtu.setupTexturedQuad(gl1); +var tex1 = gl1.createTexture(); +gl1.bindTexture(gl.TEXTURE_2D, tex1); +gl1.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 255])); + +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, gl1.canvas); +wtu.clearAndDrawUnitQuad(gl); + +wtu.checkCanvas(gl, [0, 255, 0, 255], "Canvas should be green"); + +// Test a scenario from Chrome where a WebGL context would lose its active texture binding when its +// canvas was used as the texture source for another WebGL context. +wtu.clearAndDrawUnitQuad(gl1); + +wtu.checkCanvas(gl1, [0, 0, 255, 255], "Canvas should be blue"); + +debug(""); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-with-format-and-type.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-with-format-and-type.html new file mode 100644 index 000000000..af4cf4fbd --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-with-format-and-type.html @@ -0,0 +1,743 @@ +<!-- + +/* +** Copyright (c) 2012 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"> +<link rel="stylesheet" href="../../../resources/js-test-style.css"/> +<script src="../../../js/js-test-pre.js"></script> +<script src="../../../js/pnglib.js"></script> +<script src="../../../js/webgl-test-utils.js"></script> + +<script> +"use strict"; +var wtu = WebGLTestUtils; +var gl = null; +var textureLoc = null; +var successfullyParsed = false; + +//---------------------------------------------------------------------- +// Harness + +var testCases = []; + +var DataMode = { + IMAGE: 0, + IMAGE_DATA: 1, + + NUM_HTML_MODES: 2, + + RAW_DATA: 2, + + // This must remain the last mode. + NUM_MODES: 3 +}; + +function init() +{ + description('Verify texImage2D and texSubImage2D code paths taking both HTML and user-specified data with all format/type combinations'); + + var canvas = document.getElementById("example"); + gl = wtu.create3DContext(canvas); + gl.disable(gl.DITHER); + var program = wtu.setupTexturedQuad(gl); + + gl.clearColor(0,0,0,1); + gl.clearDepth(1); + gl.disable(gl.BLEND); + + textureLoc = gl.getUniformLocation(program, "tex"); + + initializeTests(); +} + +function initializeTests() +{ + // Verify that uploading to packed pixel formats performs the + // required conversion and associated loss of precision. + for (var dataMode = 0; dataMode < DataMode.NUM_HTML_MODES; ++dataMode) { + for (var useTexSubImage2D = 0; useTexSubImage2D < 2; ++useTexSubImage2D) { + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateOpaqueGrayscaleRamp, + premultiplyAlpha: false, + format: gl.RGBA, + type: gl.UNSIGNED_BYTE, + verifier: allChannelsIncreaseByNoMoreThan, + threshold: 1, + numOccurrences: 1, + description: "RGBA/UNSIGNED_BYTE should maintain full precision of data" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateOpaqueGrayscaleRamp, + premultiplyAlpha: false, + format: gl.RGBA, + type: gl.UNSIGNED_SHORT_4_4_4_4, + verifier: allChannelsIncreaseByAtLeast, + threshold: 15, + numOccurrences: 10, + description: "RGBA/UNSIGNED_SHORT_4_4_4_4 must drop low four bits of precision" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateOpaqueGrayscaleRamp, + premultiplyAlpha: false, + format: gl.RGBA, + type: gl.UNSIGNED_SHORT_5_5_5_1, + verifier: allChannelsIncreaseByAtLeast, + threshold: 7, + numOccurrences: 20, + description: "RGBA/UNSIGNED_SHORT_5_5_5_1 must drop low three bits of precision" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateOpaqueGrayscaleRamp, + premultiplyAlpha: false, + format: gl.RGB, + type: gl.UNSIGNED_BYTE, + verifier: allChannelsIncreaseByNoMoreThan, + threshold: 1, + numOccurrences: 1, + description: "RGB/UNSIGNED_BYTE should maintain full precision of data" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateOpaqueGrayscaleRamp, + premultiplyAlpha: false, + format: gl.RGB, + type: gl.UNSIGNED_SHORT_5_6_5, + verifier: allChannelsIncreaseByAtLeast, + threshold: 3, + numOccurrences: 20, + description: "RGB/UNSIGNED_SHORT_5_6_5 must drop low two or three bits of precision" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateTranslucentGrayscaleRamp, + premultiplyAlpha: false, + format: gl.ALPHA, + type: gl.UNSIGNED_BYTE, + verifier: alphaChannelIncreasesByNoMoreThan, + threshold: 1, + numOccurrences: 1, + description: "ALPHA/UNSIGNED_BYTE should maintain full precision of data" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateOpaqueGrayscaleRamp, + premultiplyAlpha: false, + format: gl.LUMINANCE, + type: gl.UNSIGNED_BYTE, + verifier: allChannelsIncreaseByNoMoreThan, + threshold: 1, + numOccurrences: 1, + description: "LUMINANCE/UNSIGNED_BYTE should maintain full precision of data" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateOpaqueGrayscaleRamp, + premultiplyAlpha: false, + format: gl.LUMINANCE_ALPHA, + type: gl.UNSIGNED_BYTE, + verifier: allChannelsIncreaseByNoMoreThan, + threshold: 1, + numOccurrences: 1, + description: "LUMINANCE_ALPHA/UNSIGNED_BYTE should maintain full precision of data" + }); + } + } + + // Verify that setting the UNPACK_PREMULTIPLY_ALPHA_WEBGL pixel + // store parameter and sending down a zero alpha causes the color + // channels to go to zero. + for (var dataMode = 0; dataMode < DataMode.NUM_MODES; ++dataMode) { + for (var useTexSubImage2D = 0; useTexSubImage2D < 2; ++useTexSubImage2D) { + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateTransparentGrayscaleRamp, + premultiplyAlpha: true, + format: gl.RGBA, + type: gl.UNSIGNED_BYTE, + verifier: colorChannelsAreZero, + description: "UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGBA/UNSIGNED_BYTE" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateTransparentGrayscaleRamp, + premultiplyAlpha: true, + format: gl.RGBA, + type: gl.UNSIGNED_SHORT_4_4_4_4, + verifier: colorChannelsAreZero, + description: "UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGBA/UNSIGNED_SHORT_4_4_4_4" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateTransparentGrayscaleRamp, + premultiplyAlpha: true, + format: gl.RGBA, + type: gl.UNSIGNED_SHORT_5_5_5_1, + verifier: colorChannelsAreZero, + description: "UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGBA/UNSIGNED_SHORT_5_5_5_1" + }); + // The following few tests are invalid for the raw data + // mode because there is either no alpha channel or no + // separate alpha channel. + if (dataMode != DataMode.RAW_DATA) { + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateTransparentGrayscaleRamp, + premultiplyAlpha: true, + format: gl.RGB, + type: gl.UNSIGNED_BYTE, + verifier: colorChannelsAreZero, + description: "UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGB/UNSIGNED_BYTE" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateTransparentGrayscaleRamp, + premultiplyAlpha: true, + format: gl.RGB, + type: gl.UNSIGNED_SHORT_5_6_5, + verifier: colorChannelsAreZero, + description: "UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGB/UNSIGNED_SHORT_5_6_5" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateTransparentGrayscaleRamp, + premultiplyAlpha: true, + format: gl.ALPHA, + type: gl.UNSIGNED_BYTE, + verifier: colorChannelsAreZero, + description: "UNPACK_PREMULTIPLY_ALPHA_WEBGL with ALPHA/UNSIGNED_BYTE" + }); + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateTransparentGrayscaleRamp, + premultiplyAlpha: true, + format: gl.LUMINANCE, + type: gl.UNSIGNED_BYTE, + verifier: colorChannelsAreZero, + description: "UNPACK_PREMULTIPLY_ALPHA_WEBGL with LUMINANCE/UNSIGNED_BYTE" + }); + } + testCases.push({ + dataMode: dataMode, + useTexSubImage2D: !!useTexSubImage2D, + width: 256, + height: 1, + generator: generateTransparentGrayscaleRamp, + premultiplyAlpha: true, + format: gl.LUMINANCE_ALPHA, + type: gl.UNSIGNED_BYTE, + verifier: colorChannelsAreZero, + description: "UNPACK_PREMULTIPLY_ALPHA_WEBGL with LUMINANCE_ALPHA/UNSIGNED_BYTE" + }); + } + } + + // Produce data for all testcases. Because we load images, some of + // these may generate their data asynchronously. + generateTestData(); +} + +function generateTestData() +{ + for (var i = 0; i < testCases.length; i++) { + var testCase = testCases[i]; + var wrapper = null; + switch (testCase.dataMode) { + case DataMode.IMAGE: + wrapper = new ImageWrapper(testCase.width, testCase.height); + break; + case DataMode.IMAGE_DATA: + wrapper = new ImageDataWrapper(testCase.width, testCase.height); + break; + case DataMode.RAW_DATA: + switch (testCase.type) { + case gl.UNSIGNED_BYTE: + switch (testCase.format) { + case gl.RGBA: + wrapper = new RGBA8DataWrapper(testCase.width, testCase.height); + break; + case gl.RGB: + wrapper = new RGB8DataWrapper(testCase.width, testCase.height); + break; + case gl.ALPHA: + wrapper = new A8DataWrapper(testCase.width, testCase.height); + break; + case gl.LUMINANCE: + wrapper = new L8DataWrapper(testCase.width, testCase.height); + break; + case gl.LUMINANCE_ALPHA: + wrapper = new LA8DataWrapper(testCase.width, testCase.height); + break; + } + break; + case gl.UNSIGNED_SHORT_4_4_4_4: + wrapper = new RGBA4444DataWrapper(testCase.width, testCase.height); + break; + case gl.UNSIGNED_SHORT_5_5_5_1: + wrapper = new RGBA5551DataWrapper(testCase.width, testCase.height); + break; + case gl.UNSIGNED_SHORT_5_6_5: + wrapper = new RGB565DataWrapper(testCase.width, testCase.height); + break; + } + } + testCase.wrapper = wrapper; + testCase.generator(wrapper); + testCase.wrapper.generateData(); + } + + // See whether we need to run the tests, in case all of them + // generated their results synchronously. + maybeRunTests(); +} + +var ranTests = false; + +function maybeRunTests() +{ + if (!ranTests) + for (var i = 0; i < testCases.length; ++i) + if (!testCases[i].wrapper || !testCases[i].wrapper.data) + return; + + ranTests = true; + + for (var i = 0; i < testCases.length; ++i) + runOneTest(testCases[i]); + + finishTest(); +} + +function testCaseToString(testCase) +{ + var mode; + switch (testCase.dataMode) { + case DataMode.IMAGE: + mode = "Image"; + break; + case DataMode.IMAGE_DATA: + mode = "ImageData"; + break; + case DataMode.RAW_DATA: + mode = "raw data"; + break; + } + return (testCase.useTexSubImage2D ? "texSubImage2D" : "texImage2D") + + " with " + mode + " at " + testCase.width + "x" + testCase.height; +} + +function runOneTest(testCase) +{ + debug("Testing " + testCaseToString(testCase)); + var data = testCase.wrapper.data; + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + var texture = gl.createTexture(); + // Bind the texture to texture unit 0. + gl.bindTexture(gl.TEXTURE_2D, texture); + // Set up texture parameters. + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + // Set up pixel store parameters. + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, testCase.premultiplyAlpha); + // Upload the image into the texture. + if (testCase.useTexSubImage2D) { + // Initialize the texture to black first. + gl.texImage2D(gl.TEXTURE_2D, 0, testCase.format, testCase.width, testCase.height, 0, + testCase.format, testCase.type, null); + } + switch (testCase.dataMode) { + case DataMode.IMAGE: + case DataMode.IMAGE_DATA: + if (testCase.useTexSubImage2D) + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, testCase.format, testCase.type, data); + else + gl.texImage2D(gl.TEXTURE_2D, 0, testCase.format, testCase.format, testCase.type, data); + break; + case DataMode.RAW_DATA: + if (testCase.useTexSubImage2D) + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, testCase.width, testCase.height, testCase.format, testCase.type, data); + else + gl.texImage2D(gl.TEXTURE_2D, 0, testCase.format, testCase.width, testCase.height, 0, testCase.format, testCase.type, data); + break; + } + // Point the uniform sampler to texture unit 0. + gl.uniform1i(textureLoc, 0); + // Draw the triangles. + gl.drawArrays(gl.TRIANGLES, 0, 6); + // Clean up the texture. + gl.deleteTexture(texture); + + // Read back the rendering results. + var buf = new Uint8Array(testCase.width * testCase.height * 4); + gl.readPixels(0, 0, testCase.width, testCase.height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + // Run the verification routine. + if (testCase.verifier(buf, testCase.threshold, testCase.numOccurrences)) + testPassed(testCase.description); + else + testFailed(testCase.description); +} + +//---------------------------------------------------------------------- +// Wrappers for programmatic construction of Image, ImageData and raw texture data +// + +function ImageWrapper(width, height) +{ + this.pngBuilder_ = new PNGlib(width, height, 256); +} + +ImageWrapper.prototype.getWidth = function() { + return this.pngBuilder_.width; +}; + +ImageWrapper.prototype.getHeight = function() { + return this.pngBuilder_.height; +}; + +ImageWrapper.prototype.setPixel = function(x, y, r, g, b, a) { + this.pngBuilder_.buffer[this.pngBuilder_.index(x, y)] = this.pngBuilder_.color(r, g, b, a); +}; + +// Generates data into "data" property, possibly asynchronously. +ImageWrapper.prototype.generateData = function() { + var that = this; + var url = "data:image/png;base64," + this.pngBuilder_.getBase64(); + var img = wtu.makeImage(url, function() { + that.data = img; + maybeRunTests(); + }); +}; + +function ImageDataWrapper(width, height) +{ + if (!ImageDataWrapper.tempCanvas) { + ImageDataWrapper.tempCanvas = document.createElement("canvas"); + } + this.imageData_ = ImageDataWrapper.tempCanvas.getContext("2d").createImageData(width, height); +} + +ImageDataWrapper.tempCanvas = null; + +ImageDataWrapper.prototype.getWidth = function() { + return this.imageData_.width; +}; + +ImageDataWrapper.prototype.getHeight = function() { + return this.imageData_.height; +}; + +ImageDataWrapper.prototype.setPixel = function(x, y, r, g, b, a) { + var index = 4 * (this.imageData_.width * y + x); + this.imageData_.data[index] = r; + this.imageData_.data[index + 1] = g; + this.imageData_.data[index + 2] = b; + this.imageData_.data[index + 3] = a; +}; + +ImageDataWrapper.prototype.generateData = function() { + this.data = this.imageData_; + maybeRunTests(); +}; + +function TextureDataWrapper(width, height) +{ + this.width_ = width; + this.height_ = height; +} + +TextureDataWrapper.prototype.getWidth = function() { + return this.width_; +}; + +TextureDataWrapper.prototype.getHeight = function() { + return this.height_; +}; + +TextureDataWrapper.prototype.generateData = function() { + this.data = this.data_; + maybeRunTests(); +}; + +function RGBA8DataWrapper(width, height) +{ + TextureDataWrapper.call(this, width, height); + this.data_ = new Uint8Array(4 * width * height); +} + +RGBA8DataWrapper.prototype = new TextureDataWrapper; + +RGBA8DataWrapper.prototype.setPixel = function(x, y, r, g, b, a) { + var index = 4 * (this.width_ * y + x); + this.data_[index] = r; + this.data_[index + 1] = g; + this.data_[index + 2] = b; + this.data_[index + 3] = a; +}; + +function RGBA5551DataWrapper(width, height) +{ + TextureDataWrapper.call(this, width, height); + this.data_ = new Uint16Array(width * height); +} + +RGBA5551DataWrapper.prototype = new TextureDataWrapper; + +RGBA5551DataWrapper.prototype.setPixel = function(x, y, r, g, b, a) { + var value = (((r & 0xF8) << 8) + | ((g & 0xF8) << 3) + | ((b & 0xF8) >> 2) + | (a >> 7)); + this.data_[this.width_ * y + x] = value; +}; + +function RGBA4444DataWrapper(width, height) +{ + TextureDataWrapper.call(this, width, height); + this.data_ = new Uint16Array(width * height); +} + +RGBA4444DataWrapper.prototype = new TextureDataWrapper; + +RGBA4444DataWrapper.prototype.setPixel = function(x, y, r, g, b, a) { + var value = (((r & 0xF0) << 8) + | ((g & 0xF0) << 4) + | (b & 0xF0) + | (a >> 4)); + this.data_[this.width_ * y + x] = value; +}; + +function RGB8DataWrapper(width, height) +{ + TextureDataWrapper.call(this, width, height); + this.data_ = new Uint8Array(3 * width * height); +} + +RGB8DataWrapper.prototype = new TextureDataWrapper; + +RGB8DataWrapper.prototype.setPixel = function(x, y, r, g, b, a) { + var index = 3 * (this.width_ * y + x); + this.data_[index] = r; + this.data_[index + 1] = g; + this.data_[index + 2] = b; +}; + +function RGB565DataWrapper(width, height) +{ + TextureDataWrapper.call(this, width, height); + this.data_ = new Uint16Array(width * height); +} + +RGB565DataWrapper.prototype = new TextureDataWrapper; + +RGB565DataWrapper.prototype.setPixel = function(x, y, r, g, b, a) { + var value = (((r & 0xF8) << 8) + | ((g & 0xFC) << 3) + | ((b & 0xF8) >> 3)); + this.data_[this.width_ * y + x] = value; +}; + +function A8DataWrapper(width, height) +{ + TextureDataWrapper.call(this, width, height); + this.data_ = new Uint8Array(width * height); +} + +A8DataWrapper.prototype = new TextureDataWrapper; + +A8DataWrapper.prototype.setPixel = function(x, y, r, g, b, a) { + this.data_[this.width_ * y + x] = a; +}; + +function L8DataWrapper(width, height) +{ + TextureDataWrapper.call(this, width, height); + this.data_ = new Uint8Array(width * height); +} + +L8DataWrapper.prototype = new TextureDataWrapper; + +L8DataWrapper.prototype.setPixel = function(x, y, r, g, b, a) { + this.data_[this.width_ * y + x] = r; +}; + +function LA8DataWrapper(width, height) +{ + TextureDataWrapper.call(this, width, height); + this.data_ = new Uint8Array(2 * width * height); +} + +LA8DataWrapper.prototype = new TextureDataWrapper; + +LA8DataWrapper.prototype.setPixel = function(x, y, r, g, b, a) { + var index = 2 * (this.width_ * y + x); + this.data_[index] = r; + this.data_[index + 1] = a; +}; + +//---------------------------------------------------------------------- +// Color ramp generation functions +// + +function generateOpaqueGrayscaleRamp(wrapper) +{ + var width = wrapper.getWidth(); + var height = wrapper.getHeight(); + for (var x = 0; x < width; ++x) { + var value = Math.round(255.0 * x / width); + for (var y = 0; y < height; ++y) + wrapper.setPixel(x, y, value, value, value, 255); + } +} + +function generateTranslucentGrayscaleRamp(wrapper) +{ + var width = wrapper.getWidth(); + var height = wrapper.getHeight(); + for (var x = 0; x < width; ++x) { + var value = Math.round(255.0 * x / width); + for (var y = 0; y < height; ++y) + wrapper.setPixel(x, y, value, value, value, value); + } +} + +function generateTransparentGrayscaleRamp(wrapper) +{ + var width = wrapper.getWidth(); + var height = wrapper.getHeight(); + for (var x = 0; x < width; ++x) { + var value = Math.round(255.0 * x / width); + for (var y = 0; y < height; ++y) + wrapper.setPixel(x, y, value, value, value, 0); + } +} + +//---------------------------------------------------------------------- +// Verification routines +// + +function allChannelsIncreaseByNoMoreThan(array, threshold, numOccurrences) { + var numFound = 0; + for (var i = 4; i < array.length; i += 4) + for (var j = 0; j < 4; j++) + if (array[i + j] - array[i + j - 4] > threshold) + ++numFound; + + return numFound < numOccurrences; +} + +function alphaChannelIncreasesByNoMoreThan(array, threshold, numOccurrences) { + var numFound = 0; + for (var i = 7; i < array.length; i += 4) + if (array[i] - array[i - 4] > threshold) + ++numFound; + + return numFound < numOccurrences; +} + +function allChannelsIncreaseByAtLeast(array, threshold, numOccurrences) { + var numFound = 0; + for (var i = 4; i < array.length; i += 4) + for (var j = 0; j < 4; ++j) + if (array[i + j] - array[i + j - 4] > threshold) + ++numFound; + + return numFound > numOccurrences; +} + +function colorChannelsAreZero(array, threshold, numOccurrences) { + var passed = true; + var numFailures = 0; + + for (var i = 4; i < array.length; i += 4) + for (var j = 0; j < 3; ++j) + if (array[i + j] != 0) { + passed = false; + if (++numFailures <= 5) + debug(" array[" + (i + j) + "] should have been 0, was " + array[i + j]); + } + + return passed; +} + +</script> +</head> +<body onload="init()"> +<canvas id="example" width="256" height="1"></canvas> +<div id="description"></div> +<div id="console"></div> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-with-invalid-data.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-with-invalid-data.html new file mode 100644 index 000000000..af8dcef6c --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-image-with-invalid-data.html @@ -0,0 +1,179 @@ +<!-- + +/* +** Copyright (c) 2012 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>texImage2D and texSubImage2D tests with invalid data</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> +<div id="description"></div> +<div id="console"></div> +<canvas id="canvas" width="2" height="2"> </canvas> +<script type="application/javascript"> +description("texImage2D and texSubImage2D tests with invalid data"); + +var wtu = WebGLTestUtils; +var canvas = document.getElementById("canvas"); +var contextVersion = wtu.getDefault3DContextVersion(); +var gl = wtu.create3DContext(canvas); +if (!gl) + testFailed("Context created."); +else + testPassed("Context created."); + +var tex; + +function setup() { + tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); +} + +function teardown() { + gl.deleteTexture(tex); +} + +function test(desc, func, expected) { + debug(desc); + + var exc = null; + try { + func(); + } catch (x) { + exc = x; + } + + if (expected == gl.INVALID_OPERATION) { + wtu.glErrorShouldBe(gl, expected); + } else if (expected == "exception") { + if (exc) { + testPassed("threw exception"); + } else { + testFailed("did not throw exception"); + } + } +} + +test("Calling texImage2D with no WebGLTexture bound generates INVALID_OPERATION", + function () { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + }, + gl.INVALID_OPERATION); + +test("Calling texSubImage2D with no WebGLTexture bound generates INVALID_OPERATION", + function () { + var buffer = new Uint8Array(4); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buffer); + }, + gl.INVALID_OPERATION); + +setup(); + +test("Passing a buffer not large enough to texImage2D should generate an INVALID_OPERATION", + function () { + var tooSmall = new Uint8Array(64); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, tooSmall); + }, + gl.INVALID_OPERATION); + +if (contextVersion < 2) { + test("Passing texImage2D parameter data of Number type should throw an exception", + function () { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, 42); + }, + "exception"); +} else { + test("Passing texImage2D parameter data of Number type should generate an INVALID_OPERATION", + function () { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, 42); + }, + gl.INVALID_OPERATION); +} + +if (contextVersion < 2) { + test("Passing texImage2D parameter data of String type should throw a TypeError", + function () { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, "not a buffer"); + }, + "exception"); +} else { + test("Passing texImage2D parameter data of String type should generate an INVALID_OPERATION", + function () { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, "not a buffer"); + }, + gl.INVALID_OPERATION); +} + +test("Passing a buffer not large enough to texSubImage2D should generate an INVALID_OPERATION", + function () { + var tooSmall = new Uint8Array(64); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE, tooSmall); + }, + gl.INVALID_OPERATION); + +if (contextVersion < 2) { + test("Passing texSubImage2D parameter data of Number type should throw a TypeError", + function () { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE, 42); + }, + "exception"); +} else { + test("Passing texSubImage2D parameter data of Number type should generate an INVALID_OPERATION", + function () { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE, 42); + }, + gl.INVALID_OPERATION); +} + +if (contextVersion < 2) { + test("Passing texSubImage2D parameter data of String type should throw a TypeError", + function () { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE, "not a buffer"); + }, + "exception"); +} else { + test("Passing texSubImage2D parameter data of String type should generate an INVALID_OPERATION", + function () { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE, "not a buffer"); + }, + gl.INVALID_OPERATION); +} + +teardown(); + +debug(""); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-input-validation.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-input-validation.html new file mode 100644 index 000000000..451813848 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-input-validation.html @@ -0,0 +1,45 @@ +<!-- + +/* +** Copyright (c) 2012 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"> +<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> +<div id="description"></div> +<div id="console"></div> +<script> +var contextVersion = 1; +</script> +<script src="../../../js/tests/tex-input-validation.js"></script> +<script src="../../../js/js-test-post.js"></script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-sub-image-2d-bad-args.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-sub-image-2d-bad-args.html new file mode 100644 index 000000000..6eebc4b4c --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-sub-image-2d-bad-args.html @@ -0,0 +1,154 @@ +<!-- + +/* +** Copyright (c) 2012 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"> +<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="testbed" width="16" height="16"></canvas> +<canvas id="c" width="16" height="16"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description('Tests texSubImage2D with bad arguments'); + +var wtu = WebGLTestUtils; +var contextVersion = wtu.getDefault3DContextVersion(); +var c = document.getElementById("c"); + +var gl = wtu.create3DContext("testbed"); +var tex = gl.createTexture(); +var maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); +var maxTextureLevel = Math.floor(Math.log2(maxTextureSize)) + 1; + +gl.bindTexture(gl.TEXTURE_2D, tex); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 1, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "no previously defined texture image"); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Setup should succeed"); + +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 1, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "y + height > texture height"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "x + width > texture width"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "negative x"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, -1, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "negative y"); +gl.texSubImage2D(gl.TEXTURE_2D, -1, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "negative level"); +shouldThrow("gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, null)"); +wtu.glErrorShouldBe(gl, gl.NO_ERROR); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); +wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "null pixels"); + +// GL_INVALID_VALUE may be generated if level is greater than log 2 max, where max is the returned value of GL_MAX_TEXTURE_SIZE. +// GL_INVALID_OPERATION is generated if the texture array has not been defined by a previous glTexImage2D or glCopyTexImage2D operation whose internalformat matches the format of glTexSubImage2D. +gl.texSubImage2D(gl.TEXTURE_2D, maxTextureLevel + 1, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, [gl.INVALID_VALUE, gl.INVALID_OPERATION], "too high level"); + +gl.texSubImage2D(gl.FLOAT, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "bad target"); +if (contextVersion > 1) { + gl.texSubImage2D(gl.TEXTURE_3D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); + wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "bad target"); +} +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "good args"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original"); +if (contextVersion < 2) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original"); +} +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "make texture RGB"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "format same as original RGB"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original RGB"); +if (contextVersion < 2) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGB, gl.UNSIGNED_SHORT_5_6_5, c); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original RGB"); +} +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "make texture RGBA UNSIGNED_BYTE"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "format same as original"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original"); +if (contextVersion < 2) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original"); +} + +// Large canvas will trigger GPU-to-GPU fast path in chrome, +// while small canvas will go into normal path, i.e. read pixles from canvas then upload to texture. +var largeCanvas = document.createElement("canvas"); +largeCanvas.width = 257; +largeCanvas.height = 257; +var largeCanvasContext = largeCanvas.getContext("2d"); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, largeCanvas); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "make texture RGBA UNSIGNED_BYTE"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "format same as original"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, c); +wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original"); +if (contextVersion < 2) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original"); +} +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, largeCanvas); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "format same as original"); +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, largeCanvas); +wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original"); +if (contextVersion < 2) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, largeCanvas); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original"); +} + +var maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE); +var maxCubeMapTextureLevel = Math.floor(Math.log2(maxCubeMapTextureSize)) + 1; +for (var f = 0; f < 6; f++) { + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex); + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, c); + gl.texSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, maxCubeMapTextureLevel + 1, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, c); + wtu.glErrorShouldBe(gl, [gl.INVALID_VALUE, gl.INVALID_OPERATION], "too high level"); + gl.deleteTexture(tex); +} + +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-sub-image-2d.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-sub-image-2d.html new file mode 100644 index 000000000..294663cc7 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/tex-sub-image-2d.html @@ -0,0 +1,122 @@ +<!-- + +/* +** Copyright (c) 2012 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"> +<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> +<script id="fshader" type="x-shader/x-fragment"> +precision mediump float; + +uniform sampler2D tex; +varying vec2 texCoord; + +void main() +{ + float intensity = texture2D(tex, texCoord).a; + gl_FragColor = vec4(intensity, intensity, intensity, 1.0); +} +</script> + +</head> +<body> +<canvas id="example" width="256" height="1"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description('Tests texSubImage2D upload path from Uint8Array'); + +var wtu = WebGLTestUtils; +var canvas = document.getElementById("example"); +var gl = wtu.create3DContext(canvas); +gl.disable(gl.DITHER); +var program = wtu.setupProgram( + gl, + [wtu.simpleTextureVertexShader, "fshader"], + ['vPosition', 'texCoord0']); +wtu.setupUnitQuad(gl); +var textureWidth = 256; +var textureHeight = 1; + +var textureLoc = gl.getUniformLocation(program, "tex"); + +var texture = gl.createTexture(); +gl.bindTexture(gl.TEXTURE_2D, texture); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); +// Allocate the texture object +gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, textureWidth, textureHeight, 0, gl.ALPHA, gl.UNSIGNED_BYTE, null); +// Prepare the image data +var array = new Uint8Array(textureWidth); +for (var i = 0; i < textureWidth; i++) + array[i] = i; +// Fill the texture object with data -- this is actually the code path being tested +gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.ALPHA, gl.UNSIGNED_BYTE, array); + +// Clear and set up +gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); +gl.bindTexture(gl.TEXTURE_2D, texture); +gl.useProgram(program); +gl.uniform1i(textureLoc, 0); +// Draw the texture to the frame buffer +gl.drawArrays(gl.TRIANGLES, 0, 6); + +// Read back the frame buffer +var buf = new Uint8Array(textureWidth * textureHeight * 4); +gl.readPixels(0, 0, textureWidth, textureHeight, gl.RGBA, gl.UNSIGNED_BYTE, buf); + +// Verify the frame buffer's contents +var passed = true; +for (var i = 0; i < textureWidth; i++) { + var val = i; + if (buf[4 * i + 0] != val || + buf[4 * i + 1] != val || + buf[4 * i + 2] != val) { + testFailed("pixel at (" + i + ", 0) was (" + + buf[4 * i + 0] + ", " + + buf[4 * i + 1] + ", " + + buf[4 * i + 2] + "), should be (" + + val + ", " + val + ", " + val + ")"); + passed = false; + break; + } +} + +if (passed) + testPassed(""); + +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texparameter-test.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texparameter-test.html new file mode 100644 index 000000000..06d06170c --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texparameter-test.html @@ -0,0 +1,150 @@ +<!-- + +/* +** Copyright (c) 2012 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 TexParameter conformance 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="canvas_drawing" width="12" height="12"></canvas> +<canvas id="canvas_texture" width="2" height="2"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description("Tests TexParameter works as expected"); +debug(""); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("canvas_drawing"); +var canvas_texture = null; +var texParam = [ + gl.REPEAT, + gl.CLAMP_TO_EDGE, + gl.MIRRORED_REPEAT, +]; +var color = [200, 0, 254, 255]; +var textures = []; + +if (!gl) { + testFailed("WebGL context does not exist"); +} else { + testPassed("WebGL context exists"); + + wtu.setupTexturedQuadWithTexCoords(gl, [-2.5, -2.5], [3.5, 3.5]); + + setupCanvasTexture(); + setupTextures(); + for (var ii = 0; ii < texParam.length; ++ii) { + runDrawingTest(textures[ii], texParam[ii]); + } + + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors"); +} + +function setupCanvasTexture() { + canvas_texture = document.getElementById("canvas_texture"); + var ctx2d = canvas_texture.getContext("2d"); + ctx2d.fillStyle = "rgba(" + color[0] + "," + color[1] + "," + color[2] + "," + color[3] + ")"; + ctx2d.fillRect(0, 0, 1, 1); +} + +function setupTextures() { + for (var ii = 0; ii < texParam.length; ++ii) { + var texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas_texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParam[ii]); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParam[ii]); + textures[ii] = texture; + } +} + +function runDrawingTest(texture, param) { + gl.clearColor(1, 1, 1, 1); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + checkPixels(param); +} + +function checkPixels(param) { + var buf = new Uint8Array(12 * 12 * 4); + gl.readPixels(0, 0, 12, 12, gl.RGBA, gl.UNSIGNED_BYTE, buf); + var passed = true; + for (var yy = 0; yy < 12; ++yy) { + for (var xx = 0; xx < 12; ++xx) { + var ec = [0, 0, 0, 0]; + switch (param) { + case gl.REPEAT: + if (xx % 2 == 1 && yy % 2 == 1) { + ec = color; + } + break; + case gl.CLAMP_TO_EDGE: + if (xx < 6 && yy < 6) { + ec = color; + } + break; + case gl.MIRRORED_REPEAT: + if (xx % 4 < 2 && yy % 4 < 2) { + ec = color; + } + break; + } + var off = (yy * 12 + xx) * 4; + if (buf[off + 0] != ec[0] || buf[off + 1] != ec[1] || + buf[off + 2] != ec[2] || buf[off + 3] != ec[3]) { + var msg = 'at (' + xx + ', ' + yy + ') expected: ' + + ec[0] + ', ' + ec[1] + ', ' + ec[2] + ', ' + ec[3] + ' found: ' + + buf[off + 0] + ', ' + buf[off + 1] + ', ' + buf[off + 2] + ', ' + buf[off + 3]; + testFailed(msg); + passed = false; + } + } + } + if (passed) { + testPassed("Drawing with wrap " + wtu.glEnumToString(gl, param) + " as expected"); + } +} + +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-active-bind-2.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-active-bind-2.html new file mode 100644 index 000000000..1a35e3cd4 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-active-bind-2.html @@ -0,0 +1,231 @@ +<!-- + +/* +** Copyright (c) 2012 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 ActiveTexture BindTexture conformance test #2</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="example" width="2" height="2" style="width: 40px; height: 40px;"></canvas> +<canvas id="canvas2d" width="1" height="1" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader" type="x-shader/x-vertex"> +uniform mat4 world; +attribute vec3 vPosition; +attribute vec2 texCoord0; +varying vec2 texCoord; +void main() +{ + gl_Position = world * vec4(vPosition, 1); + texCoord = texCoord0; +} +</script> +<script id="fshader2d" type="x-shader/x-fragment"> +precision mediump float; + +uniform sampler2D tex2d; +varying vec2 texCoord; +void main() +{ + gl_FragColor = texture2D(tex2d, texCoord); +} +</script> +<script id="fshaderCube" type="x-shader/x-fragment"> +precision mediump float; + +uniform samplerCube texCube; +void main() +{ + gl_FragColor = textureCube(texCube, vec3(0,1,0)); +} +</script> + +<script> +"use strict"; +function init() +{ + description( + "Tests that binding both TEXTURE_2D and TEXTURE_CUBE_MAP to the same " + + "active texture unit works as long as they are not used " + + "simultaneously in the same shader program."); + + var canvas2d = document.getElementById("canvas2d"); + var ctx2d = canvas2d.getContext("2d"); + ctx2d.globalCompositeOperation = "copy"; + + var wtu = WebGLTestUtils; + var gl = wtu.create3DContext("example"); + var program = wtu.setupProgram( + gl, ["vshader", "fshader2d"], ["vPosition", "texCoord0"]); + + var program2d = program; + var programCube = wtu.setupProgram( + gl, ["vshader", "fshaderCube"], ["vPosition", "texCoord0"]); + + var vertexObject = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject); + gl.bufferData( + gl.ARRAY_BUFFER, + new Float32Array([-1, 1,0, 1,1,0, -1,-1,0, + -1,-1,0, 1,1,0, 1,-1,0]), + gl.STATIC_DRAW); + gl.enableVertexAttribArray(0); + gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0); + + var vertexObject = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject); + gl.bufferData( + gl.ARRAY_BUFFER, + new Float32Array([ 0,0, 1,0, 0,1, + 0,1, 1,0, 1,1]), + gl.STATIC_DRAW); + gl.enableVertexAttribArray(1); + gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 0, 0); + + // Make texture unit 1 active. + gl.activeTexture(gl.TEXTURE1); + + // Make a 2d texture + var tex2d = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex2d); + ctx2d.fillStyle = "rgba(0, 0, 255, 255)"; + ctx2d.fillRect(0, 0, 1, 1); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); + + // make a cube texture + var texCube = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCube); + ctx2d.fillStyle = "rgba(255, 0, 255, 255)"; + ctx2d.fillRect(0, 0, 1, 1); + var targets = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z]; + for (var ii = 0; ii < targets.length; ++ii) { + gl.texImage2D(targets[ii], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); + } + + // Setup program2d and programCube + var tex2dLoc = gl.getUniformLocation(program2d, "tex2d"); + var world2dLoc = gl.getUniformLocation(program2d, "world"); + var texCubeLoc = gl.getUniformLocation(programCube, "texCube"); + var worldCubeLoc = gl.getUniformLocation(programCube, "world"); + + gl.useProgram(program2d); + gl.uniform1i(tex2dLoc, 1); + gl.useProgram(programCube); + gl.uniform1i(texCubeLoc, 1); + + gl.clearColor(1,0,0,1); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + + var programs = [program2d, programCube]; + var worldLocs = [world2dLoc, worldCubeLoc]; + for (var ii = 0; ii < 4; ++ii) { + var x = ii % 2; + var y = Math.floor(ii / 2); + gl.useProgram(programs[x]); + gl.uniformMatrix4fv( + worldLocs[x], false, + [0.5, 0, 0, 0, + 0, 0.5, 0, 0, + 0, 0, 1, 0, + -0.5 + x, -0.5 + y, 0, 1]); + gl.drawArrays(gl.TRIANGLES, 0, 6); + } + + var colors = [ + [0,0,255,255], + [255,0,255,255], + [0,0,255,255], + [255,0,255,255]]; + + for (var ii = 0; ii < colors.length; ++ii) { + var c = colors[ii]; + var x = ii % 2; + var y = Math.floor(ii / 2); + wtu.checkCanvasRect(gl, x, y, 1, 1, c); + } + + // Test that binding to one target does not affect the other + debug(""); + debug("Testing texture target binding/unbinding"); + + var worldMatrix = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]; + + gl.activeTexture(gl.TEXTURE2); + + // Unbinding the TEXTURE_CUBE_MAP target should not affect the TEXTURE_2D target + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + + gl.bindTexture(gl.TEXTURE_2D, tex2d); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCube); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); + + gl.useProgram(program2d); + gl.uniform1i(tex2dLoc, 2); + gl.uniformMatrix4fv(world2dLoc, false, worldMatrix); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + wtu.checkCanvasRect(gl, 0, 0, 2, 2, [0,0,255,255]); + + // Unbinding the TEXTURE_2D target should not affect the TEXTURE_CUBE_MAP target + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCube); + gl.bindTexture(gl.TEXTURE_2D, tex2d); + gl.bindTexture(gl.TEXTURE_2D, null); + + gl.useProgram(programCube); + gl.uniform1i(texCubeLoc, 2); + gl.uniformMatrix4fv(worldCubeLoc, false, worldMatrix); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + wtu.checkCanvasRect(gl, 0, 0, 2, 2, [255,0,255,255]); +} + +init(); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-active-bind.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-active-bind.html new file mode 100644 index 000000000..5f7d74191 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-active-bind.html @@ -0,0 +1,140 @@ +<!-- + +/* +** Copyright (c) 2012 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 ActiveTexture BindTexture conformance 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="example" width="2" height="2" style="width: 40px; height: 40px;"></canvas> +<canvas id="canvas2d" width="1" height="1" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader" type="x-shader/x-vertex"> +uniform mat4 world; +attribute vec3 vPosition; +attribute vec2 texCoord0; +varying vec2 texCoord; +void main() +{ + gl_Position = world * vec4(vPosition, 1); + texCoord = texCoord0; +} +</script> +<script> +"use strict"; +var gl; + +function init() +{ + description( + "Tests that glActiveTexture and glBindTexture work as expected" + + "Specifically texture targets are per active texture unit."); + + var canvas2d = document.getElementById("canvas2d"); + var ctx2d = canvas2d.getContext("2d"); + + var wtu = WebGLTestUtils; + gl = wtu.create3DContext("example"); + var program = wtu.setupProgram( + gl, + ["vshader", wtu.simpleTextureFragmentShader], + ['vPosition', 'texCoord0']); + wtu.setupUnitQuad(gl); + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.BLEND); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + + var colors = [ + [0,192,128,255], + [128,64,255,255], + [192,255,64,255], + [200,0,255,255]]; + + // Make 4 textures by using 4 active texture units if available. + var texunits = Math.min(colors.length, gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)) + var textures = []; + for (var ii = 0; ii < texunits; ++ii) { + var tex = gl.createTexture(); + gl.activeTexture(gl.TEXTURE0 + ii); + gl.bindTexture(gl.TEXTURE_2D, tex); + textures[ii] = tex; + } + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + + // now use each texture unit to write into the textures, + for (var ii = 0; ii < texunits; ++ii) { + var c = colors[ii]; + ctx2d.fillStyle = + "rgba(" + c[0] + "," + c[1] + "," + c[2] + "," + c[3] + ")"; + ctx2d.fillRect(0, 0, 1, 1); + gl.activeTexture(gl.TEXTURE0 + ii); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); + } + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + + var textureLoc = gl.getUniformLocation(program, "tex"); + var worldLoc = gl.getUniformLocation(program, "world"); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + + gl.clearColor(1,0,0,1); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + + for (var ii = 0; ii < texunits; ++ii) { + var x = ii % 2; + var y = Math.floor(ii / 2); + gl.uniform1i(textureLoc, ii); + gl.uniformMatrix4fv( + worldLoc, false, + [0.5, 0, 0, 0, + 0, 0.5, 0, 0, + 0, 0, 1, 0, + -0.5 + x, -0.5 + y, 0, 1]); + gl.drawArrays(gl.TRIANGLES, 0, 6); + } + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + + for (var ii = 0; ii < texunits; ++ii) { + var x = ii % 2; + var y = Math.floor(ii / 2); + wtu.checkCanvasRect(gl, x, y, 1, 1, colors[ii]); + } +} + +init(); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-attachment-formats.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-attachment-formats.html new file mode 100644 index 000000000..8fa49f5d6 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-attachment-formats.html @@ -0,0 +1,197 @@ +<!-- + +/* +** Copyright (c) 2012 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 Texture Attachment Format Conformance Tests</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> +<div id="description"></div> +<div id="console"></div> +<canvas id="canvas" width="2" height="2" style="width: 100px; height:100px; border: 1px solid black;"> </canvas> +<script> +"use strict"; +description(); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("canvas"); +if (!gl) { + testFailed("context does not exist"); +} else { + testPassed("context exists"); + + debug(""); + debug("Checking texture formats."); + + var numValidFormats = 0; + var clearColor = [0.25, 0.5, 0.75, 0.25]; + + var floatToBits = function(value, bits) { + var range = (1 << bits) - 1; + var result = 0; + if (range > 0) { + result = Math.floor(Math.floor(value * range) * 255 / range); + } + + //debug("v = " + value + ", bits = " + bits + ", range = " + range + ", result = " + result); + return result; + } + + var testFormat = function(info) { + debug(""); + debug("testing: " + info.format + ", " + info.type); + + var format = gl[info.format]; + var type = gl[info.type]; + + gl.texImage2D(gl.TEXTURE_2D, + 0, // level + format, // internalFormat + 16, // width + 16, // height + 0, // border + format, // format + type, // type + null); // data + var fbStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER); + debug(wtu.glEnumToString(gl, fbStatus)); + if (fbStatus != gl.FRAMEBUFFER_COMPLETE) { + debug("format unsupported"); + if (info.mustBeFramebufferComplete) { + testFailed(info.format + " must be FRAMEBUFFER_COMPLETE"); + } + return; + } + + ++numValidFormats; + + var startExpected = [0, 0, 0, info.channels[3] < 0 ? 255 : 0]; + + var expected = []; + var tolerance = []; + for (var ii = 0; ii < 4; ++ii) { + var color = 0; + var channel = info.channels[ii]; + if (channel < 0) { + color = ii < 3 ? 0 : 255 + } else { + color = floatToBits(clearColor[channel], info.bits[ii]); + } + expected.push(color); + tolerance.push(channel < 0 ? 0 : (1 + (1 << (8 - info.bits[ii])))); + } + + wtu.checkCanvas(gl, startExpected, "should be " + startExpected); + gl.clear(gl.COLOR_BUFFER_BIT); + wtu.checkCanvas(gl, expected, "should be " + expected + " with tolerance " + tolerance, tolerance); + } + + var validFormats = [ + { format: 'RGBA', + type: 'UNSIGNED_BYTE', + channels: [0, 1, 2, 3], + bits: [8, 8, 8, 8], + mustBeFramebufferComplete: true + }, + { format: 'ALPHA', + type: 'UNSIGNED_BYTE', + channels: [-1, -1, -1, 3], + bits: [0, 0, 0, 8], + mustBeFramebufferComplete: false + }, + { format: 'RGB', + type: 'UNSIGNED_BYTE', + channels: [0, 1, 2, -1], + bits: [8, 8, 8, 0], + mustBeFramebufferComplete: false + }, + { format: 'RGB', + type: 'UNSIGNED_SHORT_5_6_5', + channels: [0, 1, 2, -1], + bits: [5, 6, 5, 0], + mustBeFramebufferComplete: false + }, + { format: 'RGBA', + type: 'UNSIGNED_SHORT_5_5_5_1', + channels: [0, 1, 2, 3], + bits: [5, 5, 5, 1], + mustBeFramebufferComplete: false + }, + { format: 'RGBA', + type: 'UNSIGNED_SHORT_4_4_4_4', + channels: [0, 1, 2, 3], + bits: [4, 4, 4, 4], + mustBeFramebufferComplete: false + }, + { format: 'LUMINANCE', + type: 'UNSIGNED_BYTE', + channels: [0, 0, 0, -1], + bits: [8, 8, 8, -1], + mustBeFramebufferComplete: false + }, + { format: 'LUMINANCE_ALPHA', + type: 'UNSIGNED_BYTE', + channels: [0, 0, 0, 3], + bits: [8, 8, 8, 8], + mustBeFramebufferComplete: false + } + ]; + + gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); + var fbo = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.framebufferTexture2D( + gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0); + + for (var ii = 0; ii < validFormats.length; ++ii) { + var info = validFormats[ii]; + testFormat(info); + } + + debug(""); + shouldBeTrue("numValidFormats > 0"); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors"); +} + +debug(""); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-clear.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-clear.html new file mode 100644 index 000000000..7184ecc2d --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-clear.html @@ -0,0 +1,64 @@ +<!-- + +/* +** Copyright (c) 2012 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 texture clear conformance 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="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description(document.title); +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("example"); +var program = wtu.setupTexturedQuad(gl); + +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + +var tex = gl.createTexture(); +gl.bindTexture(gl.TEXTURE_2D, tex); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0,255,0,255])); +wtu.clearAndDrawUnitQuad(gl); +wtu.checkCanvas( + gl, [0, 255, 0, 255], "should be green"); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-complete.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-complete.html new file mode 100644 index 000000000..e95c0aa61 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-complete.html @@ -0,0 +1,84 @@ +<!-- + +/* +** Copyright (c) 2012 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 "Texture Complete" texture conformance 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="example" width="40" height="40" style="width: 40px; height: 40px;"></canvas> +<canvas id="canvas2d" width="16" height="16" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function init() +{ + description( + "Checks that a texture that is not -texture-complete- does not draw if"+ + " filtering needs mips"); + + var canvas2d = document.getElementById("canvas2d"); + var ctx2d = canvas2d.getContext("2d"); + ctx2d.fillStyle = "rgba(0,192,128,1)"; + ctx2d.fillRect(0, 0, 16, 16); + + var wtu = WebGLTestUtils; + var canvas = document.getElementById("example"); + var gl = wtu.create3DContext(canvas); + var program = wtu.setupTexturedQuad(gl); + + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.BLEND); + + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + // 16x16 texture no mips + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); + + var loc = gl.getUniformLocation(program, "tex"); + gl.uniform1i(loc, 0); + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas(gl, [0,0,0,255], + "texture that is not -texture-complete- when " + + "TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255"); +} + +init(); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-copying-feedback-loops.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-copying-feedback-loops.html new file mode 100644 index 000000000..33c830ff6 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-copying-feedback-loops.html @@ -0,0 +1,103 @@ +<!-- + +/* +** Copyright (c) 2014 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 Texture Copying Feedback Loops 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="example" width="1" height="1" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> + +<script> +"use strict"; +description("Checks that texture copying feedback loops fail correctly."); +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("example"); + +var texture = gl.createTexture(); +gl.bindTexture(gl.TEXTURE_2D, texture); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + +var texture2 = gl.createTexture(); +gl.bindTexture(gl.TEXTURE_2D, texture2); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + +var framebuffer = gl.createFramebuffer(); +gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); +gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); +assertMsg(gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE, + "framebuffer should be FRAMEBUFFER_COMPLETE."); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after setup"); + +debug(""); +debug("testing copyTexImage2D"); +gl.bindTexture(gl.TEXTURE_2D, texture); +gl.copyTexImage2D(gl.TEXTURE_2D, 1, gl.RGBA, 0, 0, 2, 2, 0); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "after copyTexImage2D to same texture but different level"); +gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, 2, 2, 0); +wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, + "after copyTexImage2D to same texture same level, invalid feedback loop"); +gl.bindTexture(gl.TEXTURE_2D, texture2); +gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, 2, 2, 0); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "after copyTexImage2D to different texture"); + +debug(""); +debug("testing copyTexSubImage2D"); +gl.bindTexture(gl.TEXTURE_2D, texture); +gl.copyTexSubImage2D(gl.TEXTURE_2D, 1, 0, 0, 0, 0, 1, 1); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "after copyTexSubImage2D to same texture but different level"); +gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1); +wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, + "after copyTexSubImage2D to same texture same level, invalid feedback loop"); +gl.bindTexture(gl.TEXTURE_2D, texture2); +gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "after copyTexSubImage2D to different texture"); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-cube-as-fbo-attachment.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-cube-as-fbo-attachment.html new file mode 100644 index 000000000..dd3aa6fbb --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-cube-as-fbo-attachment.html @@ -0,0 +1,86 @@ +<!-- + +/* +** Copyright (c) 2014 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 texture cube as FBO color attachment</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="example" width="2" height="2" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +var gl; + +function run() +{ + description( + "Tests using a cube map face as the color attachment of a framebuffer object. " + + "This test covers an ANGLE validation bug. See https://code.google.com/p/angleproject/issues/detail?id=849 ."); + + var wtu = WebGLTestUtils; + gl = wtu.create3DContext("example"); + var textureCube = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, textureCube); + var faces = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ]; + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + for (var ii = 0; ii < faces.length; ++ii) { + gl.texImage2D(faces[ii], 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + } + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + + var fbo = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + + for (var ii = 0; ii < faces.length; ++ii) { + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, faces[ii], textureCube, 0); + shouldBe('gl.checkFramebufferStatus(gl.FRAMEBUFFER)', 'gl.FRAMEBUFFER_COMPLETE'); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors for face " + wtu.glEnumToString(gl, faces[ii])); + } +} + +run(); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-draw-with-2d-and-cube.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-draw-with-2d-and-cube.html new file mode 100644 index 000000000..630ecf91c --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-draw-with-2d-and-cube.html @@ -0,0 +1,124 @@ +<!-- + +/* +** Copyright (c) 2014 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 ActiveTexture BindTexture conformance 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="example" width="2" height="2" style="width: 40px; height: 40px;"></canvas> +<canvas id="canvas2d" width="1" height="1" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader" type="x-shader/x-vertex"> +attribute vec3 vPosition; +attribute vec2 texCoord0; +varying vec2 texCoord; +void main() +{ + gl_Position = vec4(vPosition, 1); + texCoord = texCoord0; +} +</script> +<script id="fshader" type="x-shader/x-fragment"> +precision mediump float; +varying vec2 texCoord; +uniform sampler2D tex2D; +uniform samplerCube texCube; +void main() +{ + gl_FragColor = texture2D(tex2D, texCoord); + gl_FragColor += textureCube(texCube, vec3(texCoord, 0)); +} +</script> +<script> +"use strict"; +var gl; + +function init() +{ + description( + "Tests drawing with two textures of different type. " + + "This test covers an ANGLE validation bug. See http://crbug.com/390412."); + + var canvas2d = document.getElementById("canvas2d"); + var ctx2d = canvas2d.getContext("2d"); + + var wtu = WebGLTestUtils; + gl = wtu.create3DContext("example"); + var program = wtu.setupProgram( + gl, + ["vshader", "fshader"], + ['vPosition', 'texCoord0']); + wtu.setupUnitQuad(gl); + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.BLEND); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + + var texture2D = gl.createTexture(); + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, texture2D); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + + var textureCube = gl.createTexture(); + gl.activeTexture(gl.TEXTURE1); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, textureCube); + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + + var texture2DLoc = gl.getUniformLocation(program, "tex2D"); + var textureCubeLoc = gl.getUniformLocation(program, "texCube"); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + + gl.clearColor(1,0,0,1); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + + gl.uniform1i(texture2DLoc, 0); + gl.uniform1i(textureCubeLoc, 1); + gl.drawArrays(gl.TRIANGLES, 0, 6); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); +} + +init(); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-fakeblack.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-fakeblack.html new file mode 100644 index 000000000..b4f098a1a --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-fakeblack.html @@ -0,0 +1,115 @@ +<!-- + +/* +** Copyright (c) 2013 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>Tests if fake black textures are corectly implemented on desktops</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="example" width="24" height="24"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; + +function createTexture(gl,r,g,b,a) { + // setup render target texture // + + var texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 3, 3, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.bindTexture(gl.TEXTURE_2D, null); + + // setup framebuffer // + var fbo = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + // fill the framebuffer // + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + gl.clearColor(r, g, b, a); + gl.clear(gl.COLOR_BUFFER_BIT); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + gl.deleteFramebuffer(fbo); + + return texture; +} + +function init() { + /* + * This test has been written due to a bug found in firefox's code + * and fixed in the following patch : + * https://bugzilla.mozilla.org/show_bug.cgi?id=879952#c5 + */ + var wtu = WebGLTestUtils; + description(); + + var gl = wtu.create3DContext("example"); + var program = wtu.setupTexturedQuad(gl); + + var texture0 = createTexture(gl,1,0,0,1); + var texture1 = createTexture(gl,0,1,0,1); + + gl.bindTexture(gl.TEXTURE_2D, texture0); + gl.drawArrays(gl.TRIANGLES, 0, 6); + wtu.checkCanvas(gl, [255, 0, 0, 255]); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + gl.drawArrays(gl.TRIANGLES, 0, 6); + wtu.checkCanvas(gl, [0, 0, 0, 255]); + + gl.bindTexture(gl.TEXTURE_2D, texture1); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.drawArrays(gl.TRIANGLES, 0, 6); + wtu.checkCanvas(gl, [0, 255, 0, 255]); + + gl.bindTexture(gl.TEXTURE_2D, texture0); + gl.drawArrays(gl.TRIANGLES, 0, 6); + wtu.checkCanvas(gl, [0, 0, 0, 255]); +} + +init(); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-formats-test.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-formats-test.html new file mode 100644 index 000000000..3eb4cdd22 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-formats-test.html @@ -0,0 +1,287 @@ +<!-- + +/* +** Copyright (c) 2012 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 Texture Format Conformance Tests</title> +<link rel="stylesheet" href="../../../resources/js-test-style.css"/> +<script src="../../../js/desktop-gl-constants.js"></script> +<script src="../../../js/js-test-pre.js"></script> +<script src="../../../js/webgl-test-utils.js"></script> +</head> +<body> +<div id="description"></div> +<div id="console"></div> +<canvas id="canvas2d" width="2" height="2" style="width: 50px; height: 50px; border: 1px solid black;"></canvas> +<canvas id="canvas" width="2" height="2" style="width: 100px; height:100px; border: 1px solid black;"></canvas> +<script> +"use strict"; +description("This test ensures WebGL implementations allow the OpenGL ES 2.0 texture formats and do not allow DesktopGL texture formats."); + +debug(""); +debug("Canvas.getContext"); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("canvas"); +if (!gl) { + testFailed("context does not exist"); +} else { + testPassed("context exists"); + + debug(""); + debug("Checking texture formats."); + + var createTexture = function(internalFormat, format, opt_border) { + var border = (opt_border === undefined) ? 0 : opt_border; + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D(gl.TEXTURE_2D, + 0, // level + internalFormat, // internalFormat + 16, // width + 16, // height + border, // border + format, // format + gl.UNSIGNED_BYTE, // type + null); // data + } + + var testValidFormat = function(internalFormat, formatName) { + createTexture(internalFormat, internalFormat); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "was able to create texture of " + formatName); + } + + var testInvalidFormat = function(internalFormat, formatName) { + createTexture(internalFormat, internalFormat); + var err = gl.getError(); + if (err == gl.NO_ERROR) { + testFailed("should NOT be able to create texture of type " + formatName); + } else if (err == gl.INVALID_ENUM || err == gl.INVALID_VALUE) { + testPassed("not able to create invalid format: " + formatName); + } + } + + var invalidEnums = [ + '1', + '2', + '3', + '4', + 'RGB4', + 'RGB5', + 'RGB8', + 'RGB10', + 'RGB12', + 'RGB16', + 'RGBA2', + 'RGBA4', + 'RGB5_A1', + 'RGBA8', + 'RGB10_A2', + 'RGBA12', + 'RGBA16', + 'BGR', + 'BGRA', + 'ALPHA4_EXT', + 'ALPHA8_EXT', + 'ALPHA12_EXT', + 'ALPHA16_EXT', + 'COMPRESSED_ALPHA', + 'COMPRESSED_LUMINANCE', + 'COMPRESSED_LUMINANCE_ALPHA', + 'COMPRESSED_INTENSITY', + 'COMPRESSED_RGB', + 'COMPRESSED_RGBA', + 'DEPTH_COMPONENT16', + 'DEPTH_COMPONENT24', + 'DEPTH_COMPONENT32', + 'LUMINANCE4_EXT', + 'LUMINANCE8_EXT', + 'LUMINANCE12_EXT', + 'LUMINANCE16_EXT', + 'LUMINANCE4_ALPHA4_EXT', + 'LUMINANCE6_ALPHA2_EXT', + 'LUMINANCE8_ALPHA8_EXT', + 'LUMINANCE12_ALPHA4_EXT', + 'LUMINANCE12_ALPHA12_EXT', + 'LUMINANCE16_ALPHA16_EXT', + 'INTENSITY_EXT', + 'INTENSITY4_EXT', + 'INTENSITY8_EXT', + 'INTENSITY12_EXT', + 'INTENSITY16_EXT', + 'RGB4_EXT', + 'RGB5_EXT', + 'RGB8_EXT', + 'RGB10_EXT', + 'RGB12_EXT', + 'RGB16_EXT', + 'RGBA2_EXT', + 'RGBA4_EXT', + 'RGB5_A1_EXT', + 'RGBA8_EXT', + 'RGB10_A2_EXT', + 'RGBA12_EXT', + 'RGBA16_EXT', + 'SLUMINANCE_EXT', + 'SLUMINANCE8_EXT', + 'SLUMINANCE_ALPHA_EXT', + 'SLUMINANCE8_ALPHA8_EXT', + 'SRGB_EXT', + 'SRGB8_EXT', + 'SRGB_ALPHA_EXT', + 'SRGB8_ALPHA8' + ]; + + for (var ii = 0; ii < invalidEnums.length; ++ii) { + var formatName = invalidEnums[ii] + if (desktopGL[formatName] === undefined) { + debug("bad format" + formatName) + } else { + testInvalidFormat(desktopGL[formatName], "GL_" + formatName); + } + } + + var validEnums = [ + 'ALPHA', + 'RGB', + 'RGBA', + 'LUMINANCE', + 'LUMINANCE_ALPHA' + ]; + + for (var ii = 0; ii < validEnums.length; ++ii) { + var formatName = validEnums[ii] + testValidFormat(gl[formatName], "gl." + formatName); + } + + debug(""); + debug("checking non 0 border parameter to gl.TexImage2D"); + createTexture(gl['RGBA'], gl['RGBA'], 1); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, + "non 0 border to gl.TexImage2D should return INVALID_VALUE"); + + + var checkTypes = function() { + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + + var loc = gl.getUniformLocation(program, "tex"); + gl.uniform1i(loc, 0); + + var checkType = function(r, g, b, a, type, format, buf) { + var typeName = wtu.glEnumToString(gl, type); + var formatName = wtu.glEnumToString(gl, format); + var desc = "format: " + formatName + ", type: " + typeName; + debug(""); + debug("checking gl.texImage2D with " + desc); + gl.texImage2D(gl.TEXTURE_2D, + 0, // level + format, // internalFormat + 2, // width + 2, // height + 0, // border + format, // format + type, // type + buf); // data + + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "gl.texImage2D with " + desc + " should generate NO_ERROR"); + + wtu.clearAndDrawUnitQuad(gl, [255, 0, 0, 255]); + wtu.checkCanvas(gl, [r,g,b,a], + "texture " + desc + " should draw with " + + r + ", " + g + ", " + b + ", " + a); + + } + checkType( + 0, 255, 0, 255, gl.UNSIGNED_BYTE, gl.RGBA, + new Uint8Array( + [ 0, 255, 0, 255, + 0, 255, 0, 255, + 0, 255, 0, 255, + 0, 255, 0, 255])); + checkType( + 0, 0, 255, 255, gl.UNSIGNED_SHORT_4_4_4_4, gl.RGBA, + new Uint16Array( + [ 255, 255, + 255, 255, + 255, 255, + 255, 255])); + checkType( + 0, 255, 0, 255, gl.UNSIGNED_SHORT_5_6_5, gl.RGB, + new Uint16Array( + [ 2016, 2016, + 2016, 2016, + 2016, 2016, + 2016, 2016])); + checkType( + 0, 0, 255, 255, gl.UNSIGNED_SHORT_5_5_5_1, gl.RGBA, + new Uint16Array( + [ 63, 63, + 63, 63, + 63, 63, + 63, 63])); + checkType( + 255, 255, 255, 255, gl.UNSIGNED_BYTE, gl.LUMINANCE, + new Uint8Array([ + 255, + 255, + 255, + 255])); + checkType( + 0, 0, 0, 128, gl.UNSIGNED_BYTE, gl.ALPHA, + new Uint8Array([ + 128, + 128, + 128, + 128])); + checkType( + 128, 128, 128, 192, gl.UNSIGNED_BYTE, gl.LUMINANCE_ALPHA, + new Uint8Array([ + 128, 192, + 128, 192, + 128, 192, + 128, 192])); + } + var program = wtu.setupTexturedQuad(gl); + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1); + checkTypes(); +} + +debug(""); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-hd-dpi.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-hd-dpi.html new file mode 100644 index 000000000..f06715a51 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-hd-dpi.html @@ -0,0 +1,138 @@ +<!-- + +/* +** Copyright (c) 2012 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 HD-DPI issues texture conformance 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="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description(); +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("example"); +var program = wtu.setupTexturedQuad(gl); + +function fillInMips(gl, size) { + // fill in the mips + var level = 1; + for (;;) { + size /= 2; + if (size < 1) { + break; + } + var numBytes = size * size * 4; + var pixels = new Uint8Array(numBytes); + for (var jj = 0; jj < numBytes; jj += 4) { + pixels[jj + 0] = 0; + pixels[jj + 1] = 255; + pixels[jj + 2] = 0; + pixels[jj + 3] = 255; + } + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + } +} + +function testCanvas(size) { + debug(""); + debug("testing 2D canvas size " + size + ", " + size); + + var canvas = document.createElement("canvas"); + canvas.width = size; + canvas.height = size; + var ctx = canvas.getContext("2d"); + ctx.fillStyle = "rgb(0,255,0)"; + ctx.fillRect(0, 0, size, size); + + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas); + + fillInMips(gl, size); + + // Draw. If this an HD-DPI device and the 2d canvas is double res or larger + // the implementation must scale to CSS pixels (ie, canvas.width, canvas.height)( + // when doing the copy in texImage2D. If it has not scaled and instead done + // a direct copy of the larger texture this test will not have created enough mips + // and will therefore not be "texture complete" and will render in black. + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green"); +} + +function testWebGL(size) { + debug(""); + debug("testing WebGL canvas size " + size + ", " + size); + + var canvas = document.createElement("canvas"); + canvas.width = size; + canvas.height = size; + var gl2 = wtu.create3DContext(canvas); + gl2.clearColor(0,1,0,1); + gl2.clear(gl.COLOR_BUFFER_BIT); + + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas); + + fillInMips(gl, size); + + // Draw. If this an HD-DPI device check for 2 possible bugs. + // + // 1) the WebGL canvas is double res or larger. That's just a bug period and + // is checked for in another test but would also fail here. + // + // 2) the WebGL canvas is single res but the code the scales a double res + // 2d canvas also mistakenly scales a single res WebGL canvas. + // + // If it has been scaled then we'll have the wrong kind of mips chain here. + // Level 0 will be half resolution. Level 1 will be the same resolution + // and will therefore not be "texture complete" and will render in black. + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green"); +} + +testCanvas(4); +testCanvas(512); +testWebGL(4); +testWebGL(512); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors"); + +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-mips.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-mips.html new file mode 100644 index 000000000..807bddf7a --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-mips.html @@ -0,0 +1,318 @@ +<!-- + +/* +** Copyright (c) 2012 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 texture mips conformance 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="example" width="2" height="2" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader" type="x-shader/x-vertex"> +uniform vec4 uMult; +attribute vec4 vPosition; +attribute vec2 texCoord0; +varying vec2 texCoord; +void main() +{ + gl_Position = vPosition * uMult; + texCoord = texCoord0; +} +</script> + +<script id="fshader" type="x-shader/x-fragment"> +precision mediump float; +uniform sampler2D tex; +varying vec2 texCoord; +void main() +{ + gl_FragColor = texture2D(tex, texCoord); +} +</script> +<script> +"use strict"; +var canvas; +var wtu = WebGLTestUtils; +function init() +{ + description("Checks mip issues"); + + canvas = document.getElementById("example"); + shouldBe("canvas.width", "2"); + shouldBe("canvas.height", "2"); + + var gl = wtu.create3DContext(canvas); + + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.generateMipmap(gl.TEXTURE_2D); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "for generateMipmap with mip 0 is 0x0"); + gl.texImage2D( + gl.TEXTURE_2D, 1, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, + new Uint8Array(4)); + gl.generateMipmap(gl.TEXTURE_2D); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "for generateMipmap with mip 0 is 0x0"); + + tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex); + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "for generateMipmap with mip 0 is 0x0"); + + var faces = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ]; + for (var ii = 0; ii < faces.length; ++ii) { + gl.texImage2D( + faces[ii], 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, + new Uint8Array(4 * 2 * 2)); + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + wtu.glErrorShouldBe(gl, ii == 5 ? gl.NO_ERROR : gl.INVALID_OPERATION, "for generateMipmap with " + (ii + 1) + " faces"); + } + + wtu.setupUnitQuad(gl, 0, 1); + var program = wtu.setupProgram( + gl, ['vshader', 'fshader'], ['vPosition', 'texCoord0'], [0, 1]); + + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.BLEND); + + var colors = { + blue: [0, 0, 255, 255], + red: [255, 0, 0, 255], + green: [0, 255, 0, 255], + cyan: [128, 255, 255, 255], + black: [0, 0, 0, 255], + blank: [0, 0, 0, 0] + }; + + var mips = [ + ]; + + var texLoc = gl.getUniformLocation(program, "tex"); + gl.uniform1i(texLoc, 0); + var multLoc = gl.getUniformLocation(program, "uMult"); + + // ---------------------------------------------------- + var clearTex = createTexture(); + gl.uniform4f(multLoc, 1, 1, 1, 1); + gl.bindTexture(gl.TEXTURE_2D, clearTex); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + debug('gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);'); + setMipData(0, 16, 'blank'); + makeDivMipChain(); + generateMipmap(); + check('blank', "texture created with null that has all mips"); + + // ---------------------------------------------------- + var tex = createTexture(); + gl.uniform4f(multLoc, 1, 1, 1, 1); + + gl.bindTexture(gl.TEXTURE_2D, tex); + // 16x16 texture no mips + fillLevel(tex, 0, 16, 'cyan'); + + check('black', + "texture that is missing mips when TEXTURE_MIN_FILTER not NEAREST or LINEAR"); + + generateMipmap(); + + check('cyan', "texture that has all mips"); + + // Fill in the bottom 2 mips with a different color. + fillLevel(tex, 4, 1, 'green'); + fillLevel(tex, 3, 2, 'green'); + + // Choose the nearest mip + texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); + + check('green', "texture that is only using the smallest 2 mips"); + + gl.uniform4f(multLoc, 16, 16, 1, 1); + + check('cyan', "texture that is using only the largest 2 mips"); + + // Set the top level + fillLevel(tex, 0, 1, 'red'); + check('red', + "texture that is only using the top level even though other levels are defined"); + + // Set the top 2 levels using generateMipmap + fillLevel(tex, 0, 2, 'blue'); + generateMipmap(); + + check('blue', + "texture that is only using the top 2 levels even though other levels are defined"); + + // Set the top 2 levels back to sizes that end up using levels 2, 3, and 4 again. + fillLevel(tex, 0, 16, 'blue'); + fillLevel(tex, 1, 8, 'blue'); + check('blue', "texture that is only using the largest 2 mips"); + gl.uniform4f(multLoc, 1, 1, 1, 1); + check('green', "texture that is only using the smallest 2 mips"); + + // ---------------------------------------------------- + var tex = createTexture(); + gl.uniform4f(multLoc, 1, 1, 1, 1); + fillLevel(tex, 0, 8, 'cyan'); + generateMipmap(); + check('cyan', "texture that has 3 mips"); + + fillLevel(tex, 0, 16, 'blue'); + texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + check('blue', "texture that is only using top mips"); + + fillLevel(tex, 0, 8, 'red'); + texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); + check('cyan', "texture that is only using smallest mips"); + + gl.uniform4f(multLoc, 16, 16, 1, 1); + check('red', "texture that is using only the largest mip"); + + // ---------------------------------------------------- + var tex = createTexture(); + gl.uniform4f(multLoc, 1, 1, 1, 1); + fillLevel(tex, 2, 1, 'green'); + fillLevel(tex, 1, 2, 'green'); + fillLevel(tex, 0, 4, 'green'); + check('green', "texture that was built smallest mip first"); + + // ---------------------------------------------------- + var tex = createTexture(); + gl.uniform4f(multLoc, 1, 1, 1, 1); + fillLevel(tex, 0, 16, 'red'); + generateMipmap(); + check('red', "texture with 1 genmipmaps"); + fillLevel(tex, 0, 16, 'blue'); + generateMipmap(); + fillLevel(tex, 0, 16, 'green'); + generateMipmap(); + check('green', "texture with 2 genmipmaps"); + + // ---------------------------------------------------- + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors."); + + function createTexture() { + debug("<hr/>gl.createTexture()"); + mips = []; + makeDivMipChain(); + return gl.createTexture(); + } + + function texParameteri(target, pname, value) { + debug("gl.texParameteri(" + + wtu.glEnumToString(gl, target) + ", " + + wtu.glEnumToString(gl, pname) + ", " + + wtu.glEnumToString(gl, value) + ")") + gl.texParameteri(target, pname, value); + } + + function generateMipmap() { + debug("gl.generateMipmap(gl.TEXTURE_2D)"); + gl.generateMipmap(gl.TEXTURE_2D); + var mip0 = mips[0]; + var size = mip0.size; + var level = 1; + for(;;) { + size = Math.floor(size / 2); + if (!size) { + break; + } + setMipData(level, size, mip0.color); + ++level; + } + makeDivMipChain(); + } + + function check(color, msg) { + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas(gl, colors[color], msg + " should draw with " + color); + } + + function fillLevel(tex, level, size, color) { + setMipData(level, size, color); + debug("gl.texImage2D(gl.TEXTURE_2D, " + level + ", gl.RGBA, " + size + ", " + size + + ", 0, gl.RGBA, gl.UNSIGNED_BYTE, " + color + ");"); + wtu.fillTexture(gl, tex, size, size, colors[color], level); + makeDivMipChain(); + } + + function setMipData(level, size, color) { + mips[level] = { + size: size, + color: color + }; + } + + function makeDivMipChain(color) { + var html = [ + '<div style="height: 68px; margin-top: 5px">', + '<div style="float:left;">mips: </div>']; + for (var ii = 0; ii < 5; ++ii) { + var mip = mips[ii]; + if (mip) { + html.push(makeDivSquare(mip.size, mip.color)); + } else { + html.push(makeDivSquare(16, undefined)); + } + } + html.push("</div>"); + debug(html.join("")); + } + + function makeDivSquare(size, color) { + size *= 4; + var c = color ? colors[color] : [255,255,255]; + var border = color ? 'solid' : 'dashed'; + return '<div style="float:left; width: ' + size + 'px; height: ' + size + + 'px; background-color: ' + rgb(c) + + '; border: 1px ' + border + ' black; margin-right: 3px;"></div>'; + } + + function rgb(c) { + return 'rgb(' + c[0] + ',' + c[1] + ',' + c[2] +')'; + } +} + +init(); +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-npot-video.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-npot-video.html new file mode 100644 index 000000000..300f38f12 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-npot-video.html @@ -0,0 +1,161 @@ +<!-- + +/* +** Copyright (c) 2012 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"> +<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> +<script> +"use strict"; +var wtu = WebGLTestUtils; +var gl = null; +var textureLoc = null; +var successfullyParsed = false; + +initTestingHarness(); + +function init() +{ + description('Verify npot video'); + + var canvas = document.getElementById("example"); + gl = wtu.create3DContext(canvas); + var program = wtu.setupTexturedQuad(gl); + + gl.clearColor(0,0,0,1); + gl.clearDepth(1); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + // Disable any writes to the alpha channel + gl.colorMask(1, 1, 1, 0); + + textureLoc = gl.getUniformLocation(program, "tex"); + + var video = document.getElementById("vid"); + wtu.startPlayingAndWaitForVideo(video, runTest); +} + +function runOneIteration(videoElement, useTexSubImage2D, flipY, topColor, bottomColor, badMinFilter, badClamp, genMips) +{ + debug('Testing ' + (useTexSubImage2D ? 'texSubImage2D' : 'texImage2D') + + ' with flipY=' + flipY); + var texture = gl.createTexture(); + // Bind the texture to texture unit 0 + gl.bindTexture(gl.TEXTURE_2D, texture); + // Set up pixel store parameters + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY); + // Upload the videoElement into the texture + debug("size: " + videoElement.videoWidth + "x" + videoElement.videoHeight); + if (useTexSubImage2D) { + // Initialize the texture to black first + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, + videoElement.videoWidth, videoElement.videoHeight, 0, + gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, videoElement); + } else { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, videoElement); + } + + // Set up texture parameters + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + if (badMinFilter) { + debug("bad min filter"); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); + } else { + debug("good min filter"); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + } + if (badClamp) { + debug("bad clamp"); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + } else { + debug("good clamp"); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + } + if (genMips) { + debug("generate mips"); + gl.generateMipmap(gl.TEXTURE_2D); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "should be INVALID_OPERATION"); + } + +// var c = document.createElement("canvas"); +// c.width = 16; +// c.height = 16; +// c.style.border = "1px solid black"; +// var ctx = c.getContext("2d"); +// ctx.drawImage(videoElement, 0, 0, 16, 16); +// document.body.appendChild(c); + + // Point the uniform sampler to texture unit 0 + gl.uniform1i(textureLoc, 0); + // Draw the triangles + wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 255]); + // Check a few pixels near the top and bottom and make sure they have + // the right color. + var tolerance = 5; + debug("Checking lower left corner"); + wtu.checkCanvasRect(gl, 4, 4, 2, 2, bottomColor, + "shouldBe " + bottomColor, tolerance); + debug("Checking upper left corner"); + wtu.checkCanvasRect(gl, 4, gl.canvas.height - 8, 2, 2, topColor, + "shouldBe " + topColor, tolerance); + debug(""); +} + +function runTest(videoElement) +{ + var red = [255, 0, 0]; + var green = [0, 255, 0]; + var black = [0, 0, 0]; + runOneIteration(videoElement, false, true, black, black, true, true, true); + runOneIteration(videoElement, false, true, black, black, true, false, false); + runOneIteration(videoElement, false, true, black, black, false, true, false); + runOneIteration(videoElement, false, true, black, black, true, true, false); + runOneIteration(videoElement, false, true, green, red, false, false, false); + runOneIteration(videoElement, false, false, red, green, false, false, false); + runOneIteration(videoElement, true, true, green, red, false, false, false); + runOneIteration(videoElement, true, false, red, green, false, false, false); + + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be no errors"); + finishTest(); +} +</script> +</head> +<body onload="init()"> +<canvas id="example" width="64" height="48"></canvas> +<div id="description"></div> +<div id="console"></div> +<video id="vid" style="display:none;"> + <source src="../../../resources/npot-video.mp4" type='video/mp4; codecs="avc1.42E01E"' /> + <source src="../../../resources/npot-video.webmvp8.webm" type='video/webm; codecs="vp8"' /> + <source src="../../../resources/npot-video.theora.ogv" type='video/ogg; codecs="theora"' /> +</video> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-npot.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-npot.html new file mode 100644 index 000000000..aa876bcb2 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-npot.html @@ -0,0 +1,326 @@ +<!-- + +/* +** Copyright (c) 2012 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 Non-Power of 2 texture conformance 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="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader" type="x-shader/x-vertex"> +attribute vec4 vPosition; +attribute vec2 texCoord0; +varying vec2 texCoord; +void main() +{ + gl_Position = vPosition; + texCoord = texCoord0; +} +</script> + +<script id="fshader" type="x-shader/x-fragment"> +precision mediump float; +uniform samplerCube tex; +varying vec2 texCoord; +void main() +{ + gl_FragColor = textureCube(tex, normalize(vec3(texCoord, 1))); +} +</script> +<script> +"use strict"; +description(document.title); +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("example"); +var program = wtu.setupTexturedQuad(gl); + +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + +var tests = [ + { format: gl.RGBA, + type: gl.UNSIGNED_BYTE, + color: [192, 0, 128, 64], + expected: [192, 0, 128, 64], + tolerance: 0, + }, + { format: gl.RGB, + type: gl.UNSIGNED_BYTE, + color: [192, 0, 128], + expected: [192, 0, 128, 255], + tolerance: 0, + }, + { format: gl.LUMINANCE, + type: gl.UNSIGNED_BYTE, + color: [192], + expected: [192, 192, 192, 255], + tolerance: 0, + }, + { format: gl.ALPHA, + type: gl.UNSIGNED_BYTE, + color: [64], + expected: [0, 0, 0, 64], + tolerance: 0, + }, + { format: gl.LUMINANCE_ALPHA, + type: gl.UNSIGNED_BYTE, + color: [192, 64], + expected: [192, 192, 192, 64], + tolerance: 0, + }, + // { format: gl.RGBA, + // type: gl.UNSIGNED_SHORT_4_4_4_4, + // color: [0x48FC], + // expected: [0x44, 0x88, 0xFF, 0xCC], + // tolerance: 16, + // }, + // { format: gl.RGBA, + // type: gl.UNSIGNED_SHORT_5_5_5_1, + // color: [0x8309], // 10000 01000 00100 1 + // expected: [128, 64, 32, 255], + // tolerance: 16, + // }, + // { format: gl.RGB, + // type: gl.UNSIGNED_SHORT_5_6_5, + // color: [0x8404], // 10000 010000 00100 + // expected: [128, 64, 32], + // tolerance: 16, + // }, +]; + +tests.forEach(function(test) { + debug(""); + debug("test " + wtu.glEnumToString(gl, test.format) + "/" + wtu.glEnumToString(gl, test.type)); + var tex = gl.createTexture(); + + // Check that an NPOT texture not on level 0 generates INVALID_VALUE + wtu.fillTexture(gl, tex, 5, 3, test.color, 1, test.format, test.type); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, + "gl.texImage2D with NPOT texture with level > 0 should return INVALID_VALUE"); + + // Check that an NPOT texture on level 0 succeeds + wtu.fillTexture(gl, tex, 5, 3, test.color, 0, test.format, test.type); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "gl.texImage2D with NPOT texture at level 0 should succeed"); + + // Check that generateMipmap fails on NPOT + gl.generateMipmap(gl.TEXTURE_2D); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, + "gl.generateMipmap with NPOT texture should return INVALID_OPERATION"); + + // Check that nothing is drawn if filtering is not correct for NPOT + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, [0, 0, 0, 255], + "NPOT texture with TEXTURE_WRAP set to REPEAT should draw with 0,0,0,255"); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_LINEAR); + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, [0, 0, 0, 255], + "NPOT texture with TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255"); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, test.expected, + "NPOT texture with TEXTURE_MIN_FILTER set to LINEAR should draw."); + + gl.copyTexImage2D(gl.TEXTURE_2D, 1, test.format, 0, 0, 5, 3, 0); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, + "copyTexImage2D with NPOT texture with level > 0 should return INVALID_VALUE."); + + // Check that generateMipmap for an POT texture succeeds + wtu.fillTexture(gl, tex, 4, 4, test.color, 0, test.format); + gl.generateMipmap(gl.TEXTURE_2D); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "gl.texImage2D and gl.generateMipmap with POT texture at level 0 should succeed"); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, test.expected, + "POT texture with TEXTURE_MIN_FILTER set to LINEAR_MIPMAP_LINEAR should draw."); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); +}); + +var testCubemap = function(switchTextureUnitBeforeDraw) { + debug(""); + var title = "check using cubemap"; + if (switchTextureUnitBeforeDraw) { + title += " and switch texture unit before draw to check for Chromium bug"; + } + debug(title); + var program = wtu.setupProgram( + gl, ['vshader', 'fshader'], ['vPosition', 'texCoord0'], [0, 1]); + var tex = gl.createTexture(); + + // Check that an NPOT texture not on level 0 generates INVALID_VALUE + fillCubeTexture(gl, tex, 5, 3, [0, 192, 128, 255], 1); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, + "gl.texImage2D with NPOT texture with level > 0 should return INVALID_VALUE"); + + // Check that an NPOT texture on level 0 succeeds + fillCubeTexture(gl, tex, 5, 5, [0, 192, 128, 255]); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "gl.texImage2D with NPOT texture at level 0 should succeed"); + + // Check that generateMipmap fails on NPOT + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, + "gl.generateMipmap with NPOT texture should return INVALID_OPERATION"); + + var loc = gl.getUniformLocation(program, "tex"); + gl.uniform1i(loc, 0); + + // Check that nothing is drawn if filtering is not correct for NPOT + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.REPEAT); + + if (switchTextureUnitBeforeDraw) { + debug("Switching active texture unit to gl.TEXTURE1"); + // Test for http://crbug.com/390514 + gl.activeTexture(gl.TEXTURE1); + } + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, [0, 0, 0, 255], + "NPOT cubemap with TEXTURE_WRAP set to REPEAT should draw with 0,0,0,255"); + + if (switchTextureUnitBeforeDraw) { + var error = gl.getError(); + if (error === gl.NO_ERROR) { + testPassed("getError was expected value: NO_ERROR : Should be no errors from draw."); + } else if (error === gl.INVALID_ENUM) { + testFailed("getError returned INVALID_ENUM. Possibly Chromium bug where texture unit is set to 0 instead of GL_TEXTURE0."); + } else { + testFailed("Drawing resulted in error: " + wtu.glEnumToString(gl, error)); + } + gl.activeTexture(gl.TEXTURE0); + } else { + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from draw."); + } + + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_LINEAR); + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, [0, 0, 0, 255], + "NPOT cubemap with TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255"); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, [0, 192, 128, 255], + "NPOT cubemap with TEXTURE_MIN_FILTER set to LINEAR should draw."); + + // Check that an POT texture on level 0 succeeds + fillCubeTexture(gl, tex, 4, 4, [0, 192, 128, 255]); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "gl.texImage2D with POT texture at level 0 should succeed"); + + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.REPEAT); + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, [0, 0, 0, 255], + "POT cubemap with TEXTURE_MIN_FILTER set to LINEAR_MIPMAP_LINEAR but no mips draw with 0,0,0,255"); + + // Check that generateMipmap succeeds on POT + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "gl.generateMipmap with POT texture should return succeed"); + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, [0, 192, 128, 255], + "POT cubemap with TEXTURE_MIN_FILTER set to LINEAR_MIPMAP_LINEAR should draw."); +}; + +testCubemap(false); +testCubemap(true); + +var successfullyParsed = true; + +function fillCubeTexture(gl, tex, width, height, color, opt_level) { + opt_level = opt_level || 0; + var canvas = document.createElement('canvas'); + canvas.width = width; + canvas.height = height; + var ctx2d = canvas.getContext('2d'); + ctx2d.fillStyle = "rgba(" + color[0] + "," + color[1] + "," + color[2] + "," + color[3] + ")"; + ctx2d.fillRect(0, 0, width, height); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex); + var targets = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z]; + for (var tt = 0; tt < targets.length; ++tt) { + gl.texImage2D( + targets[tt], opt_level, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas); + } +}; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-size-cube-maps.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-size-cube-maps.html new file mode 100644 index 000000000..e855a8072 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-size-cube-maps.html @@ -0,0 +1,352 @@ +<!-- + +/* +** Copyright (c) 2012 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 texture size cube map conformance 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="example" width="256" height="256" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader" type="x-shader/x-vertex"> +attribute vec4 vPosition; +uniform mat4 rotation; +varying vec3 texCoord; +void main() +{ + gl_Position = vPosition; + vec4 direction = vec4(vPosition.x * 0.5, vPosition.y * 0.5, 1, 1); + texCoord = normalize((rotation * direction).xyz); +} +</script> + +<script id="fshader" type="x-shader/x-fragment"> +precision mediump float; +uniform samplerCube tex; +varying vec3 texCoord; +void main() +{ + gl_FragColor = textureCube(tex, normalize(texCoord)); +} +</script> +<script> +"use strict"; +var canvas; +description("Checks issues with size of cube map textures"); +debug(""); + +var wtu = WebGLTestUtils; +var canvas = document.getElementById("example"); + +var gl = wtu.create3DContext(canvas); +wtu.setupUnitQuad(gl, 0, 1); +var program = wtu.setupProgram( + gl, + ['vshader', 'fshader'], + ['vPosition', 'texCoord0'], [0, 1]); +var rotLoc = gl.getUniformLocation(program, "rotation"); + +gl.disable(gl.DEPTH_TEST); +gl.disable(gl.BLEND); + +var maxSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE); +debug("max cube map size: " + maxSize); +maxSize = Math.min(512, maxSize); + +// a cube map of 512x512 takes 6meg. I'm assuming it's not +// unreasonable to expect to be able to allocate a 6meg texture + +var colors = [ + {name: 'red', color: [255, 0, 0, 255]}, + {name: 'green', color: [ 0, 255, 0, 255]}, + {name: 'blue', color: [ 0, 0, 255, 255]}, + {name: 'yellow', color: [255, 255, 0, 255]}, + {name: 'cyan', color: [ 0, 255, 255, 255]}, + {name: 'magenta', color: [255, 0, 255, 255]} +]; + +var targets = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z]; + +var rotations = [ + {axis: [0, 1, 0], angle: Math.PI / 2}, + {axis: [0, 1, 0], angle: -Math.PI / 2}, + {axis: [1, 0, 0], angle: -Math.PI / 2}, + {axis: [1, 0, 0], angle: Math.PI / 2}, + {axis: [0, 1, 0], angle: 0}, + {axis: [0, 1, 0], angle: Math.PI}, +]; + +var halfRotations = [ + {colors: [3, 4], rotations: [{axis: [1, 0, 0], angle: Math.PI / 4}]}, + {colors: [4, 2], rotations: [{axis: [1, 0, 0], angle: -Math.PI / 4}]}, + {colors: [5, 3], rotations: [{axis: [1, 0, 0], angle: Math.PI / 4 * 3}]}, + {colors: [2, 5], rotations: [{axis: [1, 0, 0], angle: -Math.PI / 4 * 3}]}, + {colors: [3, 0], rotations: [{axis: [0, 1, 0], angle: Math.PI / 2}, + {axis: [1, 0, 0], angle: Math.PI / 4}]}, + {colors: [0, 2], rotations: [{axis: [0, 1, 0], angle: Math.PI / 2}, + {axis: [1, 0, 0], angle: -Math.PI / 4}]}, +]; + +var count = 0; +var sizeCount = 0; + +test(); + +function test() { + var size = Math.pow(2, sizeCount); + if (size > maxSize || !testSize(size)) { + finishTest(); + } else { + ++sizeCount; + setTimeout(test, 0); + } +} + +function testSize(size) { + debug(""); + debug("testing size: " + size); + var canvasSize = Math.max(size / 4, 2); + canvas.width = canvasSize; + canvas.height = canvasSize; + gl.viewport(0, 0, canvasSize, canvasSize); + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex); + + // Seems like I should be using LINEAR here with some other math + // to make sure I get more mip coverage but that's easier said + // than done. + + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + + for (var jj = 0; jj < 2; ++jj) { + for (var tt = 0; tt < targets.length; ++tt) { + var color = colors[(tt + count) % colors.length]; + fillLevel(targets[tt], 0, size, color.color); + } + if (jj == 1) { + debug("use mipmap"); + gl.texParameteri( + gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, + gl.NEAREST_MIPMAP_NEAREST); + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + } + + var err = gl.getError(); + if (err == gl.OUT_OF_MEMORY) { + debug("out of memory"); + return false; + } + if (err != gl.NO_ERROR) { + testFailed("unexpected gl error: " + wtu.glEnumToString(gl, err)); + } + + + for (var rr = 0; rr < rotations.length; ++rr) { + var rot = rotations[rr]; + var color = colors[(rr + count) % colors.length]; + var rotMat = axisRotation(rot.axis, rot.angle); + gl.uniformMatrix4fv(rotLoc, false, rotMat); + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, color.color, + wtu.glEnumToString(gl, targets[rr]) + " should be " + color.name); + } + + for (var rr = 0; rr < halfRotations.length; ++rr) { + var h = halfRotations[rr]; + var rots = h.rotations; + var rotMat = axisRotation(rots[0].axis, rots[0].angle); + for (var ii = 1; ii < rots.length; ++ii) { + var tmpMat = axisRotation(rots[ii].axis, rots[ii].angle); + var rotMat = mulMatrix(tmpMat, rotMat); + } + gl.uniformMatrix4fv(rotLoc, false, rotMat); + wtu.clearAndDrawUnitQuad(gl); + + for (var ii = 0; ii < 2; ++ii) { + checkRect( + 0, + canvasSize / 2 * ii, + canvasSize, + canvasSize / 2, + colors[(h.colors[ii] + count) % colors.length]); + } + } + ++count; + } + + gl.deleteTexture(tex); + return true; +} + +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors."); + +function checkRect(x, y, width, height, color) { + wtu.checkCanvasRect( + gl, + x, + y, + width, + height, + color.color, + "" + x + ", " + y + ", " + width + ", " + height + + " should be " + color.name); +} + +function fillLevel(target, level, size, color) { + var numPixels = size * size; + var pixels = new Uint8Array(numPixels * 4); + var pixelRow = new Uint8Array(size * 4); + for (var jj = 0; jj < size; ++jj) { + var off = jj * 4; + pixelRow[off + 0] = color[0]; + pixelRow[off + 1] = color[1]; + pixelRow[off + 2] = color[2]; + pixelRow[off + 3] = color[3]; + } + for (var jj = 0; jj < size; ++jj) { + var off = jj * size * 4; + pixels.set(pixelRow, off); + } + gl.texImage2D( + target, level, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE, + pixels); +} + +function printMat(mat) { + debug("" + mat[0] + ", " + mat[1] + ", " + mat[2] + ", " + mat[3] + ", "); + debug("" + mat[4] + ", " + mat[5] + ", " + mat[6] + ", " + mat[7] + ", "); + debug("" + mat[8] + ", " + mat[9] + ", " + mat[10] + ", " + mat[11] + ", "); + debug("" + mat[12] + ", " + mat[13] + ", " + mat[14] + ", " + mat[15] + ", "); +} + +function axisRotation(axis, angle) { + var dst = new Float32Array(16); + var x = axis[0]; + var y = axis[1]; + var z = axis[2]; + var n = Math.sqrt(x * x + y * y + z * z); + x /= n; + y /= n; + z /= n; + var xx = x * x; + var yy = y * y; + var zz = z * z; + var c = Math.cos(angle); + var s = Math.sin(angle); + var oneMinusCosine = 1 - c; + + dst[ 0] = xx + (1 - xx) * c; + dst[ 1] = x * y * oneMinusCosine + z * s; + dst[ 2] = x * z * oneMinusCosine - y * s; + dst[ 3] = 0; + dst[ 4] = x * y * oneMinusCosine - z * s; + dst[ 5] = yy + (1 - yy) * c; + dst[ 6] = y * z * oneMinusCosine + x * s; + dst[ 7] = 0; + dst[ 8] = x * z * oneMinusCosine + y * s; + dst[ 9] = y * z * oneMinusCosine - x * s; + dst[10] = zz + (1 - zz) * c; + dst[11] = 0; + dst[12] = 0; + dst[13] = 0; + dst[14] = 0; + dst[15] = 1; + + return dst; +}; + +function mulMatrix(a, b) { + var dst = new Float32Array(16); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[ 4 + 0]; + var a11 = a[ 4 + 1]; + var a12 = a[ 4 + 2]; + var a13 = a[ 4 + 3]; + var a20 = a[ 8 + 0]; + var a21 = a[ 8 + 1]; + var a22 = a[ 8 + 2]; + var a23 = a[ 8 + 3]; + var a30 = a[12 + 0]; + var a31 = a[12 + 1]; + var a32 = a[12 + 2]; + var a33 = a[12 + 3]; + var b00 = b[0]; + var b01 = b[1]; + var b02 = b[2]; + var b03 = b[3]; + var b10 = b[ 4 + 0]; + var b11 = b[ 4 + 1]; + var b12 = b[ 4 + 2]; + var b13 = b[ 4 + 3]; + var b20 = b[ 8 + 0]; + var b21 = b[ 8 + 1]; + var b22 = b[ 8 + 2]; + var b23 = b[ 8 + 3]; + var b30 = b[12 + 0]; + var b31 = b[12 + 1]; + var b32 = b[12 + 2]; + var b33 = b[12 + 3]; + dst[ 0] = a00 * b00 + a01 * b10 + a02 * b20 + a03 * b30; + dst[ 1] = a00 * b01 + a01 * b11 + a02 * b21 + a03 * b31; + dst[ 2] = a00 * b02 + a01 * b12 + a02 * b22 + a03 * b32; + dst[ 3] = a00 * b03 + a01 * b13 + a02 * b23 + a03 * b33; + dst[ 4] = a10 * b00 + a11 * b10 + a12 * b20 + a13 * b30; + dst[ 5] = a10 * b01 + a11 * b11 + a12 * b21 + a13 * b31; + dst[ 6] = a10 * b02 + a11 * b12 + a12 * b22 + a13 * b32; + dst[ 7] = a10 * b03 + a11 * b13 + a12 * b23 + a13 * b33; + dst[ 8] = a20 * b00 + a21 * b10 + a22 * b20 + a23 * b30; + dst[ 9] = a20 * b01 + a21 * b11 + a22 * b21 + a23 * b31; + dst[10] = a20 * b02 + a21 * b12 + a22 * b22 + a23 * b32; + dst[11] = a20 * b03 + a21 * b13 + a22 * b23 + a23 * b33; + dst[12] = a30 * b00 + a31 * b10 + a32 * b20 + a33 * b30; + dst[13] = a30 * b01 + a31 * b11 + a32 * b21 + a33 * b31; + dst[14] = a30 * b02 + a31 * b12 + a32 * b22 + a33 * b32; + dst[15] = a30 * b03 + a31 * b13 + a32 * b23 + a33 * b33; + return dst; +}; +</script> +</body> +</html> + + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-size-limit.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-size-limit.html new file mode 100644 index 000000000..f2363a1d6 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-size-limit.html @@ -0,0 +1,171 @@ +<!-- + +/* +** Copyright (c) 2012 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 texture size limit conformance 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="example" width="32" height="32" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description("Checks various size limits of textures") +var canvas; + +function numLevelsFromSize(size) { + var levels = 0; + while ((size >> levels) > 0) { + ++levels; + } + return levels; +} + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("example"); +var tests = [ + { format: gl.ALPHA, type: gl.UNSIGNED_BYTE, size: 1, dataType: Uint8Array }, + { format: gl.LUMINANCE, type: gl.UNSIGNED_BYTE, size: 1, dataType: Uint8Array }, + { format: gl.LUMINANCE_ALPHA, type: gl.UNSIGNED_BYTE, size: 2, dataType: Uint8Array }, + { format: gl.RGB, type: gl.UNSIGNED_BYTE, size: 3, dataType: Uint8Array }, + { format: gl.RGB, type: gl.UNSIGNED_SHORT_5_6_5, size: 1, dataType: Uint16Array }, + { format: gl.RGBA, type: gl.UNSIGNED_BYTE, size: 4, dataType: Uint8Array }, + { format: gl.RGBA, type: gl.UNSIGNED_SHORT_4_4_4_4, size: 1, dataType: Uint16Array }, + { format: gl.RGBA, type: gl.UNSIGNED_SHORT_5_5_5_1, size: 1, dataType: Uint16Array } +]; + +// Note: We expressly only use 2 textures because first a texture will be defined +// using all mip levels of 1 format, then for a moment it will have mixed formats which +// may uncover bugs. +var targets = [ + { target: gl.TEXTURE_2D, + maxSize: gl.getParameter(gl.MAX_TEXTURE_SIZE), + maxLevel: 1000, + tex: gl.createTexture(), + targets: [gl.TEXTURE_2D] + }, + { target: gl.TEXTURE_CUBE_MAP, + maxSize: gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE), + maxLevel: 5, + tex: gl.createTexture(), + targets: [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ] + } +]; + +gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1); + +var trg = 0; +var tt = 0; +runNextTest(); + +function runNextTest() { + var t = targets[trg]; + + if (tt == 0) { + var tex = t.tex; + gl.bindTexture(t.target, tex); + + debug(""); + debug("max size for " + wtu.glEnumToString(gl, t.target) + ": " + t.maxSize); + var numLevels = numLevelsFromSize(t.maxSize); + debug("num levels " + numLevels); + } + + var test = tests[tt]; + testFormatType(t, test); + ++tt; + if (tt == tests.length) { + tt = 0; + ++trg; + if (trg == targets.length) { + finishTest(); + return; + } + } + wtu.waitForComposite(runNextTest) +} + +function testFormatType(t, test) { + debug(""); + debug("testing: " + wtu.glEnumToString(gl, test.format) + ", " + wtu.glEnumToString(gl, test.type)); + for (var j = 0; j < t.targets.length; ++j) { + var target = t.targets[j]; + debug(""); + debug(wtu.glEnumToString(gl, target)); + var numLevels = numLevelsFromSize(t.maxSize); + var numTestLevels = Math.min(numLevels, t.maxLevel); + + // out of bounds tests + // level out of bounds + gl.texImage2D(target, numLevels, test.format, 1, 1, 0, test.format, test.type, null); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "level out of bounds: should generate INVALID_VALUE: level is: " + + numLevels + ", size is 1x1."); + // width and height out of bounds + gl.texImage2D(target, 0, test.format, t.maxSize + 1, t.maxSize + 1, 0, test.format, test.type, null); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "width or height out of bounds: should generate INVALID_VALUE: level is 0, size is " + + (t.maxSize + 1) + "x" + (t.maxSize + 1)); + // width and height out of bounds for specified level + gl.texImage2D(target, (numLevels - 1), test.format, 4, 4, 0, test.format, test.type, null); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "width or height out of bounds for specified level: should generate INVALID_VALUE: level is " + + (numLevels - 1) + ", size is 4x4."); + + for (var l = 0; l < numTestLevels; ++l) { + // Do bottom levels first; + var size = 1 << l; + var level = numLevels - l - 1; + var otherDimension = t.target == gl.TEXTURE_2D ? 1 : size; + var badSize = size * 2; + var badOtherDimension = t.target == gl.TEXTURE_2D ? 1 : badSize; + var pixels = new test.dataType(badSize * badOtherDimension * test.size); + gl.texImage2D(target, level, test.format, size, otherDimension, 0, test.format, test.type, pixels); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no error for level: " + level + " " + size + "x" + otherDimension); + gl.texImage2D(target, level, test.format, otherDimension, size, 0, test.format, test.type, pixels); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no error for level: " + level + " " + otherDimension + "x" + size); + gl.texImage2D(target, level, test.format, badSize, badOtherDimension, 0, test.format, test.type, pixels); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "should generate INVALID_VALUE for level: " + level + " " + badSize + "x" + badOtherDimension); + gl.texImage2D(target, level, test.format, badOtherDimension, badSize, 0, test.format, test.type, pixels); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "should generate INVALID_VALUE for level: " + level + " " + badOtherDimension + "x" + badSize); + } + } +} +</script> +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-size.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-size.html new file mode 100644 index 000000000..89282495d --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-size.html @@ -0,0 +1,234 @@ +<!-- + +/* +** Copyright (c) 2012 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 texture size conformance 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="example" width="32" height="32" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader" type="x-shader/x-vertex"> +attribute vec4 vPosition; +attribute vec3 texCoord0; +varying vec3 texCoord; +void main() +{ + gl_Position = vPosition; + texCoord = texCoord0; +} +</script> + +<script id="fshader" type="x-shader/x-fragment"> +precision mediump float; +uniform samplerCube tex; +varying vec3 texCoord; +void main() +{ + gl_FragColor = textureCube(tex, normalize(texCoord)); +} +</script> +<script> +"use strict"; +description("Checks that various sizes of textures render") + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("example"); +var program2D = wtu.setupTexturedQuad(gl); +var programCubeMap = wtu.setupProgram( + gl, ['vshader', 'fshader'], ['vPosition', 'texCoord0'], [0, 1]); +gl.disable(gl.DEPTH_TEST); +gl.disable(gl.BLEND); +var tex = gl.createTexture(); +var max2DSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); +var maxCubeMapSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE); +debug("MAX_TEXTURE_SIZE:" + max2DSize); +debug("MAX_CUBE_MAP_TEXTURE_SIZE:" + maxCubeMapSize); +// Assuming 2048x2048xRGBA (22meg with mips) will run on all WebGL platforms +var max2DSquareSize = Math.min(max2DSize, 2048); +// I'd prefer this to be 2048 but that's 16meg x 6 faces or 128meg (with mips) +// 1024 is 33.5 meg (with mips) +var maxCubeMapSize = Math.min(maxCubeMapSize, 1024); + +var colors = [ + { name: "green", rgba: [0, 0, 255, 255] }, + { name: "red", rgba: [255, 0, 0, 255] }, + { name: "blue", rgba: [0, 255, 0, 255] }, + { name: "yellow", rgba: [255, 255, 0, 255] }, + { name: "magenta", rgba: [255, 0, 255, 255] }, + { name: "cyan", rgba: [0, 255, 255, 255] } +]; + +var count = 0; +var power = 0; +runTest(); + +function runTest() { + function doTest() { + var size = Math.pow(2, power); + if (size > max2DSize) { + return false; + } + gl.useProgram(program2D); + if (!checkTexture(size, 1, false)) return false; + if (!checkTexture(1, size, false)) return false; + if (size <= max2DSquareSize) { + if (!checkTexture(size, size, false)) { + return false; + } + } + if (size <= maxCubeMapSize) { + gl.useProgram(programCubeMap); + if (!checkTexture(size, size, true)) { + return false; + } + } + return true; + } + + if (doTest()) { + ++power; + setTimeout(runTest, 0); + } else { + finishTest(); + } +} + +function checkTexture(width, height, cubeMap) { + debug(""); + count = (count + 1) % colors.length; + var color = colors[count]; + var tex = gl.createTexture(); + var target = cubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D; + var type = cubeMap ? "cube map" : "2D texture"; + debug("check " + width + ", " + height + " " + type); + gl.bindTexture(target, tex); + gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + fillLevel(0, width, height, color.rgba, cubeMap); + var err = gl.getError(); + if (err == gl.OUT_OF_MEMORY) { + debug("out of memory"); + return false; + } + if (err != gl.NO_ERROR) { + testFailed("unexpected gl error: " + wtu.glEnumToString(gl, err)); + } + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas(gl, color.rgba, + type + " of size " + width + "x" + height + " with no mips should draw with " + color.name); + count = (count + 1) % colors.length; + color = colors[count]; + fillLevel(0, width, height, color.rgba, cubeMap); + gl.generateMipmap(target); + var err = gl.getError(); + if (err == gl.OUT_OF_MEMORY) { + debug("out of memory"); + return false; + } + if (err != gl.NO_ERROR) { + testFailed("unexpected gl error: " + wtu.glEnumToString(gl, err)); + } + gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas(gl, color.rgba, + type + " of size " + width + "x" + height + " with mips should draw with " + color.name); + + count = (count + 1) % colors.length; + color = colors[count]; + fillLevel(0, width, height, color.rgba, cubeMap, true); + gl.generateMipmap(target); + + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas(gl, color.rgba, + type + " of size " + width + "x" + height + " with mips should draw with " + color.name); + + gl.deleteTexture(tex); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors."); + return true; +} + +function fillLevel(level, width, height, color, opt_cubemap, opt_subTex) { + var numPixels = width * height; + var pixels = null; + var largeDim = Math.max(width, height); + var smallDim = Math.min(width, height); + + var pixelRow = new Uint8Array(largeDim * 4); + for (var jj = 0; jj < largeDim; ++jj) { + var off = jj * 4; + pixelRow[off + 0] = color[0]; + pixelRow[off + 1] = color[1]; + pixelRow[off + 2] = color[2]; + pixelRow[off + 3] = color[3]; + } + + if (largeDim == numPixels) { + pixels = pixelRow; + } else { + var pixels = new Uint8Array(numPixels * 4); + for (var jj = 0; jj < smallDim; ++jj) { + var off = jj * largeDim * 4; + pixels.set(pixelRow, off); + } + } + + var targets = opt_cubemap ? [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z] : + [gl.TEXTURE_2D]; + + for (var ii = 0; ii < targets.length; ++ii) { + // debug(wtu.glEnumToString(gl, targets[ii])); + var index = (ii + power) % targets.length; + var target = targets[index]; + if (opt_subTex) { + gl.texSubImage2D( + target, level, 0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, + pixels); + } else { + gl.texImage2D( + target, level, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, + pixels); + } + } +} +</script> +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-sub-image-cube-maps.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-sub-image-cube-maps.html new file mode 100644 index 000000000..c3ba904ff --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-sub-image-cube-maps.html @@ -0,0 +1,337 @@ +<!-- + +/* +** Copyright (c) 2012 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 texture texSubImage2Ds cube map conformance 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="example" width="256" height="256" style="width: 40px; height: 40px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader" type="x-shader/x-vertex"> +attribute vec4 vPosition; +uniform mat4 rotation; +varying vec3 texCoord; +void main() +{ + gl_Position = vPosition; + vec4 direction = vec4(vPosition.x * 0.5, vPosition.y * 0.5, 1, 1); + texCoord = normalize((rotation * direction).xyz); +} +</script> + +<script id="fshader" type="x-shader/x-fragment"> +precision mediump float; +uniform samplerCube tex; +varying vec3 texCoord; +void main() +{ + gl_FragColor = textureCube(tex, normalize(texCoord)); +} +</script> +<script> +"use strict"; +var canvas; +description("Checks issues with size of cube map textures"); +debug(""); + +var wtu = WebGLTestUtils; +var canvas = document.getElementById("example"); + +var gl = wtu.create3DContext(canvas); +wtu.setupUnitQuad(gl, 0, 1); +var program = wtu.setupProgram( + gl, + ['vshader', 'fshader'], + ['vPosition', 'texCoord0'], [0, 1]); +var rotLoc = gl.getUniformLocation(program, "rotation"); + +var size = 16; + +var colors = [ + {name: 'red', color: [255, 0, 0, 255]}, + {name: 'green', color: [ 0, 255, 0, 255]}, + {name: 'blue', color: [ 0, 0, 255, 255]}, + {name: 'yellow', color: [255, 255, 0, 255]}, + {name: 'cyan', color: [ 0, 255, 255, 255]}, + {name: 'magenta', color: [255, 0, 255, 255]} +]; + +var targets = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z]; + +var rotations = [ + {axis: [0, 1, 0], angle: Math.PI / 2}, + {axis: [0, 1, 0], angle: -Math.PI / 2}, + {axis: [1, 0, 0], angle: -Math.PI / 2}, + {axis: [1, 0, 0], angle: Math.PI / 2}, + {axis: [0, 1, 0], angle: 0}, + {axis: [0, 1, 0], angle: Math.PI}, +]; + +var halfRotations = [ + {colors: [3, 4], rotations: [{axis: [1, 0, 0], angle: Math.PI / 4}]}, + {colors: [4, 2], rotations: [{axis: [1, 0, 0], angle: -Math.PI / 4}]}, + {colors: [5, 3], rotations: [{axis: [1, 0, 0], angle: Math.PI / 4 * 3}]}, + {colors: [2, 5], rotations: [{axis: [1, 0, 0], angle: -Math.PI / 4 * 3}]}, + {colors: [3, 0], rotations: [{axis: [0, 1, 0], angle: Math.PI / 2}, + {axis: [1, 0, 0], angle: Math.PI / 4}]}, + {colors: [0, 2], rotations: [{axis: [0, 1, 0], angle: Math.PI / 2}, + {axis: [1, 0, 0], angle: -Math.PI / 4}]}, +]; + +var count = 0; +testSize(size); + +function testSize(size) { + debug(""); + debug("testing size: " + size); + var canvasSize = Math.max(size / 4, 2); + canvas.width = canvasSize; + canvas.height = canvasSize; + gl.viewport(0, 0, canvasSize, canvasSize); + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex); + + // Seems like I should be using LINEAR here with some other math + // to make sure I get more mip coverage but that's easier said + // than done. + + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + + for (var jj = 0; jj < 2; ++jj) { + for (var tt = 0; tt < targets.length; ++tt) { + var color = colors[(tt + count) % colors.length]; + fillLevel(targets[tt], 0, size, color.color); + } + if (jj == 1) { + debug("use mipmap"); + gl.texParameteri( + gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, + gl.NEAREST_MIPMAP_NEAREST); + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + } + + var err = gl.getError(); + if (err == gl.OUT_OF_MEMORY) { + debug("out of memory"); + return false; + } + if (err != gl.NO_ERROR) { + testFailed("unexpected gl error: " + wtu.glEnumToString(gl, err)); + } + + + for (var rr = 0; rr < rotations.length; ++rr) { + var rot = rotations[rr]; + var color = colors[(rr + count) % colors.length]; + var rotMat = axisRotation(rot.axis, rot.angle); + gl.uniformMatrix4fv(rotLoc, false, rotMat); + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, color.color, + wtu.glEnumToString(gl, targets[rr]) + " should be " + color.name); + } + + for (var rr = 0; rr < halfRotations.length; ++rr) { + var h = halfRotations[rr]; + var rots = h.rotations; + var rotMat = axisRotation(rots[0].axis, rots[0].angle); + for (var ii = 1; ii < rots.length; ++ii) { + var tmpMat = axisRotation(rots[ii].axis, rots[ii].angle); + var rotMat = mulMatrix(tmpMat, rotMat); + } + gl.uniformMatrix4fv(rotLoc, false, rotMat); + wtu.clearAndDrawUnitQuad(gl); + + for (var ii = 0; ii < 2; ++ii) { + checkRect( + 0, + canvasSize / 2 * ii, + canvasSize, + canvasSize / 2, + colors[(h.colors[ii] + count) % colors.length]); + } + } + ++count; + } + + gl.deleteTexture(tex); + return true; +} + +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors."); + +function checkRect(x, y, width, height, color) { + wtu.checkCanvasRect( + gl, + x, + y, + width, + height, + color.color, + "" + x + ", " + y + ", " + width + ", " + height + + " should be " + color.name); +} + +function fillLevel(target, level, size, color) { + var numPixels = size * size; + var halfPixelRow = new Uint8Array(size * 2); + for (var jj = 0; jj < size; ++jj) { + var off = jj * 4; + halfPixelRow[off + 0] = color[0]; + halfPixelRow[off + 1] = color[1]; + halfPixelRow[off + 2] = color[2]; + halfPixelRow[off + 3] = color[3]; + } + gl.texImage2D( + target, level, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE, + null); + for (var jj = 0; jj < size; ++jj) { + gl.texSubImage2D( + target, level, 0, jj, size / 2, 1, gl.RGBA, gl.UNSIGNED_BYTE, halfPixelRow); + gl.texSubImage2D( + target, level, size / 2, jj, size / 2, 1, gl.RGBA, gl.UNSIGNED_BYTE, halfPixelRow); + } +} + +function printMat(mat) { + debug("" + mat[0] + ", " + mat[1] + ", " + mat[2] + ", " + mat[3] + ", "); + debug("" + mat[4] + ", " + mat[5] + ", " + mat[6] + ", " + mat[7] + ", "); + debug("" + mat[8] + ", " + mat[9] + ", " + mat[10] + ", " + mat[11] + ", "); + debug("" + mat[12] + ", " + mat[13] + ", " + mat[14] + ", " + mat[15] + ", "); +} + +function axisRotation(axis, angle) { + var dst = new Float32Array(16); + var x = axis[0]; + var y = axis[1]; + var z = axis[2]; + var n = Math.sqrt(x * x + y * y + z * z); + x /= n; + y /= n; + z /= n; + var xx = x * x; + var yy = y * y; + var zz = z * z; + var c = Math.cos(angle); + var s = Math.sin(angle); + var oneMinusCosine = 1 - c; + + dst[ 0] = xx + (1 - xx) * c; + dst[ 1] = x * y * oneMinusCosine + z * s; + dst[ 2] = x * z * oneMinusCosine - y * s; + dst[ 3] = 0; + dst[ 4] = x * y * oneMinusCosine - z * s; + dst[ 5] = yy + (1 - yy) * c; + dst[ 6] = y * z * oneMinusCosine + x * s; + dst[ 7] = 0; + dst[ 8] = x * z * oneMinusCosine + y * s; + dst[ 9] = y * z * oneMinusCosine - x * s; + dst[10] = zz + (1 - zz) * c; + dst[11] = 0; + dst[12] = 0; + dst[13] = 0; + dst[14] = 0; + dst[15] = 1; + + return dst; +}; + +function mulMatrix(a, b) { + var dst = new Float32Array(16); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[ 4 + 0]; + var a11 = a[ 4 + 1]; + var a12 = a[ 4 + 2]; + var a13 = a[ 4 + 3]; + var a20 = a[ 8 + 0]; + var a21 = a[ 8 + 1]; + var a22 = a[ 8 + 2]; + var a23 = a[ 8 + 3]; + var a30 = a[12 + 0]; + var a31 = a[12 + 1]; + var a32 = a[12 + 2]; + var a33 = a[12 + 3]; + var b00 = b[0]; + var b01 = b[1]; + var b02 = b[2]; + var b03 = b[3]; + var b10 = b[ 4 + 0]; + var b11 = b[ 4 + 1]; + var b12 = b[ 4 + 2]; + var b13 = b[ 4 + 3]; + var b20 = b[ 8 + 0]; + var b21 = b[ 8 + 1]; + var b22 = b[ 8 + 2]; + var b23 = b[ 8 + 3]; + var b30 = b[12 + 0]; + var b31 = b[12 + 1]; + var b32 = b[12 + 2]; + var b33 = b[12 + 3]; + dst[ 0] = a00 * b00 + a01 * b10 + a02 * b20 + a03 * b30; + dst[ 1] = a00 * b01 + a01 * b11 + a02 * b21 + a03 * b31; + dst[ 2] = a00 * b02 + a01 * b12 + a02 * b22 + a03 * b32; + dst[ 3] = a00 * b03 + a01 * b13 + a02 * b23 + a03 * b33; + dst[ 4] = a10 * b00 + a11 * b10 + a12 * b20 + a13 * b30; + dst[ 5] = a10 * b01 + a11 * b11 + a12 * b21 + a13 * b31; + dst[ 6] = a10 * b02 + a11 * b12 + a12 * b22 + a13 * b32; + dst[ 7] = a10 * b03 + a11 * b13 + a12 * b23 + a13 * b33; + dst[ 8] = a20 * b00 + a21 * b10 + a22 * b20 + a23 * b30; + dst[ 9] = a20 * b01 + a21 * b11 + a22 * b21 + a23 * b31; + dst[10] = a20 * b02 + a21 * b12 + a22 * b22 + a23 * b32; + dst[11] = a20 * b03 + a21 * b13 + a22 * b23 + a23 * b33; + dst[12] = a30 * b00 + a31 * b10 + a32 * b20 + a33 * b30; + dst[13] = a30 * b01 + a31 * b11 + a32 * b21 + a33 * b31; + dst[14] = a30 * b02 + a31 * b12 + a32 * b22 + a33 * b32; + dst[15] = a30 * b03 + a31 * b13 + a32 * b23 + a33 * b33; + return dst; +}; + +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> + + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-transparent-pixels-initialized.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-transparent-pixels-initialized.html new file mode 100644 index 000000000..fc87f7fbc --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-transparent-pixels-initialized.html @@ -0,0 +1,106 @@ +<!-- +/* +** Copyright (c) 2012 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"> +<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> +<script> +"use strict"; +var wtu = WebGLTestUtils; +var gl = null; +var texture; +var textureLoc = null; +var successfullyParsed = false; + +function init() +{ + description('Tests there is no garbage in transparent regions of images uploaded as textures'); + + wtu = WebGLTestUtils; + gl = wtu.create3DContext("example"); + var program = wtu.setupTexturedQuad(gl); + gl.clearColor(0.5,0.5,0.5,1); + gl.clearDepth(1); + + textureLoc = gl.getUniformLocation(program, "tex"); + + // The input texture has 8 characters; take the leftmost one + var coeff = 1.0 / 8.0; + var texCoords = new Float32Array([ + coeff, 1.0, + 0.0, 1.0, + 0.0, 0.0, + coeff, 1.0, + 0.0, 0.0, + coeff, 0.0]); + + var vbo = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, vbo); + gl.bufferData(gl.ARRAY_BUFFER, texCoords, gl.STATIC_DRAW); + gl.enableVertexAttribArray(1); + gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 0, 0); + + texture = wtu.loadTexture(gl, "../../../resources/bug-32888-texture.png", runTest); +} + +// These two declarations need to be global for "shouldBe" to see them +var buf = null; +var idx = 0; + +function runTest() +{ + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + gl.enable(gl.BLEND); + gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); + // Bind the texture to texture unit 0 + gl.bindTexture(gl.TEXTURE_2D, texture); + // Point the uniform sampler to texture unit 0 + gl.uniform1i(textureLoc, 0); + // Draw the triangles + wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 255]); + + // Spot check a couple of 2x2 regions in the upper and lower left + // corners; they should be the rgb values in the texture. + var color = [0, 0, 0]; + debug("Checking lower left corner"); + wtu.checkCanvasRect(gl, 1, gl.canvas.height - 3, 2, 2, color, + "shouldBe " + color); + debug("Checking upper left corner"); + wtu.checkCanvasRect(gl, 1, 1, 2, 2, color, + "shouldBe " + color); + + finishTest(); +} +</script> +</head> +<body onload="init()"> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-upload-cube-maps.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-upload-cube-maps.html new file mode 100644 index 000000000..6618ff8c7 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-upload-cube-maps.html @@ -0,0 +1,73 @@ +<!-- + +/* +** Copyright (c) 2012 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"> +<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="example" width="2" height="2"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description('Tests texImage2D and texSubImage2D upload path for TEXTURE_CUBE_MAP'); + +var wtu = WebGLTestUtils; +var canvas = document.getElementById("example"); +var gl = wtu.create3DContext(canvas); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + +function testOneTarget(target, width, height) { + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from bindTexture(TEXTURE_CUBE_MAP)."); + + gl.texImage2D(target, 0, gl.RGB, width, height, 0, gl.RGB, gl.UNSIGNED_BYTE, null); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from texImage2D."); + + var buf = new Uint8Array(width * height * 3); + gl.texSubImage2D(target, 0, 0, 0, width, height, gl.RGB, gl.UNSIGNED_BYTE, buf); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from texSubImage2D."); +} + +testOneTarget(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 16, 16); +testOneTarget(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 16, 16); +testOneTarget(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 16, 16); +testOneTarget(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 16, 16); +testOneTarget(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 16, 16); +testOneTarget(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 16, 16); + +var successfullyParsed = true; +</script> +<script src="../../../js/js-test-post.js"></script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-upload-size.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-upload-size.html new file mode 100644 index 000000000..b5b5a12e5 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/misc/texture-upload-size.html @@ -0,0 +1,169 @@ +<!-- + +/* +** Copyright (c) 2014 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 texture upload size conformance 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="canvas"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +enableJSTestPreVerboseLogging(); +description("Checks that the size of a texture uploaded from an element is set correctly."); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("canvas"); + +var tex = gl.createTexture(); +gl.bindTexture(gl.TEXTURE_2D, tex); + +var testUpload = function(upload, expectedWidth, expectedHeight) { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, upload); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "when calling texImage2D"); + wtu.checkTextureSize(gl, expectedWidth, expectedHeight); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, upload); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "when calling texSubImage2D with the same texture upload"); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, upload); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "when calling texSubImage2D with the same texture upload with offset 1, 1"); +}; + +var testImage = function(test, img) { + var width = img.width; + var height = img.height; + testUpload(img, width, height); + + debug("Testing changing the width and height attributes of the image"); + img.width *= 2; + img.height *= 2; + if (test.isSVG) { + testUpload(img, img.width, img.height); + } else { + testUpload(img, width, height); + } +}; + +var testVideo = function(test, video) { + // Assuming that the video is not anamorphic, nor has clean aperture data + // that would make the frame size in pixels different. + var width = video.videoWidth; + var height = video.videoHeight; + testUpload(video, width, height); + + debug("Testing changing the width and height attributes of the video"); + video.width *= 2; + video.height *= 2; + testUpload(video, width, height); +}; + +var createCanvas2DContext = function(width, height) { + var canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + var ctx = canvas.getContext("2d"); + ctx.fillRect(0, 0, width, height); + return ctx; +}; + +var testImageData = function(test) { + var ctx = createCanvas2DContext(test.width, test.height); + var imageData = ctx.getImageData(0, 0, test.width, test.height); + testUpload(imageData, test.width, test.height); +}; + +var testCanvas = function(test) { + var ctx = createCanvas2DContext(test.width, test.height); + testUpload(ctx.canvas, test.width, test.height); + + debug("Testing changing the dimensions of the same canvas"); + ctx.canvas.width = test.width + 1; + ctx.canvas.height = test.height + 1; + testUpload(ctx.canvas, ctx.canvas.width, ctx.canvas.height); +}; + +var tests = [ + {type: "ImageData", width: 123, height: 456}, + {type: "canvas", width: 123, height: 456}, + {type: "img", isSVG: false, src: "../../../resources/red-green.png"}, + {type: "img", isSVG: true, src: "../../../resources/red-green.svg"}, + {type: "video", src: "../../../resources/red-green.mp4", videoType: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'}, + {type: "video", src: "../../../resources/red-green.webmvp9.webm", videoType: 'video/webm; codecs="vp9"'}, + {type: "video", src: "../../../resources/red-green.webmvp8.webm", videoType: 'video/webm; codecs="vp8, vorbis"'}, + {type: "video", src: "../../../resources/red-green.theora.ogv", videoType: 'video/ogg; codecs="theora, vorbis"'}, +]; + +var testIndex = 0; + +var runNextTest = function() { + if (testIndex < tests.length) { + debug(""); + var test = tests[testIndex]; + ++testIndex; + if (test.type == "img") { + debug("HTMLImageElement" + (test.isSVG ? " (SVG)" : "")); + var img = wtu.makeImage(test.src, function() { + testImage(test, img); + setTimeout(runNextTest, 0); + }); + } else if (test.type == "video") { + debug("HTMLVideoElement (" + test.videoType + ")"); + var video = wtu.makeVideo(test.src); + if(!video.canPlayType(test.videoType).replace(/no/, '')) { + debug(test.videoType + " unsupported"); + setTimeout(runNextTest, 0); + return; + } + wtu.startPlayingAndWaitForVideo(video, function() { + testVideo(test, video); + setTimeout(runNextTest, 0); + }); + } else if (test.type == "ImageData") { + debug("ImageData"); + testImageData(test); + setTimeout(runNextTest, 0); + } else if (test.type == "canvas") { + debug("HTMLCanvasElement"); + testCanvas(test); + setTimeout(runNextTest, 0); + } + } else { + finishTest(); + } +}; + +runNextTest(); +</script> +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..0497a33e3 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-svg-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..dba7ce559 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-svg-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..f26490a74 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-svg-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..7bd9d9976 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-svg-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..c0e8f9c06 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-svg-image.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..a32d53737 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-video.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..d61089ca5 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-video.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..2c47f7a00 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-video.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..6f0025671 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-video.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..a42ea67ef --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/video/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-video.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/00_test_list.txt new file mode 100644 index 000000000..07f29f640 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/00_test_list.txt @@ -0,0 +1,5 @@ +tex-2d-rgb-rgb-unsigned_byte.html +tex-2d-rgb-rgb-unsigned_short_5_6_5.html +tex-2d-rgba-rgba-unsigned_byte.html +tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html +tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgb-rgb-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgb-rgb-unsigned_byte.html new file mode 100644 index 000000000..9cb3e37b2 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgb-rgb-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-webgl-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html new file mode 100644 index 000000000..f38dfef8e --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-webgl-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGB", "RGB", "UNSIGNED_SHORT_5_6_5", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_byte.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_byte.html new file mode 100644 index 000000000..e5bb12e06 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_byte.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-webgl-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_BYTE", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html new file mode 100644 index 000000000..ef252e0d8 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-webgl-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html new file mode 100644 index 000000000..76878aef5 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html @@ -0,0 +1,57 @@ +<!-- + +Copyright (c) 2015 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. + +--> + +<!-- + +This file is auto-generated from py/tex_image_test_generator.py +DO NOT EDIT! + +--> + + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<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> +<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script> +<script src="../../../js/tests/tex-image-and-sub-image-2d-with-webgl-canvas.js"></script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +function testPrologue(gl) { + return true; +} + +generateTest("RGBA", "RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue, "../../../resources/", 1)(); +</script> +</body> +</html> |