зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1259702 - test case for webgl getFragDataLocation(). r=jgilbert
This commit is contained in:
Родитель
c801d201b6
Коммит
20509c6a8c
|
@ -82,10 +82,62 @@ function getFramebufferAttachmentParameter_bug1267100()
|
||||||
ok(true, 'WebGL test getFramebufferAttachmentParameter');
|
ok(true, 'WebGL test getFramebufferAttachmentParameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test to call getFragDataLocation() when the fragment shader is detatched.
|
||||||
|
function getFragDataLocation_bug1259702() {
|
||||||
|
var canvas = document.createElement('canvas');
|
||||||
|
|
||||||
|
var gl = canvas.getContext('webgl2');
|
||||||
|
|
||||||
|
if (!gl) {
|
||||||
|
todo(false, 'WebGL2 is not supported');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var program = gl.createProgram();
|
||||||
|
|
||||||
|
var vertexShaderSrc =
|
||||||
|
"void main(void) { \
|
||||||
|
gl_Position = vec4(1.0, 1.0, 1.0, 1.0); \
|
||||||
|
}";
|
||||||
|
var fragmentShaderSrc =
|
||||||
|
"void main(void) { \
|
||||||
|
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); \
|
||||||
|
}";
|
||||||
|
|
||||||
|
var vertexShader = gl.createShader(gl.VERTEX_SHADER);
|
||||||
|
var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
|
||||||
|
|
||||||
|
gl.shaderSource(vertexShader, vertexShaderSrc);
|
||||||
|
gl.compileShader(vertexShader);
|
||||||
|
gl.attachShader(program, vertexShader);
|
||||||
|
|
||||||
|
gl.shaderSource(fragmentShader, fragmentShaderSrc);
|
||||||
|
gl.compileShader(fragmentShader);
|
||||||
|
gl.attachShader(program, fragmentShader);
|
||||||
|
|
||||||
|
gl.linkProgram(program);
|
||||||
|
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
||||||
|
var lastError = gl.getProgramInfoLog(program);
|
||||||
|
ok(false, 'WebGL getFragDataLocation() test, error in linking:' +
|
||||||
|
lastError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gl.useProgram(program);
|
||||||
|
|
||||||
|
gl.detachShader(program, fragmentShader);
|
||||||
|
// Test the getFragDataLocation() call after detatch the shader.
|
||||||
|
// This call should not hit crash.
|
||||||
|
gl.getFragDataLocation(program, "foobar");
|
||||||
|
|
||||||
|
ok(true, 'WebGL getFragDataLocation() call after detatch fragment shader');
|
||||||
|
}
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
webGL2ClearBufferXXX_bug1252414();
|
webGL2ClearBufferXXX_bug1252414();
|
||||||
framebufferTexture2D_bug1257593();
|
framebufferTexture2D_bug1257593();
|
||||||
getFramebufferAttachmentParameter_bug1267100();
|
getFramebufferAttachmentParameter_bug1267100();
|
||||||
|
getFragDataLocation_bug1259702();
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче