summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/conformance/extensions/ext-float-blend.html
blob: a825d78bef6e9c891784cd5a3814f150d52f911e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL EXT_float_blend 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 src="../../js/tests/ext-float-blend.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
"use strict";
description("This test verifies the functionality of the EXT_float_blend extension, if it is available.");

var wtu = WebGLTestUtils;
var canvas = document.getElementById("canvas");
var gl = wtu.create3DContext(canvas);
var ext = null;

function extFloatBlendTests(version, config) {
    debug("");
    debug("Testing float32 blending without EXT_float_blend");
    testExtFloatBlend(config.internalFormat);
    testExtFloatBlendMRT(version, config.drawBuffers);
    testExtFloatBlendNonFloat32Type(version, config.oesTextureHalfFloat);

    const floatBlend = gl.getExtension("EXT_float_blend");
    if (!floatBlend) {
        testPassed("EXT_float_blend is allowed to be missing.");
        return;
    }

    debug("");
    debug("Testing that float32 blending is allowed with EXT_float_blend");
    testExtFloatBlend(config.internalFormat);
    testExtFloatBlendMRT(version, config.drawBuffers);
    testExtFloatBlendNonFloat32Type(version, config.oesTextureHalfFloat);
}

(function(){
    if (wtu.getDefault3DContextVersion() < 2) {
        const oesTextureFloat = gl.getExtension("OES_texture_float");
        if (!oesTextureFloat) {
            testPassed("OES_texture_float is allowed to be missing.");
            return;
        }

        const colorBufferFloat = gl.getExtension("WEBGL_color_buffer_float");
        if (!colorBufferFloat) {
            testPassed("WEBGL_color_buffer_float is allowed to be missing.");
            return;
        }

        const drawBuffers = gl.getExtension("WEBGL_draw_buffers");
        if (!drawBuffers) {
            debug("WEBGL_draw_buffers is allowed to be missing. MRT tests will be skipped.");
        }

        const oesTextureHalfFloat = gl.getExtension("OES_texture_half_float");
        const extColorBufferHalfFloat = gl.getExtension("EXT_color_buffer_half_float");
        const testHalfFloat = !(!oesTextureHalfFloat || !extColorBufferHalfFloat);
        if (!testHalfFloat) {
            debug("OES_texture_half_float or EXT_color_buffer_half_float is allowed to be missing. NonFloat32Type tests will be skipped.");
        }

        const internalFormat = gl.RGBA;
        extFloatBlendTests(1, {
            internalFormat, drawBuffers, oesTextureHalfFloat
        });
    } else {
        const colorBufferFloat = gl.getExtension("EXT_color_buffer_float");
        if (!colorBufferFloat) {
            testPassed("EXT_color_buffer_float is allowed to be missing.");
            return;
        }

        const internalFormat = gl.RGBA32F;
        extFloatBlendTests(2, {
            internalFormat
        });
    }
})();

debug("");
var successfullyParsed = true;
</script>
<script src="../../js/js-test-post.js"></script>

</body>
</html>
<!--
Copyright (c) 2019 The Khronos Group Inc.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE.txt file.
-->