dom/canvas/test/webgl-conf/checkout/conformance2/glsl3/misplaced-version-directive.html
author Dana Keeler <dkeeler@mozilla.com>
Sat, 12 Jul 2025 15:57:37 +0000 (13 hours ago)
changeset 796342 3a804f83c6b282c3c6b6ed9b67bacbc277bfb300
parent 515042 f3948e689af746c84af3a24b00e0a33762d15cf7
permissions -rw-r--r--
Bug 1976779 - rsclientcerts: make each backend responsible for rate-limiting calls to find_objects r=jschanck Before this patch, `rsclientcerts::manager` would rate-limit calls to `find_objects` to once every 3 seconds because the underlying operation can be time-consuming (in particular, on macOS and Windows, if there are many certificates/keys available). On Android, keys aren't available until the user selects one, which means that if a call to `find_objects` happened before the selection prompt was shown (which is what happens) and the user chose one in less than 3 seconds, the backend wouldn't search again, thus making it seem like no keys were available, which would cause Firefox to not send a client certificate. This patch makes each backend implementation responsible for this rate-limiting, because only they know if it's appropriate to do so (in particular, on Android, `find_objects` doesn't have the same performance concern as on macOS and Windows because rather than searching for certificates and keys, it asks `ClientAuthCertificateManager` for the cached list of certificates and keys that have already been approved for use by the user). Differential Revision: https://phabricator.services.mozilla.com/D257065
<!--
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.
-->

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>#version directive should be on the very first line of a OpenGL ES Shading Language 3.00 shader</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../js/js-test-pre.js"></script>
<script src="../../js/webgl-test-utils.js"></script>
<script src="../../js/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<!-- Version directive should be on the very first line in ESSL 3, see ESSL 3 section 3.3 -->
<script id="VertexShaderCommentBeforeVersion" type="x-shader/x-vertex">// This shader is wrong, this is the first line that should have version
#version 300 es
precision mediump float;
in vec4 aPosition;

void main() {
    gl_Position = aPosition;
}
</script>
<script id="VertexShaderNewlineBeforeVersion" type="x-shader/x-vertex">
#version 300 es
precision mediump float;
in vec4 aPosition;

void main() {
    gl_Position = aPosition;
}
</script>
<script id="CorrectVertexShader" type="x-shader/x-vertex">#version 300 es
precision mediump float;
in vec4 aPosition;

void main() {
    gl_Position = aPosition;
}
</script>
<script id="FragmentShaderCommentBeforeVersion" type="x-shader/x-fragment">// This shader is wrong, this is the first line that should have version
#version 300 es
precision mediump float;
out vec4 my_FragColor;
void main() {
    my_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
}
</script>
<script id="FragmentShaderNewlineBeforeVersion" type="x-shader/x-fragment">
#version 300 es
precision mediump float;
out vec4 my_FragColor;
void main() {
    my_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
}
</script>
<script id="CorrectFragmentShader" type="x-shader/x-fragment">#version 300 es
precision mediump float;
out vec4 my_FragColor;
void main() {
    my_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
}
</script>
<script type="application/javascript">
"use strict";
description();
GLSLConformanceTester.runTests([
  {
    vShaderId: "VertexShaderNewlineBeforeVersion",
    vShaderSuccess: false,
    fShaderId: "CorrectFragmentShader",
    fShaderSuccess: true,
    linkSuccess: false,
    passMsg: "Vertex shader with a newline before the version directive should fail."
  },
  {
    vShaderId: "VertexShaderCommentBeforeVersion",
    vShaderSuccess: false,
    fShaderId: "CorrectFragmentShader",
    fShaderSuccess: true,
    linkSuccess: false,
    passMsg: "Vertex shader with a comment before the version directive should fail."
  },
  {
    vShaderId: "CorrectVertexShader",
    vShaderSuccess: true,
    fShaderId: "FragmentShaderCommentBeforeVersion",
    fShaderSuccess: false,
    linkSuccess: false,
    passMsg: "Fragment shader with a comment before the version directive should fail."
  },
  {
    vShaderId: "CorrectVertexShader",
    vShaderSuccess: true,
    fShaderId: "FragmentShaderNewlineBeforeVersion",
    fShaderSuccess: false,
    linkSuccess: false,
    passMsg: "Fragment shader with a newline before the version directive should fail."
  }
], 2);
var successfullyParsed = true;
</script>
</body>
</html>