mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-20 00:20:37 +00:00
Bug 1328559 (flattened) - Built-in attribs should have location of -1. - r=daoshengmu
But ANGLE gives back valid >=0 locations! MozReview-Commit-ID: 9zYiX5BGGud
This commit is contained in:
parent
94547f20bb
commit
b6fd571b9e
@ -172,7 +172,7 @@ webgl::UniformInfo::UniformInfo(WebGLActiveInfo* activeInfo)
|
||||
|
||||
//////////
|
||||
|
||||
#define DUMP_SHADERVAR_MAPPINGS
|
||||
//#define DUMP_SHADERVAR_MAPPINGS
|
||||
|
||||
static already_AddRefed<const webgl::LinkedProgramInfo>
|
||||
QueryProgramInfo(WebGLProgram* prog, gl::GLContext* gl)
|
||||
@ -240,12 +240,22 @@ QueryProgramInfo(WebGLProgram* prog, gl::GLContext* gl)
|
||||
|
||||
///////
|
||||
|
||||
const GLint loc = gl->fGetAttribLocation(prog->mGLName,
|
||||
mappedName.BeginReading());
|
||||
GLint loc = gl->fGetAttribLocation(prog->mGLName,
|
||||
mappedName.BeginReading());
|
||||
if (gl->WorkAroundDriverBugs() &&
|
||||
mappedName.EqualsIgnoreCase("gl_", 3))
|
||||
{
|
||||
// Catch when this is fixed, so we can remove this.
|
||||
// Or, discover if this happens outside ANGLE.
|
||||
MOZ_ASSERT(gl->IsANGLE() == (loc != -1));
|
||||
|
||||
loc = -1;
|
||||
}
|
||||
#ifdef DUMP_SHADERVAR_MAPPINGS
|
||||
printf_stderr("[attrib %u/%u] @%i %s->%s\n", i, numActiveAttribs, loc,
|
||||
userName.BeginReading(), mappedName.BeginReading());
|
||||
#endif
|
||||
MOZ_ASSERT_IF(mappedName.EqualsIgnoreCase("gl_", 3), loc == -1);
|
||||
|
||||
///////
|
||||
|
||||
|
@ -4,6 +4,7 @@ context/00_test_list.txt
|
||||
extensions/00_test_list.txt
|
||||
glsl3/00_test_list.txt
|
||||
misc/00_test_list.txt
|
||||
programs/00_test_list.txt
|
||||
query/00_test_list.txt
|
||||
reading/00_test_list.txt
|
||||
renderbuffers/00_test_list.txt
|
||||
|
@ -0,0 +1,2 @@
|
||||
active-built-in-attribs.html
|
||||
gl-get-frag-data-location.html
|
@ -0,0 +1,107 @@
|
||||
<!--
|
||||
|
||||
/*
|
||||
** 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>WebGL Conformance Tests: Verify validation for active built-in attribs</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>
|
||||
<canvas id="canvas" style="width: 64px; height: 64px;"> </canvas>
|
||||
<div id="console"></div>
|
||||
<script id="vs" type="x-shader/x-vertex">#version 300 es
|
||||
void main() {
|
||||
gl_Position = vec4(gl_VertexID % 2, (gl_VertexID/2) % 2, 0, 1);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id="fs" type="x-shader/x-fragment">#version 300 es
|
||||
precision mediump float;
|
||||
out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = vec4(0, 1, 0, 1);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
description("This test verifies validation for active built-in attribs.");
|
||||
|
||||
debug("");
|
||||
|
||||
var wtu = WebGLTestUtils;
|
||||
var canvas = document.getElementById("canvas");
|
||||
var gl = wtu.create3DContext(canvas, null, 2);
|
||||
|
||||
if (!gl) {
|
||||
testFailed("WebGL context does not exist");
|
||||
} else {
|
||||
testPassed("WebGL context exists");
|
||||
runTests();
|
||||
}
|
||||
|
||||
var activeInfo, attribLoc;
|
||||
|
||||
function runTests() {
|
||||
var prog = wtu.setupProgram(gl, ["vs", "fs"]);
|
||||
if (!prog) {
|
||||
testFailed("Set up program failed");
|
||||
return;
|
||||
}
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "No GL error from set up");
|
||||
|
||||
var numActive = gl.getProgramParameter(prog, gl.ACTIVE_ATTRIBUTES);
|
||||
if (numActive != 1) {
|
||||
testFailed('ACTIVE_ATTRIBUTES should be 1.');
|
||||
return;
|
||||
}
|
||||
testPassed('ACTIVE_ATTRIBUTES should be 1.');
|
||||
|
||||
activeInfo = gl.getActiveAttrib(prog, 0);
|
||||
if (!activeInfo) {
|
||||
testFailed('getActiveAttrib should return an info object.');
|
||||
return;
|
||||
}
|
||||
|
||||
shouldBe('activeInfo.name', '"gl_VertexID"');
|
||||
attribLoc = gl.getAttribLocation(prog, 'gl_VertexID');
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be able to request the location of a built-in.");
|
||||
shouldBe('attribLoc', '-1');
|
||||
}
|
||||
|
||||
var successfullyParsed = true;
|
||||
</script>
|
||||
<script src="../../js/js-test-post.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,121 @@
|
||||
<!--
|
||||
|
||||
/*
|
||||
** 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>WebGL Conformance Tests: Verify getFragDataLocation</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>
|
||||
<canvas id="canvas" style="width: 4px; height: 4px;"> </canvas>
|
||||
<div id="console"></div>
|
||||
<script id="vs" type="x-shader/x-vertex">#version 300 es
|
||||
void main() {
|
||||
gl_Position = vec4(0, 0, 0, 1);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id="fs" type="x-shader/x-fragment">#version 300 es
|
||||
precision mediump float;
|
||||
layout(location = 2) out vec4 fragColor0;
|
||||
layout(location = 0) out vec4 fragColor1;
|
||||
void main() {
|
||||
fragColor0 = vec4(0, 1, 0, 1);
|
||||
fragColor1 = vec4(1, 0, 0, 1);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id="fs-array" type="x-shader/x-fragment">#version 300 es
|
||||
precision mediump float;
|
||||
out vec4 fragColor[2];
|
||||
void main() {
|
||||
fragColor[0] = vec4(0, 1, 0, 1);
|
||||
fragColor[1] = vec4(1, 0, 0, 1);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
description("This test verifies getFragDataLocation behaviors.");
|
||||
|
||||
debug("");
|
||||
|
||||
var wtu = WebGLTestUtils;
|
||||
var canvas = document.getElementById("canvas");
|
||||
var gl = wtu.create3DContext(canvas, null, 2);
|
||||
|
||||
if (!gl) {
|
||||
testFailed("WebGL context does not exist");
|
||||
} else {
|
||||
testPassed("WebGL context exists");
|
||||
runTests();
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
var program = wtu.setupProgram(gl, ["vs", "fs"]);
|
||||
var programArray = wtu.setupProgram(gl, ["vs", "fs-array"]);
|
||||
if (!program || !programArray) {
|
||||
testFailed("Set up program failed");
|
||||
return;
|
||||
}
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "No GL error from set up");
|
||||
|
||||
var loc0 = gl.getFragDataLocation(program, "fragColor0");
|
||||
var loc1 = gl.getFragDataLocation(program, "fragColor1");
|
||||
if (loc0 != 2 || loc1 != 0) {
|
||||
testFailed("Fail to query scalar output variable locations, " +
|
||||
"expected: fragColor0->2, fragColor1->0, " +
|
||||
"got: fragColor0->" + loc0 + ", fragColor1->" + loc1);
|
||||
} else {
|
||||
testPassed("getFragDataLocation on scalar variables works fine");
|
||||
}
|
||||
|
||||
var loc = gl.getFragDataLocation(programArray, "fragColor");
|
||||
loc0 = gl.getFragDataLocation(programArray, "fragColor[0]");
|
||||
loc1 = gl.getFragDataLocation(programArray, "fragColor[1]");
|
||||
if (loc < 0 || loc0 < 0 || loc1 < 0 || loc != loc0 || loc0 + 1 != loc1) {
|
||||
testFailed("Fail to query scalar output variable locations, " +
|
||||
"expected: fragColor->0, fragColor[0]->0, fragColor[1]->1, " +
|
||||
"got: fragColor->" + loc + ", fragColor[0]->" + loc0 + ", fragColor[1]->" + loc1);
|
||||
} else {
|
||||
testPassed("getFragDataLocation on variable arrays works fine");
|
||||
}
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "No GL error from testing");
|
||||
}
|
||||
|
||||
var successfullyParsed = true;
|
||||
</script>
|
||||
<script src="../../js/js-test-post.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -2457,6 +2457,9 @@ support-files = always-fail.html
|
||||
checkout/conformance2/misc/expando-loss-2.html
|
||||
checkout/conformance2/misc/instanceof-test.html
|
||||
checkout/conformance2/misc/uninitialized-test-2.html
|
||||
checkout/conformance2/programs/00_test_list.txt
|
||||
checkout/conformance2/programs/active-built-in-attribs.html
|
||||
checkout/conformance2/programs/gl-get-frag-data-location.html
|
||||
checkout/conformance2/query/00_test_list.txt
|
||||
checkout/conformance2/query/occlusion-query.html
|
||||
checkout/conformance2/query/query.html
|
||||
@ -4548,6 +4551,10 @@ skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.
|
||||
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
|
||||
[generated/test_2_conformance2__misc__uninitialized-test-2.html]
|
||||
skip-if = (os == 'mac') || (os == 'win') || (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
|
||||
[generated/test_2_conformance2__programs__active-built-in-attribs.html]
|
||||
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
|
||||
[generated/test_2_conformance2__programs__gl-get-frag-data-location.html]
|
||||
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
|
||||
[generated/test_2_conformance2__query__occlusion-query.html]
|
||||
skip-if = (os == 'win') || (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
|
||||
[generated/test_2_conformance2__query__query.html]
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- GENERATED FILE, DO NOT EDIT -->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'/>
|
||||
<title>
|
||||
Mochitest wrapper for WebGL Conformance Test Suite tests
|
||||
</title>
|
||||
<link rel='stylesheet' type='text/css' href='../iframe-passthrough.css'/>
|
||||
|
||||
<script src='/tests/SimpleTest/SimpleTest.js'></script>
|
||||
<link rel='stylesheet' type='text/css' href='/tests/SimpleTest/test.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='../mochi-single.html?checkout/conformance2/programs/active-built-in-attribs.html?webglVersion=2'></iframe>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,17 @@
|
||||
<!-- GENERATED FILE, DO NOT EDIT -->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'/>
|
||||
<title>
|
||||
Mochitest wrapper for WebGL Conformance Test Suite tests
|
||||
</title>
|
||||
<link rel='stylesheet' type='text/css' href='../iframe-passthrough.css'/>
|
||||
|
||||
<script src='/tests/SimpleTest/SimpleTest.js'></script>
|
||||
<link rel='stylesheet' type='text/css' href='/tests/SimpleTest/test.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='../mochi-single.html?checkout/conformance2/programs/gl-get-frag-data-location.html?webglVersion=2'></iframe>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user