summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-mochitest/test_tex_unit_different_sampler_types.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/canvas/test/webgl-mochitest/test_tex_unit_different_sampler_types.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/canvas/test/webgl-mochitest/test_tex_unit_different_sampler_types.html')
-rw-r--r--dom/canvas/test/webgl-mochitest/test_tex_unit_different_sampler_types.html54
1 files changed, 54 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-mochitest/test_tex_unit_different_sampler_types.html b/dom/canvas/test/webgl-mochitest/test_tex_unit_different_sampler_types.html
new file mode 100644
index 0000000000..3664f40ff7
--- /dev/null
+++ b/dom/canvas/test/webgl-mochitest/test_tex_unit_different_sampler_types.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<script src='/tests/SimpleTest/SimpleTest.js'></script>
+</head>
+<body>
+<pre id=e_out></pre>
+<script>
+
+ok = window.ok || function(e, s) {
+ e_out.textContent += `\n${!e ? 'FAIL' : 'pass'}: ${s}`;
+};
+
+const canvas = document.createElement('canvas');
+const gl = canvas.getContext('webgl');
+const program = gl.createProgram();
+const vertex = gl.createShader(gl.VERTEX_SHADER);
+
+gl.shaderSource(vertex, `\
+ precision highp float;
+ varying vec2 v_vec2;
+ varying vec3 v_vec3;
+ void main() { }
+`);
+gl.compileShader(vertex);
+gl.attachShader(program, vertex);
+
+const fragment = gl.createShader(gl.FRAGMENT_SHADER);
+gl.shaderSource(fragment, `\
+ precision highp float;
+ varying vec2 v_vec2;
+ varying vec3 v_vec3;
+ uniform sampler2D u_sampler2d;
+ uniform samplerCube u_samplercube;
+ void main() {
+ gl_FragColor = texture2D(u_sampler2d, v_vec2);
+ gl_FragColor += textureCube(u_samplercube, normalize(v_vec3));
+ }
+`);
+gl.compileShader(fragment);
+gl.attachShader(program, fragment);
+
+gl.linkProgram(program);
+gl.useProgram(program);
+gl.drawArrays(gl.TRIANGLE_STRIP, 29, 32);
+let err = gl.getError();
+ok(err == gl.INVALID_OPERATION, `err: ${err}`);
+
+ok(true, `Done.`);
+
+</script>
+</body>
+</html>