1 /*-------------------------------------------------------------------------
2 * OpenGL Conformance Test Suite
3 * -----------------------------
5 * Copyright (c) 2017 The Khronos Group Inc.
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.
20 * \file glcPolygonOffsetClampTests.cpp
21 * \brief Conformance tests for the EXT_polygon_offset_clamp functionality.
22 */ /*-------------------------------------------------------------------*/
24 #include "glcPolygonOffsetClampTests.hpp"
25 #include "gluContextInfo.hpp"
26 #include "gluShaderProgram.hpp"
27 #include "glwEnums.hpp"
28 #include "tcuRenderTarget.hpp"
29 #include "tcuTestLog.hpp"
39 const char* poc_shader_version_450core = "#version 450 core\n\n";
40 const char* poc_shader_version_310es = "#version 310 es\n\n";
42 const char* poc_vertexColor = "in highp vec3 vertex;\n"
46 " gl_Position = vec4(vertex, 1);\n"
49 const char* poc_fragmentColor = "out highp vec4 fragColor;\n"
53 " fragColor = vec4(1, 1, 1, 1);\n"
56 const char* poc_vertexTexture = "in highp vec3 vertex;\n"
57 "in highp vec2 texCoord;\n"
58 "out highp vec2 varyingtexCoord;\n"
62 " gl_Position = vec4(vertex, 1);\n"
63 " varyingtexCoord = texCoord;\n"
66 const char* poc_fragmentTexture = "in highp vec2 varyingtexCoord;\n"
67 "out highp vec4 fragColor;\n"
69 "layout (location = 0) uniform highp sampler2D tex;\n"
73 " highp vec4 v = texture(tex, varyingtexCoord);\n"
74 " int r = int(v.r * 65536.0) % 256;\n"
75 " int g = int(v.r * 65536.0) / 256;\n"
76 " fragColor = vec4(float(r) / 255.0, float(g) / 255.0, 0.0, 1.0);\n"
81 * @param context Rendering context
82 * @param name Test name
83 * @param description Test description
85 PolygonOffsetClampTestCaseBase::PolygonOffsetClampTestCaseBase(deqp::Context& context, const char* name,
86 const char* description)
87 : TestCase(context, name, description)
89 m_extensionSupported = context.getContextInfo().isExtensionSupported("GL_EXT_polygon_offset_clamp");
92 tcu::TestNode::IterateResult PolygonOffsetClampTestCaseBase::iterate()
94 if (!m_extensionSupported)
96 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Not supported");
100 test(m_context.getRenderContext().getFunctions());
107 * @param context Rendering context
109 PolygonOffsetClampAvailabilityTestCase::PolygonOffsetClampAvailabilityTestCase(deqp::Context& context)
110 : PolygonOffsetClampTestCaseBase(context, "PolygonOffsetClampAvailability",
111 "Verifies if queries for GL_EXT_polygon_offset_clamp extension works properly")
115 void PolygonOffsetClampAvailabilityTestCase::test(const glw::Functions& gl)
119 gl.getBooleanv(GL_POLYGON_OFFSET_CLAMP_EXT, &data);
120 GLU_EXPECT_NO_ERROR(gl.getError(), "getBooleanv error occurred");
124 gl.getIntegerv(GL_POLYGON_OFFSET_CLAMP_EXT, &data);
125 GLU_EXPECT_NO_ERROR(gl.getError(), "getBooleanv error occurred");
129 gl.getInteger64v(GL_POLYGON_OFFSET_CLAMP_EXT, &data);
130 GLU_EXPECT_NO_ERROR(gl.getError(), "getBooleanv error occurred");
134 gl.getFloatv(GL_POLYGON_OFFSET_CLAMP_EXT, &data);
135 GLU_EXPECT_NO_ERROR(gl.getError(), "getBooleanv error occurred");
138 // OpenGL ES does not support getDoublev query
139 if (glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
142 gl.getDoublev(GL_POLYGON_OFFSET_CLAMP_EXT, &data);
143 GLU_EXPECT_NO_ERROR(gl.getError(), "getBooleanv error occurred");
146 gl.polygonOffsetClamp(1.0f, 1.0f, 0.5f);
147 GLU_EXPECT_NO_ERROR(gl.getError(), "polygonOffsetClamp error occurred");
149 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
154 * @param context Rendering context
156 PolygonOffsetClampValueTestCaseBase::PolygonOffsetClampValueTestCaseBase(deqp::Context& context, const char* name,
157 const char* description)
158 : PolygonOffsetClampTestCaseBase(context, name, description)
163 , m_colorBufReadback(0)
167 /** Initialization method that creates framebuffer with depth attachment
169 void PolygonOffsetClampValueTestCaseBase::init()
171 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
173 gl.genTextures(1, &m_depthBuf);
174 GLU_EXPECT_NO_ERROR(gl.getError(), "genTextures");
175 gl.bindTexture(GL_TEXTURE_2D, m_depthBuf);
176 GLU_EXPECT_NO_ERROR(gl.getError(), "bindTexture");
177 gl.texStorage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT16, 64, 64);
178 GLU_EXPECT_NO_ERROR(gl.getError(), "texStorage2D");
179 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
180 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
181 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
182 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
184 gl.genTextures(1, &m_colorBuf);
185 GLU_EXPECT_NO_ERROR(gl.getError(), "genTextures");
186 gl.bindTexture(GL_TEXTURE_2D, m_colorBuf);
187 GLU_EXPECT_NO_ERROR(gl.getError(), "bindTexture");
188 gl.texStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 64, 64);
189 GLU_EXPECT_NO_ERROR(gl.getError(), "texStorage2D");
190 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
191 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
192 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
193 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
195 gl.genFramebuffers(1, &m_fbo);
196 GLU_EXPECT_NO_ERROR(gl.getError(), "genFramebuffers");
197 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
198 GLU_EXPECT_NO_ERROR(gl.getError(), "bindFramebuffer");
199 gl.framebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthBuf, 0);
200 GLU_EXPECT_NO_ERROR(gl.getError(), "framebufferTexture2D");
201 gl.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_colorBuf, 0);
202 GLU_EXPECT_NO_ERROR(gl.getError(), "framebufferTexture2D");
204 if (!glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
206 gl.genTextures(1, &m_colorBufReadback);
207 GLU_EXPECT_NO_ERROR(gl.getError(), "genTextures");
208 gl.bindTexture(GL_TEXTURE_2D, m_colorBufReadback);
209 GLU_EXPECT_NO_ERROR(gl.getError(), "bindTexture");
210 gl.texStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 64, 64);
211 GLU_EXPECT_NO_ERROR(gl.getError(), "texStorage2D");
212 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
213 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
214 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
215 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
217 gl.genFramebuffers(1, &m_fboReadback);
218 GLU_EXPECT_NO_ERROR(gl.getError(), "genFramebuffers");
219 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fboReadback);
220 GLU_EXPECT_NO_ERROR(gl.getError(), "bindFramebuffer");
221 gl.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_colorBufReadback, 0);
222 GLU_EXPECT_NO_ERROR(gl.getError(), "framebufferTexture2D");
225 gl.viewport(0, 0, 64, 64);
228 /** De-Initialization method that releases
230 void PolygonOffsetClampValueTestCaseBase::deinit()
232 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
234 gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
235 GLU_EXPECT_NO_ERROR(gl.getError(), "bindFramebuffer");
238 gl.deleteFramebuffers(1, &m_fbo);
240 gl.deleteTextures(1, &m_depthBuf);
242 gl.deleteTextures(1, &m_colorBuf);
244 if (!glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
246 if (m_colorBufReadback)
247 gl.deleteTextures(1, &m_colorBufReadback);
249 gl.deleteFramebuffers(1, &m_fboReadback);
253 /** Testing method that verifies if depth values generated after polygon offset clamp are as expected.
255 * @param gl Function bindings
257 void PolygonOffsetClampValueTestCaseBase::test(const glw::Functions& gl)
259 const GLfloat vertices[] = { -1.0f, -1.0f, 0.5f, -1.0f, 1.0f, 0.5f, 1.0f, -1.0f, 0.5f, 1.0f, 1.0f, 0.5f };
261 // Prepare shader program
262 std::string vertexColor;
263 std::string fragmentColor;
264 if (glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
265 vertexColor = std::string(poc_shader_version_450core);
267 vertexColor = std::string(poc_shader_version_310es);
268 fragmentColor = vertexColor;
270 vertexColor = vertexColor + poc_vertexColor;
271 fragmentColor = fragmentColor + poc_fragmentColor;
273 ProgramSources testSources = makeVtxFragSources(vertexColor, fragmentColor);
274 ShaderProgram testProgram(gl, testSources);
276 if (!testProgram.isOk())
278 m_testCtx.getLog() << tcu::TestLog::Message << "TestProgram build failed.\n"
279 << "Vertex: " << testProgram.getShaderInfo(SHADERTYPE_VERTEX).infoLog << "\n"
280 << "Fragment: " << testProgram.getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
281 << "Program: " << testProgram.getProgramInfo().infoLog << tcu::TestLog::EndMessage;
283 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
287 ShaderProgram* readDepthProgram = DE_NULL;
288 GLuint readDepthProgramId = 0;
290 // Prepare shader program for reading depth buffer indirectly
291 if (!glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
293 std::string vertexTexture = std::string(poc_shader_version_310es) + poc_vertexTexture;
294 std::string fragmentTexture = std::string(poc_shader_version_310es) + poc_fragmentTexture;
296 ProgramSources readDepthSources = makeVtxFragSources(vertexTexture, fragmentTexture);
298 readDepthProgram = new ShaderProgram(gl, readDepthSources);
300 if (!readDepthProgram->isOk())
302 m_testCtx.getLog() << tcu::TestLog::Message << "ReadDepthProgram build failed.\n"
303 << "Vertex: " << readDepthProgram->getShaderInfo(SHADERTYPE_VERTEX).infoLog << "\n"
304 << "Fragment: " << readDepthProgram->getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
305 << "Program: " << readDepthProgram->getProgramInfo().infoLog << tcu::TestLog::EndMessage;
307 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
311 readDepthProgramId = readDepthProgram->getProgram();
314 gl.useProgram(testProgram.getProgram());
315 GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram");
320 // Setup depth testing
321 gl.enable(GL_DEPTH_TEST);
322 GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable");
324 gl.depthFunc(GL_ALWAYS);
325 GLU_EXPECT_NO_ERROR(gl.getError(), "glDepthFunc");
327 // Generate vertex array object
328 gl.genVertexArrays(1, &vao);
329 GLU_EXPECT_NO_ERROR(gl.getError(), "glGenVertexArrays");
331 gl.bindVertexArray(vao);
332 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindVertexArray");
334 // Setup vertex array buffer
335 gl.genBuffers(1, &arrayBuffer);
336 GLU_EXPECT_NO_ERROR(gl.getError(), "glGenBuffers");
338 gl.bindBuffer(GL_ARRAY_BUFFER, arrayBuffer);
339 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer");
341 gl.bufferData(GL_ARRAY_BUFFER, 12 * sizeof(GLfloat), vertices, GL_STATIC_DRAW);
342 GLU_EXPECT_NO_ERROR(gl.getError(), "glBufferData");
344 // Setup vertex attrib pointer
345 gl.enableVertexAttribArray(0);
346 GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray");
348 gl.vertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
349 GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer");
351 // Bind framebuffer for drawing
352 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
353 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer");
356 for (GLuint i = 0; i < m_testValues.size(); ++i)
358 // Prepare verification variables
359 GLfloat depthValue = 0.0f;
360 GLfloat depthValueOffset = 0.0f;
361 GLfloat depthValueOffsetClamp = 0.0f;
363 // Draw reference polygon
364 gl.disable(GL_POLYGON_OFFSET_FILL);
365 GLU_EXPECT_NO_ERROR(gl.getError(), "glDisable");
367 gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
368 GLU_EXPECT_NO_ERROR(gl.getError(), "glClear");
370 gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
371 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays");
373 // Get reference depth value
374 depthValue = readDepthValue(gl, readDepthProgramId);
376 // Draw polygon with depth offset
377 gl.enable(GL_POLYGON_OFFSET_FILL);
378 GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable");
380 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
381 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer");
383 gl.polygonOffset(m_testValues[i].factor, m_testValues[i].units);
384 GLU_EXPECT_NO_ERROR(gl.getError(), "glPolygonOffset");
386 gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
387 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays");
389 depthValueOffset = readDepthValue(gl, readDepthProgramId);
391 // Draw reference polygon
392 gl.disable(GL_POLYGON_OFFSET_FILL);
393 GLU_EXPECT_NO_ERROR(gl.getError(), "glDisable");
395 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
396 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer");
398 gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
399 GLU_EXPECT_NO_ERROR(gl.getError(), "glClear");
401 gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
402 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays");
404 // Draw polygon with depth offset
405 gl.enable(GL_POLYGON_OFFSET_FILL);
406 GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable");
408 gl.polygonOffsetClamp(m_testValues[i].factor, m_testValues[i].units, m_testValues[i].clamp);
409 GLU_EXPECT_NO_ERROR(gl.getError(), "glPolygonOffsetClampEXT");
411 gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
412 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays");
414 depthValueOffsetClamp = readDepthValue(gl, readDepthProgramId);
417 result = result && verify(i, depthValue, depthValueOffset, depthValueOffsetClamp);
421 gl.disableVertexAttribArray(0);
422 GLU_EXPECT_NO_ERROR(gl.getError(), "glDisableVertexAttribArray");
424 gl.deleteVertexArrays(1, &arrayBuffer);
425 GLU_EXPECT_NO_ERROR(gl.getError(), "glDeleteVertexArrays");
427 gl.deleteVertexArrays(1, &vao);
428 GLU_EXPECT_NO_ERROR(gl.getError(), "glDeleteVertexArrays");
430 gl.disable(GL_POLYGON_OFFSET_FILL);
431 GLU_EXPECT_NO_ERROR(gl.getError(), "glDisable");
433 if (readDepthProgram)
434 delete readDepthProgram;
437 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
439 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
444 * @param gl Function bindings
446 float PolygonOffsetClampValueTestCaseBase::readDepthValue(const glw::Functions& gl, const GLuint readDepthProgramId)
448 GLfloat depthValue = 0.0f;
450 if (glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
452 gl.readPixels(0, 0, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depthValue);
453 GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels");
455 // OpenGL ES does not support reading pixels directly from depth buffer
458 // Bind framebuffer for readback
459 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fboReadback);
460 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer");
462 gl.disable(GL_DEPTH_TEST);
463 GLU_EXPECT_NO_ERROR(gl.getError(), "glDisable");
465 gl.useProgram(readDepthProgramId);
466 GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram");
468 gl.activeTexture(GL_TEXTURE0);
469 GLU_EXPECT_NO_ERROR(gl.getError(), "glActiveTexture");
470 gl.bindTexture(GL_TEXTURE_2D, m_depthBuf);
471 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture");
473 GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i");
475 gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
476 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays");
479 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
480 GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels");
482 gl.enable(GL_DEPTH_TEST);
483 GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable");
485 // Convert read depth value to GLfloat normalized
486 depthValue = (GLfloat)(pixels[0] + pixels[1] * 256) / 0xFFFF;
488 // Bind framebuffer for drawing
489 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
490 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer");
498 * @param context Rendering context
500 PolygonOffsetClampMinMaxTestCase::PolygonOffsetClampMinMaxTestCase(deqp::Context& context)
501 : PolygonOffsetClampValueTestCaseBase(
502 context, "PolygonOffsetClampMinMax",
503 "Verifies if polygon offset clamp works as expected for non-zero, finite clamp values")
507 /** Initialization method that fills polygonOffset* testing values
509 void PolygonOffsetClampMinMaxTestCase::init()
511 PolygonOffsetClampValueTestCaseBase::init();
513 m_testValues.clear();
514 m_testValues.push_back(PolygonOffsetClampValues(0.0f, -1000.0f, -0.0001f)); // Min offset case
515 m_testValues.push_back(PolygonOffsetClampValues(0.0f, 1000.0f, 0.0001f)); // Max offset case
518 /** Verification method that determines if depth values are as expected
520 * @param caseNo Case iteration number
521 * @param depth Reference depth value
522 * @param offsetDepth Case iteration number
523 * @param offsetClampDepth Case iteration number
525 bool PolygonOffsetClampMinMaxTestCase::verify(GLuint caseNo, GLfloat depth, GLfloat offsetDepth,
526 GLfloat offsetClampDepth)
531 if (depth <= offsetDepth || depth <= offsetClampDepth || offsetDepth >= offsetClampDepth)
533 m_testCtx.getLog() << tcu::TestLog::Message << "PolygonOffsetClampEXT failed at MIN offset test.\n"
534 << "Expected result: "
535 << "refDepth[" << depth << "] > "
536 << "offsetClampDepth[" << offsetClampDepth << "] > "
537 << "offsetDepth[" << offsetDepth << "]" << tcu::TestLog::EndMessage;
543 else if (caseNo == 1)
545 if (depth >= offsetDepth || depth >= offsetClampDepth || offsetDepth <= offsetClampDepth)
547 m_testCtx.getLog() << tcu::TestLog::Message << "PolygonOffsetClampEXT failed at MAX offset test.\n"
548 << "Expected result: "
549 << "refDepth[" << depth << "] < "
550 << "offsetClampDepth[" << offsetClampDepth << "] < "
551 << "offsetDepth[" << offsetDepth << "]" << tcu::TestLog::EndMessage;
565 * @param context Rendering context
567 PolygonOffsetClampZeroInfinityTestCase::PolygonOffsetClampZeroInfinityTestCase(deqp::Context& context)
568 : PolygonOffsetClampValueTestCaseBase(
569 context, "PolygonOffsetClampZeroInfinity",
570 "Verifies if polygon offset clamp works as expected for zero and infinite clamp values")
574 /** Initialization method that fills polygonOffset* testing values
576 void PolygonOffsetClampZeroInfinityTestCase::init()
578 PolygonOffsetClampValueTestCaseBase::init();
580 m_testValues.clear();
581 m_testValues.push_back(PolygonOffsetClampValues(0.0f, -1000.0f, 0.0f)); // Min offset, zero clamp case
582 m_testValues.push_back(PolygonOffsetClampValues(0.0f, -1000.0f, -INFINITY)); // Min Offset, infinity clamp case
583 m_testValues.push_back(PolygonOffsetClampValues(0.0f, 1000.0f, 0.0f)); // Max offset, zero clamp case
584 m_testValues.push_back(PolygonOffsetClampValues(0.0f, 1000.0f, INFINITY)); // Max Offset, infinity clamp case
587 bool PolygonOffsetClampZeroInfinityTestCase::verify(GLuint caseNo, GLfloat depth, GLfloat offsetDepth,
588 GLfloat offsetClampDepth)
592 if (depth == offsetDepth || depth == offsetClampDepth || offsetDepth != offsetClampDepth)
594 m_testCtx.getLog() << tcu::TestLog::Message
595 << "PolygonOffsetClampEXT failed at Zero/Infinity offset clamp test.\n"
596 << "Expected result: "
597 << "refDepth[" << depth << "] != "
598 << "(offsetClampDepth[" << offsetClampDepth << "] == "
599 << "offsetDepth[" << offsetDepth << "])" << tcu::TestLog::EndMessage;
609 * @param context Rendering context.
611 PolygonOffsetClamp::PolygonOffsetClamp(deqp::Context& context)
612 : TestCaseGroup(context, "polygon_offset_clamp",
613 "Verify conformance of CTS_EXT_polygon_offset_clamp implementation")
617 /** Initializes the test group contents. */
618 void PolygonOffsetClamp::init()
620 addChild(new PolygonOffsetClampAvailabilityTestCase(m_context));
621 addChild(new PolygonOffsetClampMinMaxTestCase(m_context));
622 addChild(new PolygonOffsetClampZeroInfinityTestCase(m_context));
624 } /* glcts namespace */