• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*-------------------------------------------------------------------------
2  * OpenGL Conformance Test Suite
3  * -----------------------------
4  *
5  * Copyright (c) 2016 The Khronos Group Inc.
6  *
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */ /*!
20  * \file
21  * \brief
22  */ /*-------------------------------------------------------------------*/
23 
24 /**
25  */ /*!
26  * \file  gl4cPostDepthCoverageTests.cpp
27  * \brief Conformance tests for the GL_ARB_post_depth_coverage functionality.
28  */ /*-------------------------------------------------------------------*/
29 
30 #include "gl4cPostDepthCoverageTests.hpp"
31 #include "gluContextInfo.hpp"
32 #include "gluDefs.hpp"
33 #include "gluDrawUtil.hpp"
34 #include "gluShaderProgram.hpp"
35 #include "glwEnums.hpp"
36 #include "glwFunctions.hpp"
37 #include "tcuTestLog.hpp"
38 
39 using namespace glw;
40 using namespace glu;
41 
42 namespace gl4cts
43 {
44 static const char* c_commonVertShader = "#version 450\n"
45 										"\n"
46 										"in vec3 vertex;\n"
47 										"in vec2 inTexCoord;\n"
48 										"out vec2 texCoord;\n"
49 										"\n"
50 										"void main()\n"
51 										"{\n"
52 										"    texCoord = inTexCoord;\n"
53 										"    gl_Position = vec4(vertex, 1);\n"
54 										"}\n";
55 
56 /** Constructor.
57  *
58  *  @param context     Rendering context
59  */
PostDepthShaderCase(deqp::Context & context)60 PostDepthShaderCase::PostDepthShaderCase(deqp::Context& context)
61 	: TestCase(context, "PostDepthShader",
62 			   "Verifies if shader functionality added in ARB_post_depth_coverage extension works as expected")
63 {
64 	/* Left blank intentionally */
65 }
66 
67 /** Stub deinit method. */
deinit()68 void PostDepthShaderCase::deinit()
69 {
70 }
71 
72 /** Stub init method */
init()73 void PostDepthShaderCase::init()
74 {
75 	if (!m_context.getContextInfo().isExtensionSupported("GL_ARB_post_depth_coverage"))
76 		throw tcu::NotSupportedError("GL_ARB_post_depth_coverage not supported");
77 
78 	m_vertShader = c_commonVertShader;
79 
80 	m_fragShader1 = "#version 450\n"
81 					"\n"
82 					"#extension GL_ARB_post_depth_coverage : require\n"
83 					"\n"
84 					"out vec4 fragColor;\n"
85 					"\n"
86 					"void main()\n"
87 					"{\n"
88 					"    fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
89 					"}\n";
90 
91 	m_fragShader2 = "#version 450\n"
92 					"\n"
93 					"#extension GL_ARB_post_depth_coverage : enable\n"
94 					"\n"
95 					"#ifndef GL_ARB_post_depth_coverage\n"
96 					"  #error GL_ARB_post_depth_coverage not defined\n"
97 					"#else\n"
98 					"  #if (GL_ARB_post_depth_coverage != 1)\n"
99 					"    #error GL_ARB_post_depth_coverage wrong defined\n"
100 					"  #endif\n"
101 					"#endif // GL_ARB_post_depth_coverage\n"
102 					"\n"
103 					"out vec4 fragColor;\n"
104 					"\n"
105 					"void main()\n"
106 					"{\n"
107 					"    fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
108 					"}\n";
109 
110 	m_fragShader3 = "#version 450\n"
111 					"\n"
112 					"#extension GL_ARB_post_depth_coverage : enable\n"
113 					"\n"
114 					"layout(early_fragment_tests) in;\n"
115 					"layout(post_depth_coverage) in;\n"
116 					"\n"
117 					"out vec4 fragColor;\n"
118 					"\n"
119 					"void main()\n"
120 					"{\n"
121 					"    fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
122 					"}\n";
123 
124 	m_fragShader4 = "#version 450\n"
125 					"\n"
126 					"#extension GL_ARB_post_depth_coverage : enable\n"
127 					"\n"
128 					"layout(post_depth_coverage) in;\n"
129 					"\n"
130 					"out vec4 fragColor;\n"
131 					"\n"
132 					"void main()\n"
133 					"{\n"
134 					"    fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
135 					"}\n";
136 }
137 
138 /** Executes test iteration.
139  *
140  *  @return Returns STOP when test has finished executing, CONTINUE if more iterations are needed.
141  */
iterate()142 tcu::TestNode::IterateResult PostDepthShaderCase::iterate()
143 {
144 	const Functions& gl = m_context.getRenderContext().getFunctions();
145 
146 	ProgramSources sources1 = makeVtxFragSources(m_vertShader, m_fragShader1);
147 	ShaderProgram  program1(gl, sources1);
148 
149 	if (!program1.isOk())
150 	{
151 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail checking extension in shader");
152 		m_testCtx.getLog() << tcu::TestLog::Message << "Vertex: " << program1.getShaderInfo(SHADERTYPE_VERTEX).infoLog
153 						   << "\n"
154 						   << "Fragment: " << program1.getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
155 						   << "Program: " << program1.getProgramInfo().infoLog << tcu::TestLog::EndMessage;
156 
157 		return STOP;
158 	}
159 
160 	ProgramSources sources2 = makeVtxFragSources(m_vertShader, m_fragShader2);
161 	ShaderProgram  program2(gl, sources2);
162 
163 	if (!program2.isOk())
164 	{
165 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail checking preprocessor directives in shader");
166 		m_testCtx.getLog() << tcu::TestLog::Message << "Vertex: " << program2.getShaderInfo(SHADERTYPE_VERTEX).infoLog
167 						   << "\n"
168 						   << "Fragment: " << program2.getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
169 						   << "Program: " << program2.getProgramInfo().infoLog << tcu::TestLog::EndMessage;
170 		return STOP;
171 	}
172 
173 	ProgramSources sources3 = makeVtxFragSources(m_vertShader, m_fragShader3);
174 	ShaderProgram  program3(gl, sources3);
175 
176 	if (!program3.isOk())
177 	{
178 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail checking first layout setup in shader");
179 		m_testCtx.getLog() << tcu::TestLog::Message << "Vertex: " << program3.getShaderInfo(SHADERTYPE_VERTEX).infoLog
180 						   << "\n"
181 						   << "Fragment: " << program3.getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
182 						   << "Program: " << program3.getProgramInfo().infoLog << tcu::TestLog::EndMessage;
183 		return STOP;
184 	}
185 
186 	ProgramSources sources4 = makeVtxFragSources(m_vertShader, m_fragShader4);
187 	ShaderProgram  program4(gl, sources4);
188 
189 	if (!program4.isOk())
190 	{
191 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail checking second layout setup in shader");
192 		m_testCtx.getLog() << tcu::TestLog::Message << "Vertex: " << program4.getShaderInfo(SHADERTYPE_VERTEX).infoLog
193 						   << "\n"
194 						   << "Fragment: " << program4.getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
195 						   << "Program: " << program4.getProgramInfo().infoLog << tcu::TestLog::EndMessage;
196 		return STOP;
197 	}
198 
199 	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
200 	return STOP;
201 }
202 
203 /** Constructor.
204  *
205  *  @param context     Rendering context
206  */
PostDepthSampleMaskCase(deqp::Context & context)207 PostDepthSampleMaskCase::PostDepthSampleMaskCase(deqp::Context& context)
208 	: TestCase(context, "PostDepthSampleMask", "Verifies multisampling with depth test and stencil test functionality "
209 											   "added in ARB_post_depth_coverage extension")
210 	, m_framebufferMS(0)
211 	, m_framebuffer(0)
212 	, m_textureMS(0)
213 	, m_texture(0)
214 	, m_depthStencilRenderbuffer(0)
215 {
216 	/* Left blank intentionally */
217 }
218 
219 /** Stub deinit method. */
deinit()220 void PostDepthSampleMaskCase::deinit()
221 {
222 	const Functions& gl = m_context.getRenderContext().getFunctions();
223 
224 	gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
225 
226 	if (m_framebufferMS)
227 		gl.deleteFramebuffers(1, &m_framebufferMS);
228 	if (m_framebuffer)
229 		gl.deleteFramebuffers(1, &m_framebuffer);
230 
231 	if (m_textureMS)
232 		gl.deleteTextures(1, &m_textureMS);
233 	if (m_texture)
234 		gl.deleteTextures(1, &m_texture);
235 
236 	if (m_depthStencilRenderbuffer)
237 		gl.deleteRenderbuffers(1, &m_depthStencilRenderbuffer);
238 }
239 
240 /** Stub init method */
init()241 void PostDepthSampleMaskCase::init()
242 {
243 	if (!m_context.getContextInfo().isExtensionSupported("GL_ARB_post_depth_coverage"))
244 		throw tcu::NotSupportedError("GL_ARB_post_depth_coverage not supported");
245 
246 	m_vertShader = c_commonVertShader;
247 
248 	m_fragShader1a = "#version 450\n"
249 					 "\n"
250 					 "#extension GL_ARB_post_depth_coverage : enable\n"
251 					 "\n"
252 					 "in vec2 texCoord;\n"
253 					 "out vec4 fragColor;\n"
254 					 "\n"
255 					 "void main()\n"
256 					 "{\n"
257 					 "    int samp1 = (gl_SampleMaskIn[0] & 0x1);\n"
258 					 "    int samp2 = (gl_SampleMaskIn[0] & 0x2) / 2;\n"
259 					 "    int samp3 = (gl_SampleMaskIn[0] & 0x4) / 4;\n"
260 					 "    int samp4 = (gl_SampleMaskIn[0] & 0x8) / 8;\n"
261 					 "    fragColor = vec4(samp1, samp2, samp3, samp4);\n"
262 					 "}\n";
263 
264 	m_fragShader1b = "#version 450\n"
265 					 "\n"
266 					 "#extension GL_ARB_post_depth_coverage : enable\n"
267 					 "layout(post_depth_coverage) in;\n"
268 					 "\n"
269 					 "in vec2 texCoord;\n"
270 					 "out vec4 fragColor;\n"
271 					 "\n"
272 					 "void main()\n"
273 					 "{\n"
274 					 "    int samp1 = (gl_SampleMaskIn[0] & 0x1);\n"
275 					 "    int samp2 = (gl_SampleMaskIn[0] & 0x2) / 2;\n"
276 					 "    int samp3 = (gl_SampleMaskIn[0] & 0x4) / 4;\n"
277 					 "    int samp4 = (gl_SampleMaskIn[0] & 0x8) / 8;\n"
278 					 "    fragColor = vec4(samp1, samp2, samp3, samp4);\n"
279 					 "}\n";
280 
281 	m_fragShader2 = "#version 450\n"
282 					"\n"
283 					"in vec2 texCoord;\n"
284 					"out vec4 fragColor;\n"
285 					"\n"
286 					"uniform sampler2DMS texture;\n"
287 					"\n"
288 					"void main()\n"
289 					"{\n"
290 					"    int samp = int(texCoord.y * 4);\n"
291 					"    fragColor = texelFetch(texture, ivec2(0, 0), samp);\n"
292 					"}\n";
293 
294 	const Functions& gl = m_context.getRenderContext().getFunctions();
295 
296 	gl.genRenderbuffers(1, &m_depthStencilRenderbuffer);
297 	gl.bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilRenderbuffer);
298 	gl.renderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH_STENCIL, 1, 1);
299 	GLU_EXPECT_NO_ERROR(gl.getError(), "glRenderbufferStorageMultisample");
300 
301 	gl.genTextures(1, &m_textureMS);
302 	gl.bindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_textureMS);
303 	gl.texStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGBA8, 1, 1, GL_TRUE);
304 	GLU_EXPECT_NO_ERROR(gl.getError(), "glTexStorage2DMultisample");
305 
306 	gl.genFramebuffers(1, &m_framebufferMS);
307 	gl.bindFramebuffer(GL_FRAMEBUFFER, m_framebufferMS);
308 	gl.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, m_textureMS, 0);
309 	gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRenderbuffer);
310 	gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRenderbuffer);
311 
312 	gl.genTextures(1, &m_texture);
313 	gl.bindTexture(GL_TEXTURE_2D, m_texture);
314 	gl.texStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 1, 4);
315 
316 	gl.genFramebuffers(1, &m_framebuffer);
317 	gl.bindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
318 	gl.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0);
319 }
320 
321 /** Executes test iteration.
322  *
323  *  @return Returns STOP when test has finished executing, CONTINUE if more iterations are needed.
324  */
iterate()325 tcu::TestNode::IterateResult PostDepthSampleMaskCase::iterate()
326 {
327 	const Functions& gl = m_context.getRenderContext().getFunctions();
328 
329 	const GLfloat texCoord[] = {
330 		0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,
331 	};
332 
333 	const GLfloat verticesNear[] = {
334 		-1.0f, -1.0f, 0.25f, 0.4f, -1.0f, 0.25f, -1.0f, 0.4f, 0.25f,
335 	};
336 
337 	const GLfloat verticesFar[] = {
338 		-1.0f, -1.0f, 0.75f, 3.0f, -1.0f, 0.75f, -1.0f, 3.0f, 0.75f,
339 	};
340 
341 	const GLfloat verticesPost[] = {
342 		-1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f,
343 	};
344 
345 	const GLuint indicesPre[] = { 0, 1, 2 };
346 
347 	const GLuint indicesPost[] = { 0, 1, 2, 1, 2, 3 };
348 
349 	glu::VertexArrayBinding vertexArraysNear[] = { glu::va::Float("vertex", 3, 3, 0, verticesNear),
350 												   glu::va::Float("inTexCoord", 2, 3, 0, texCoord) };
351 
352 	glu::VertexArrayBinding vertexArraysFar[] = { glu::va::Float("vertex", 3, 3, 0, verticesFar),
353 												  glu::va::Float("inTexCoord", 2, 3, 0, texCoord) };
354 
355 	glu::VertexArrayBinding vertexArraysPost[] = { glu::va::Float("vertex", 3, 4, 0, verticesPost),
356 												   glu::va::Float("inTexCoord", 2, 4, 0, texCoord) };
357 
358 	//Prepare shaders
359 	ProgramSources sources1a = makeVtxFragSources(m_vertShader, m_fragShader1a);
360 	ShaderProgram  program1a(gl, sources1a);
361 
362 	if (!program1a.isOk())
363 	{
364 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Shader program fail (non post_depth_coverage).");
365 		m_testCtx.getLog() << tcu::TestLog::Message << "Vertex: " << program1a.getShaderInfo(SHADERTYPE_VERTEX).infoLog
366 						   << "\n"
367 						   << "Fragment: " << program1a.getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
368 						   << "Program: " << program1a.getProgramInfo().infoLog << tcu::TestLog::EndMessage;
369 		return STOP;
370 	}
371 
372 	ProgramSources sources1b = makeVtxFragSources(m_vertShader, m_fragShader1b);
373 	ShaderProgram  program1b(gl, sources1b);
374 
375 	if (!program1b.isOk())
376 	{
377 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Shader program fail (post_depth_coverage).");
378 		m_testCtx.getLog() << tcu::TestLog::Message << "PostDepthCoverage: enabled\n"
379 						   << "Vertex: " << program1b.getShaderInfo(SHADERTYPE_VERTEX).infoLog << "\n"
380 						   << "Fragment: " << program1b.getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
381 						   << "Program: " << program1b.getProgramInfo().infoLog << tcu::TestLog::EndMessage;
382 		return STOP;
383 	}
384 
385 	ProgramSources sources2 = makeVtxFragSources(m_vertShader, m_fragShader2);
386 	ShaderProgram  program2(gl, sources2);
387 
388 	if (!program2.isOk())
389 	{
390 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Shader program fail (samples reader).");
391 		m_testCtx.getLog() << tcu::TestLog::Message << "Vertex: " << program2.getShaderInfo(SHADERTYPE_VERTEX).infoLog
392 						   << "\n"
393 						   << "Fragment: " << program2.getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
394 						   << "Program: " << program2.getProgramInfo().infoLog << tcu::TestLog::EndMessage;
395 		return STOP;
396 	}
397 
398 	gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
399 	gl.clearStencil(0);
400 
401 	//Iterate through all cases
402 	for (int bufferCase = BUFFERCASE_FIRST; bufferCase <= BUFFERCASE_LAST; ++bufferCase)
403 		for (int pdcCase = PDCCASE_FIRST; pdcCase <= PDCCASE_LAST; ++pdcCase)
404 		{
405 			GLint program = 0;
406 			if (pdcCase == PDCCASE_DISABLED)
407 				program = program1a.getProgram();
408 			else if (pdcCase == PDCCASE_ENABLED)
409 				program = program1b.getProgram();
410 
411 			gl.useProgram(program);
412 
413 			//Firstible use multisampled framebuffer
414 			gl.bindFramebuffer(GL_FRAMEBUFFER, m_framebufferMS);
415 			gl.viewport(0, 0, 1, 1);
416 
417 			gl.enable(GL_MULTISAMPLE);
418 
419 			//Check which samples should be covered by first draw - calculate expected sample mask
420 			GLboolean expectedMask[4];
421 
422 			for (GLint i = 0; i < 4; ++i)
423 			{
424 				GLfloat samplePos[2];
425 				gl.getMultisamplefv(GL_SAMPLE_POSITION, i, &samplePos[0]);
426 				GLU_EXPECT_NO_ERROR(gl.getError(), "glGetMultisamplefv");
427 				if (pdcCase == PDCCASE_ENABLED && (samplePos[0] + samplePos[1]) < 0.7f)
428 					expectedMask[i] = false;
429 				else
430 					expectedMask[i] = true;
431 			}
432 
433 			if (bufferCase == BUFFERCASE_DEPTH)
434 				gl.enable(GL_DEPTH_TEST);
435 			else if (bufferCase == BUFFERCASE_STENCIL)
436 				gl.enable(GL_STENCIL_TEST);
437 
438 			gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
439 
440 			if (bufferCase == BUFFERCASE_STENCIL)
441 			{
442 				gl.stencilFunc(GL_ALWAYS, 1, 0xFF);
443 				gl.stencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE);
444 				gl.stencilMask(0xFF);
445 			}
446 
447 			//Draw near primitive
448 			glu::draw(m_context.getRenderContext(), program, DE_LENGTH_OF_ARRAY(vertexArraysNear), vertexArraysNear,
449 					  glu::pr::TriangleStrip(DE_LENGTH_OF_ARRAY(indicesPre), indicesPre));
450 
451 			gl.clear(GL_COLOR_BUFFER_BIT);
452 
453 			if (bufferCase == BUFFERCASE_STENCIL)
454 			{
455 				gl.stencilFunc(GL_NOTEQUAL, 1, 0xFF);
456 				gl.stencilMask(0x00);
457 			}
458 
459 			//Draw far primitive
460 			glu::draw(m_context.getRenderContext(), program, DE_LENGTH_OF_ARRAY(vertexArraysFar), vertexArraysFar,
461 					  glu::pr::TriangleStrip(DE_LENGTH_OF_ARRAY(indicesPre), indicesPre));
462 
463 			gl.disable(GL_DEPTH_TEST);
464 			if (bufferCase == BUFFERCASE_DEPTH)
465 				gl.disable(GL_DEPTH_TEST);
466 			else if (bufferCase == BUFFERCASE_STENCIL)
467 				gl.disable(GL_STENCIL_TEST);
468 
469 			gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
470 
471 			gl.useProgram(program2.getProgram());
472 
473 			gl.bindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
474 			gl.viewport(0, 0, 1, 4);
475 
476 			//Pass multisampled texture as a uniform
477 			gl.activeTexture(GL_TEXTURE0);
478 			gl.bindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_textureMS);
479 			gl.uniform1i(gl.getUniformLocation(program2.getProgram(), "texture"), 0);
480 
481 			gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
482 
483 			//Draw multisampled texture to framebuffer
484 			glu::draw(m_context.getRenderContext(), program2.getProgram(), DE_LENGTH_OF_ARRAY(vertexArraysPost),
485 					  vertexArraysPost, glu::pr::TriangleStrip(DE_LENGTH_OF_ARRAY(indicesPost), indicesPost));
486 
487 			gl.disable(GL_MULTISAMPLE);
488 
489 			//Read data from framebuffer
490 			GLubyte pixels[4 * 4];
491 			deMemset(pixels, 0, 4 * 4);
492 
493 			gl.readPixels(0, 0, 1, 4, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
494 			GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels");
495 
496 			//Verify the result
497 			GLboolean compiledMask[4];
498 			deMemset(compiledMask, 0, 4);
499 			for (int i = 0; i < 4; ++i)
500 			{
501 				for (int n			= 0; n < 4; ++n)
502 					compiledMask[n] = compiledMask[n] || (pixels[4 * i + n] != 0);
503 			}
504 
505 			for (int n = 0; n < 4; ++n)
506 			{
507 				if (expectedMask[n] != compiledMask[n])
508 				{
509 					m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
510 					m_testCtx.getLog() << tcu::TestLog::Message << "Wrong results for "
511 									   << (bufferCase == BUFFERCASE_DEPTH ? "BUFFERCASE_DEPTH" :
512 																			"BUFFERCASE_DEPTH_STENCIL")
513 									   << " / "
514 									   << (pdcCase == PDCCASE_DISABLED ? "PDCCASE_DISABLED" : "PDCCASE_ENABLED")
515 									   << tcu::TestLog::EndMessage;
516 					return STOP;
517 				}
518 			}
519 		}
520 
521 	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
522 	return STOP;
523 }
524 
525 /** Constructor.
526  *
527  *  @param context Rendering context.
528  */
PostDepthCoverage(deqp::Context & context)529 PostDepthCoverage::PostDepthCoverage(deqp::Context& context)
530 	: TestCaseGroup(context, "post_depth_coverage_tests",
531 					"Verify conformance of CTS_ARB_post_depth_coverage implementation")
532 {
533 }
534 
535 /** Initializes the test group contents. */
init()536 void PostDepthCoverage::init()
537 {
538 	addChild(new PostDepthShaderCase(m_context));
539 	addChild(new PostDepthSampleMaskCase(m_context));
540 }
541 
542 } /* gl4cts namespace */
543