1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.0 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Rasterizer discard tests.
22 *//*--------------------------------------------------------------------*/
24 goog.provide('functional.gles3.es3fRasterizerDiscardTests');
25 goog.require('framework.common.tcuLogImage');
26 goog.require('framework.common.tcuSurface');
27 goog.require('framework.common.tcuTestCase');
28 goog.require('framework.delibs.debase.deRandom');
29 goog.require('framework.delibs.debase.deString');
30 goog.require('framework.opengl.gluDrawUtil');
31 goog.require('framework.opengl.gluShaderProgram');
33 goog.scope(function() {
34 var es3fRasterizerDiscardTests = functional.gles3.es3fRasterizerDiscardTests;
35 var deString = framework.delibs.debase.deString;
36 var tcuTestCase = framework.common.tcuTestCase;
37 var deRandom = framework.delibs.debase.deRandom;
38 var gluShaderProgram = framework.opengl.gluShaderProgram;
39 var tcuSurface = framework.common.tcuSurface;
40 var gluDrawUtil = framework.opengl.gluDrawUtil;
41 var tcuLogImage = framework.common.tcuLogImage;
43 /** @const */ var NUM_CASE_ITERATIONS = 1;
44 /** @const */ var FAIL_COLOR_RED = [1, 0, 0.0, 1];
45 /** @const */ var PASS_COLOR_BLUE = [0, 0, 0.5, 1];
46 /** @const */ var BLACK_COLOR = [0, 0, 0.0, 1];
47 /** @const */ var FAIL_DEPTH = 0;
48 /** @const */ var FAIL_STENCIL = 1;
49 /** @const */ var UNIT_SQUARE = [
56 /** @type {WebGL2RenderingContext} */ var gl;
61 es3fRasterizerDiscardTests.CaseType = {
70 * @enum {{useFBO: boolean, useScissor: boolean}}
72 es3fRasterizerDiscardTests.CaseOptions = {
73 FBO: {useFBO: true, useScissor: false},
74 SCISSOR: {useFBO: false, useScissor: true}
79 * @extends {tcuTestCase.DeqpTest}
80 * @param {string} name
81 * @param {string} description
82 * @param {number} numPrimitives
83 * @param {es3fRasterizerDiscardTests.CaseType} caseType
84 * @param {?es3fRasterizerDiscardTests.CaseOptions} caseOptions
85 * @param {gluDrawUtil.primitiveType=} drawMode
87 es3fRasterizerDiscardTests.RasterizerDiscardCase = function(name, description, numPrimitives, caseType, caseOptions, drawMode) {
88 tcuTestCase.DeqpTest.call(this, name, description);
89 this.m_numPrimitives = numPrimitives;
90 this.m_caseType = caseType;
91 this.m_caseOptions = caseOptions || {useFBO: false, useScissor: false};
92 this.m_drawMode = drawMode || gluDrawUtil.primitiveType.TRIANGLES;
93 this.m_program = null;
95 this.m_colorBuf = null;
96 this.m_depthStencilBuf = null;
98 this.m_rnd = new deRandom.Random(deString.deStringHash(name));
101 es3fRasterizerDiscardTests.RasterizerDiscardCase.prototype = Object.create(tcuTestCase.DeqpTest.prototype);
102 es3fRasterizerDiscardTests.RasterizerDiscardCase.prototype.constructor = es3fRasterizerDiscardTests.RasterizerDiscardCase;
105 * @param {number} numPrimitives
106 * @param {deRandom.Random} rnd
107 * @param {gluDrawUtil.primitiveType} drawMode
108 * @return {Array<number>}
110 es3fRasterizerDiscardTests.generateVertices = function(numPrimitives, rnd, drawMode) {
115 case gl.POINTS: numVertices = numPrimitives; break;
116 case gl.LINES: numVertices = 2 * numPrimitives; break;
117 case gl.LINE_STRIP: numVertices = numPrimitives + 1; break;
118 case gl.LINE_LOOP: numVertices = numPrimitives + 2; break;
119 case gl.TRIANGLES: numVertices = 3 * numPrimitives; break;
120 case gl.TRIANGLE_STRIP: numVertices = numPrimitives + 2; break;
121 case gl.TRIANGLE_FAN: numVertices = numPrimitives + 2; break;
123 throw new Error('Invalid drawMode: ' + drawMode);
126 for (var i = 0; i < numVertices; i++) {
127 dst[i * 4] = rnd.getFloat(-1.0, 1.0); // x
128 dst[i * 4 + 1] = rnd.getFloat(-1.0, 1.0); // y
129 dst[i * 4 + 2] = rnd.getFloat(0.1, 0.9); // z
130 dst[i * 4 + 3] = 1.0; // w
136 es3fRasterizerDiscardTests.RasterizerDiscardCase.prototype.setupFramebufferObject = function() {
137 var width = gl.drawingBufferWidth;
138 var height = gl.drawingBufferHeight;
140 // Create framebuffer object
142 this.m_fbo = gl.createFramebuffer();
143 this.m_colorBuf = gl.createTexture();
144 this.m_depthStencilBuf = gl.createRenderbuffer();
146 // Create color texture
148 gl.bindTexture(gl.TEXTURE_2D, this.m_colorBuf);
149 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
150 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
151 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
152 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
153 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
155 // Create depth and stencil buffers
157 gl.bindRenderbuffer(gl.RENDERBUFFER, this.m_depthStencilBuf);
158 gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH24_STENCIL8, width, height);
160 // Attach texture and buffers to FBO
162 gl.bindFramebuffer(gl.FRAMEBUFFER, this.m_fbo);
163 gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.m_colorBuf, 0);
164 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.m_depthStencilBuf);
165 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.m_depthStencilBuf);
167 var fboStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
169 if (fboStatus == gl.FRAMEBUFFER_UNSUPPORTED)
170 throw new Error('Framebuffer unsupported');
171 else if (fboStatus != gl.FRAMEBUFFER_COMPLETE)
172 throw new Error('Failed to create framebuffer object: ' + deString.enumToString(gl, fboStatus));
175 es3fRasterizerDiscardTests.RasterizerDiscardCase.prototype.deleteFramebufferObject = function() {
176 gl.deleteTexture(this.m_colorBuf);
177 gl.deleteRenderbuffer(this.m_depthStencilBuf);
178 gl.deleteFramebuffer(this.m_fbo);
181 es3fRasterizerDiscardTests.RasterizerDiscardCase.prototype.init = function() {
182 var vertShaderSource =
183 '#version 300 es\n' +
184 'layout(location = 0) in mediump vec4 a_position;\n' +
186 'void main (void)\n' +
188 ' gl_Position = a_position;\n' +
191 var fragShaderSource =
192 '#version 300 es\n' +
193 'layout(location = 0) out mediump vec4 dEQP_FragColor;\n' +
194 'uniform mediump vec4 u_color;\n' +
196 'void main (void)\n' +
198 ' mediump float depth_gradient = gl_FragCoord.z;\n' +
199 ' mediump float bias = 0.1;\n' +
200 ' dEQP_FragColor = vec4(u_color.xyz * (depth_gradient + bias), 1.0);\n' +
203 this.m_program = new gluShaderProgram.ShaderProgram(gl, gluShaderProgram.makeVtxFragSources(vertShaderSource, fragShaderSource));
205 if (!this.m_program.isOk()) {
206 bufferedLogToConsole(this.m_program);
207 testFailedOptions('Failed to compile shader program', true);
211 es3fRasterizerDiscardTests.RasterizerDiscardCase.prototype.deinit = function() {
212 this.deleteFramebufferObject();
213 this.m_program = null;
216 es3fRasterizerDiscardTests.RasterizerDiscardCase.prototype.iterate = function() {
217 var program = this.m_program.getProgram();
218 var colorUnif = gl.getUniformLocation(program, 'u_color');
219 var failColorFound = false;
220 var passColorFound = false;
223 bufferedLogToConsole('Case iteration ' + (this.m_iterNdx + 1) + ' / ' + NUM_CASE_ITERATIONS);
225 // Create and bind FBO if needed
227 if (this.m_caseOptions.useFBO) {
228 this.setupFramebufferObject();
231 if (this.m_caseOptions.useScissor) {
232 gl.enable(gl.SCISSOR_TEST);
233 gl.scissor(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
234 bufferedLogToConsole('Scissor test enabled: glScissor(0, 0, ' + gl.drawingBufferWidth + ', ' + gl.drawingBufferHeight + ')');
237 gl.useProgram(this.m_program.getProgram());
239 gl.enable(gl.DEPTH_TEST);
241 gl.depthFunc(gl.LEQUAL);
243 gl.enable(gl.STENCIL_TEST);
244 gl.stencilFunc(gl.NOTEQUAL, 1, 0xFF);
245 gl.stencilOp(gl.REPLACE, gl.KEEP, gl.KEEP);
247 gl.clearColor(PASS_COLOR_BLUE[0], PASS_COLOR_BLUE[1], PASS_COLOR_BLUE[2], PASS_COLOR_BLUE[3]);
250 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
253 vertices = es3fRasterizerDiscardTests.generateVertices(this.m_numPrimitives, this.m_rnd, this.m_drawMode);
254 var posLoc = gl.getAttribLocation(program, 'a_position');
255 var vertexArrays = [];
256 vertexArrays.push(new gluDrawUtil.VertexArrayBinding(gl.FLOAT, posLoc, 4, vertices.length / 4, vertices));
257 // Clear color to black for depth and stencil clear cases
259 if (this.m_caseType == es3fRasterizerDiscardTests.CaseType.CLEAR_DEPTH || this.m_caseType == es3fRasterizerDiscardTests.CaseType.CLEAR_STENCIL) {
260 gl.clearColor(BLACK_COLOR[0], BLACK_COLOR[1], BLACK_COLOR[2], BLACK_COLOR[3]);
261 gl.clear(gl.COLOR_BUFFER_BIT);
264 // Set fail values for color, depth and stencil
266 gl.uniform4fv(colorUnif, FAIL_COLOR_RED);
267 gl.clearColor(FAIL_COLOR_RED[0], FAIL_COLOR_RED[1], FAIL_COLOR_RED[2], FAIL_COLOR_RED[3]);
268 gl.clearDepth(FAIL_DEPTH);
269 gl.clearStencil(FAIL_STENCIL);
271 // Enable rasterizer discard
273 gl.enable(gl.RASTERIZER_DISCARD);
274 bufferedLogToConsole('Rasterizer discard enabled');
276 // Do to-be-discarded primitive draws and buffer clears
278 switch (this.m_caseType) {
279 case es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH:
280 gluDrawUtil.draw(gl, program, vertexArrays, new gluDrawUtil.PrimitiveList(this.m_drawMode, vertices.length / 4));
282 case es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL:
283 gluDrawUtil.draw(gl, program, vertexArrays, new gluDrawUtil.PrimitiveList(this.m_drawMode, vertices.length / 4));
285 case es3fRasterizerDiscardTests.CaseType.CLEAR_COLOR:
286 if (this.m_caseOptions.useFBO)
287 gl.clearBufferfv(gl.COLOR, 0, FAIL_COLOR_RED);
289 gl.clear(gl.COLOR_BUFFER_BIT);
291 case es3fRasterizerDiscardTests.CaseType.CLEAR_DEPTH:
292 if (this.m_caseOptions.useFBO)
293 gl.clearBufferfv(gl.DEPTH, 0, [FAIL_DEPTH]);
295 gl.clear(gl.DEPTH_BUFFER_BIT);
297 case es3fRasterizerDiscardTests.CaseType.CLEAR_STENCIL:
298 if (this.m_caseOptions.useFBO)
299 gl.clearBufferiv(gl.STENCIL, 0, [FAIL_STENCIL]);
301 gl.clear(gl.STENCIL_BUFFER_BIT);
304 throw new Error('Invalid case type ' + this.m_caseType);
307 // Disable rasterizer discard
309 gl.disable(gl.RASTERIZER_DISCARD);
310 bufferedLogToConsole('Rasterizer discard disabled');
312 if (this.m_caseType == es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL) {
313 if (this.m_caseOptions.useFBO || gl.getContextAttributes().stencil) {
314 // Draw a full-screen square that colors all pixels red if they have stencil value 1.
315 var square = [new gluDrawUtil.VertexArrayBinding(gl.FLOAT, posLoc, 4, UNIT_SQUARE.length / 4, UNIT_SQUARE)];
317 gl.stencilFunc(gl.EQUAL, 1, 0xFF);
318 gluDrawUtil.draw(gl, program, square,
319 new gluDrawUtil.PrimitiveList(gluDrawUtil.primitiveType.TRIANGLE_STRIP, UNIT_SQUARE.length / 4));
321 // \note If no stencil buffers are present and test is rendering to default framebuffer, test will always pass.
322 } else if (this.m_caseType == es3fRasterizerDiscardTests.CaseType.CLEAR_DEPTH || this.m_caseType == es3fRasterizerDiscardTests.CaseType.CLEAR_STENCIL) {
323 // Draw pass-indicating primitives for depth and stencil clear cases
325 gl.uniform4fv(colorUnif, PASS_COLOR_BLUE);
326 gluDrawUtil.draw(gl, program, vertexArrays, new gluDrawUtil.PrimitiveList(this.m_drawMode, vertices.length / 4));
330 gl.disable(gl.STENCIL_TEST);
331 gl.disable(gl.DEPTH_TEST);
332 gl.disable(gl.SCISSOR_TEST);
334 // Read and check pixel data
336 var pixels = new tcuSurface.Surface();
337 pixels.readViewport(gl);
339 var width = pixels.getWidth();
340 var height = pixels.getHeight();
342 for (var y = 0; y < height; y++) {
343 for (var x = 0; x < width; x++) {
344 var pixel = pixels.getPixel(x, y);
346 passColorFound = true;
349 failColorFound = true;
353 if (failColorFound) break;
356 // Delete FBO if created
358 if (this.m_caseOptions.useFBO)
359 this.deleteFramebufferObject();
361 // Evaluate test result
363 var testOk = passColorFound && !failColorFound;
366 tcuLogImage.logImage('Result image', '', pixels.getAccess());
367 testFailed('Primitive or buffer clear was not discarded.');
368 return tcuTestCase.IterateResult.STOP;
370 bufferedLogToConsole('Primitive or buffer clear was discarded correctly.');
372 if (++this.m_iterNdx < NUM_CASE_ITERATIONS)
373 return tcuTestCase.IterateResult.CONTINUE;
376 return tcuTestCase.IterateResult.STOP;
379 es3fRasterizerDiscardTests.init = function() {
380 var state = tcuTestCase.runner;
381 var testGroup = state.testCases;
383 var basic = tcuTestCase.newTest('basic', 'Rasterizer discard test for default framebuffer');
384 var scissor = tcuTestCase.newTest('scissor', 'Rasterizer discard test for default framebuffer with scissor test enabled');
385 var fbo = tcuTestCase.newTest('fbo', 'Rasterizer discard test for framebuffer object');
387 testGroup.addChild(basic);
388 testGroup.addChild(scissor);
389 testGroup.addChild(fbo);
391 // Default framebuffer cases
393 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_points', 'points', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, null, gluDrawUtil.primitiveType.POINTS));
394 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_lines', 'lines', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, null, gluDrawUtil.primitiveType.LINES));
395 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_line_strip', 'line_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, null, gluDrawUtil.primitiveType.LINE_STRIP));
396 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_line_loop', 'line_loop', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, null, gluDrawUtil.primitiveType.LINE_LOOP));
397 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_triangles', 'triangles', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, null, gluDrawUtil.primitiveType.TRIANGLES));
398 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_triangle_strip', 'triangle_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, null, gluDrawUtil.primitiveType.TRIANGLE_STRIP));
399 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_triangle_fan', 'triangle_fan', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, null, gluDrawUtil.primitiveType.TRIANGLE_FAN));
401 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_points', 'points', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, null, gluDrawUtil.primitiveType.POINTS));
402 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_lines', 'lines', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, null, gluDrawUtil.primitiveType.LINES));
403 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_line_strip', 'line_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, null, gluDrawUtil.primitiveType.LINE_STRIP));
404 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_line_loop', 'line_loop', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, null, gluDrawUtil.primitiveType.LINE_LOOP));
405 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_triangles', 'triangles', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, null, gluDrawUtil.primitiveType.TRIANGLES));
406 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_triangle_strip', 'triangle_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, null, gluDrawUtil.primitiveType.TRIANGLE_STRIP));
407 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_triangle_fan', 'triangle_fan', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, null, gluDrawUtil.primitiveType.TRIANGLE_FAN));
409 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('clear_color', 'clear_color', 4, es3fRasterizerDiscardTests.CaseType.CLEAR_COLOR, null));
410 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('clear_depth', 'clear_depth', 4, es3fRasterizerDiscardTests.CaseType.CLEAR_DEPTH, null));
411 basic.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('clear_stencil', 'clear_stencil', 4, es3fRasterizerDiscardTests.CaseType.CLEAR_STENCIL, null));
413 // Default framebuffer cases with scissor test enabled
415 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_points', 'points', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.POINTS));
416 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_lines', 'lines', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.LINES));
417 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_line_strip', 'line_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.LINE_STRIP));
418 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_line_loop', 'line_loop', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.LINE_LOOP));
419 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_triangles', 'triangles', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.TRIANGLES));
420 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_triangle_strip', 'triangle_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.TRIANGLE_STRIP));
421 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_triangle_fan', 'triangle_fan', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.TRIANGLE_FAN));
423 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_points', 'points', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.POINTS));
424 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_lines', 'lines', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.LINES));
425 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_line_strip', 'line_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.LINE_STRIP));
426 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_line_loop', 'line_loop', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.LINE_LOOP));
427 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_triangles', 'triangles', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.TRIANGLES));
428 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_triangle_strip', 'triangle_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.TRIANGLE_STRIP));
429 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_triangle_fan', 'triangle_fan', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.SCISSOR, gluDrawUtil.primitiveType.TRIANGLE_FAN));
431 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('clear_color', 'clear_color', 4, es3fRasterizerDiscardTests.CaseType.CLEAR_COLOR, es3fRasterizerDiscardTests.CaseOptions.SCISSOR));
432 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('clear_depth', 'clear_depth', 4, es3fRasterizerDiscardTests.CaseType.CLEAR_DEPTH, es3fRasterizerDiscardTests.CaseOptions.SCISSOR));
433 scissor.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('clear_stencil', 'clear_stencil', 4, es3fRasterizerDiscardTests.CaseType.CLEAR_STENCIL, es3fRasterizerDiscardTests.CaseOptions.SCISSOR));
437 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_points', 'points', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.POINTS));
438 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_lines', 'lines', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.LINES));
439 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_line_strip', 'line_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.LINE_STRIP));
440 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_line_loop', 'line_loop', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.LINE_LOOP));
441 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_triangles', 'triangles', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.TRIANGLES));
442 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_triangle_strip', 'triangle_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.TRIANGLE_STRIP));
443 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_depth_triangle_fan', 'triangle_fan', 4, es3fRasterizerDiscardTests.CaseType.WRITE_DEPTH, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.TRIANGLE_FAN));
445 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_points', 'points', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.POINTS));
446 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_lines', 'lines', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.LINES));
447 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_line_strip', 'line_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.LINE_STRIP));
448 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_line_loop', 'line_loop', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.LINE_LOOP));
449 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_triangles', 'triangles', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.TRIANGLES));
450 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_triangle_strip', 'triangle_strip', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.TRIANGLE_STRIP));
451 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('write_stencil_triangle_fan', 'triangle_fan', 4, es3fRasterizerDiscardTests.CaseType.WRITE_STENCIL, es3fRasterizerDiscardTests.CaseOptions.FBO, gluDrawUtil.primitiveType.TRIANGLE_FAN));
453 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('clear_color', 'clear_color', 4, es3fRasterizerDiscardTests.CaseType.CLEAR_COLOR, es3fRasterizerDiscardTests.CaseOptions.FBO));
454 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('clear_depth', 'clear_depth', 4, es3fRasterizerDiscardTests.CaseType.CLEAR_DEPTH, es3fRasterizerDiscardTests.CaseOptions.FBO));
455 fbo.addChild(new es3fRasterizerDiscardTests.RasterizerDiscardCase('clear_stencil', 'clear_stencil', 4, es3fRasterizerDiscardTests.CaseType.CLEAR_STENCIL, es3fRasterizerDiscardTests.CaseOptions.FBO));
459 * Create and execute the test cases
461 es3fRasterizerDiscardTests.run = function(context) {
463 //Set up Test Root parameters
464 var testName = 'rasterizer_discard';
465 var testDescription = 'Rasterizer Discard Tests';
466 var state = tcuTestCase.runner;
468 state.testName = testName;
469 state.testCases = tcuTestCase.newTest(testName, testDescription, null);
471 //Set up name and description of this test series.
472 setCurrentTestName(testName);
473 description(testDescription);
476 es3fRasterizerDiscardTests.init();
477 tcuTestCase.runTestCases();
479 testFailedOptions('Failed to run tests', false);
480 bufferedLogToConsole(err);
481 tcuTestCase.runner.terminate();