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 glu::ContextType contextType = m_context.getRenderContext().getType();
90 m_extensionSupported = glu::contextSupports(contextType, glu::ApiType::core(4, 6));
91 m_extensionSupported |= context.getContextInfo().isExtensionSupported("GL_EXT_polygon_offset_clamp");
92 m_extensionSupported |= context.getContextInfo().isExtensionSupported("GL_ARB_polygon_offset_clamp");
95 tcu::TestNode::IterateResult PolygonOffsetClampTestCaseBase::iterate()
97 if (!m_extensionSupported)
99 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Not supported");
103 test(m_context.getRenderContext().getFunctions());
110 * @param context Rendering context
112 PolygonOffsetClampAvailabilityTestCase::PolygonOffsetClampAvailabilityTestCase(deqp::Context& context)
113 : PolygonOffsetClampTestCaseBase(context, "PolygonOffsetClampAvailability",
114 "Verifies if queries for GL_EXT_polygon_offset_clamp extension works properly")
118 void PolygonOffsetClampAvailabilityTestCase::test(const glw::Functions& gl)
122 gl.getBooleanv(GL_POLYGON_OFFSET_CLAMP_EXT, &data);
123 GLU_EXPECT_NO_ERROR(gl.getError(), "getBooleanv error occurred");
127 gl.getIntegerv(GL_POLYGON_OFFSET_CLAMP_EXT, &data);
128 GLU_EXPECT_NO_ERROR(gl.getError(), "getBooleanv error occurred");
132 gl.getInteger64v(GL_POLYGON_OFFSET_CLAMP_EXT, &data);
133 GLU_EXPECT_NO_ERROR(gl.getError(), "getBooleanv error occurred");
137 gl.getFloatv(GL_POLYGON_OFFSET_CLAMP_EXT, &data);
138 GLU_EXPECT_NO_ERROR(gl.getError(), "getBooleanv error occurred");
141 // OpenGL ES does not support getDoublev query
142 if (glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
145 gl.getDoublev(GL_POLYGON_OFFSET_CLAMP_EXT, &data);
146 GLU_EXPECT_NO_ERROR(gl.getError(), "getBooleanv error occurred");
149 gl.polygonOffsetClamp(1.0f, 1.0f, 0.5f);
150 GLU_EXPECT_NO_ERROR(gl.getError(), "polygonOffsetClamp error occurred");
152 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
157 * @param context Rendering context
159 PolygonOffsetClampValueTestCaseBase::PolygonOffsetClampValueTestCaseBase(deqp::Context& context, const char* name,
160 const char* description)
161 : PolygonOffsetClampTestCaseBase(context, name, description)
166 , m_colorBufReadback(0)
170 /** Initialization method that creates framebuffer with depth attachment
172 void PolygonOffsetClampValueTestCaseBase::init()
174 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
176 gl.genTextures(1, &m_depthBuf);
177 GLU_EXPECT_NO_ERROR(gl.getError(), "genTextures");
178 gl.bindTexture(GL_TEXTURE_2D, m_depthBuf);
179 GLU_EXPECT_NO_ERROR(gl.getError(), "bindTexture");
180 gl.texStorage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT16, 64, 64);
181 GLU_EXPECT_NO_ERROR(gl.getError(), "texStorage2D");
182 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
183 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
184 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
185 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
187 gl.genTextures(1, &m_colorBuf);
188 GLU_EXPECT_NO_ERROR(gl.getError(), "genTextures");
189 gl.bindTexture(GL_TEXTURE_2D, m_colorBuf);
190 GLU_EXPECT_NO_ERROR(gl.getError(), "bindTexture");
191 gl.texStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 64, 64);
192 GLU_EXPECT_NO_ERROR(gl.getError(), "texStorage2D");
193 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
194 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
195 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
196 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
198 gl.genFramebuffers(1, &m_fbo);
199 GLU_EXPECT_NO_ERROR(gl.getError(), "genFramebuffers");
200 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
201 GLU_EXPECT_NO_ERROR(gl.getError(), "bindFramebuffer");
202 gl.framebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthBuf, 0);
203 GLU_EXPECT_NO_ERROR(gl.getError(), "framebufferTexture2D");
204 gl.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_colorBuf, 0);
205 GLU_EXPECT_NO_ERROR(gl.getError(), "framebufferTexture2D");
207 if (!glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
209 gl.genTextures(1, &m_colorBufReadback);
210 GLU_EXPECT_NO_ERROR(gl.getError(), "genTextures");
211 gl.bindTexture(GL_TEXTURE_2D, m_colorBufReadback);
212 GLU_EXPECT_NO_ERROR(gl.getError(), "bindTexture");
213 gl.texStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 64, 64);
214 GLU_EXPECT_NO_ERROR(gl.getError(), "texStorage2D");
215 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
216 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
217 gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
218 GLU_EXPECT_NO_ERROR(gl.getError(), "texParameteri");
220 gl.genFramebuffers(1, &m_fboReadback);
221 GLU_EXPECT_NO_ERROR(gl.getError(), "genFramebuffers");
222 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fboReadback);
223 GLU_EXPECT_NO_ERROR(gl.getError(), "bindFramebuffer");
224 gl.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_colorBufReadback, 0);
225 GLU_EXPECT_NO_ERROR(gl.getError(), "framebufferTexture2D");
228 gl.viewport(0, 0, 64, 64);
231 /** De-Initialization method that releases
233 void PolygonOffsetClampValueTestCaseBase::deinit()
235 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
237 gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
238 GLU_EXPECT_NO_ERROR(gl.getError(), "bindFramebuffer");
241 gl.deleteFramebuffers(1, &m_fbo);
243 gl.deleteTextures(1, &m_depthBuf);
245 gl.deleteTextures(1, &m_colorBuf);
247 if (!glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
249 if (m_colorBufReadback)
250 gl.deleteTextures(1, &m_colorBufReadback);
252 gl.deleteFramebuffers(1, &m_fboReadback);
256 /** Testing method that verifies if depth values generated after polygon offset clamp are as expected.
258 * @param gl Function bindings
260 void PolygonOffsetClampValueTestCaseBase::test(const glw::Functions& gl)
262 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 };
264 // Prepare shader program
265 std::string vertexColor;
266 std::string fragmentColor;
267 if (glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
268 vertexColor = std::string(poc_shader_version_450core);
270 vertexColor = std::string(poc_shader_version_310es);
271 fragmentColor = vertexColor;
273 vertexColor = vertexColor + poc_vertexColor;
274 fragmentColor = fragmentColor + poc_fragmentColor;
276 ProgramSources testSources = makeVtxFragSources(vertexColor, fragmentColor);
277 ShaderProgram testProgram(gl, testSources);
279 if (!testProgram.isOk())
281 m_testCtx.getLog() << tcu::TestLog::Message << "TestProgram build failed.\n"
282 << "Vertex: " << testProgram.getShaderInfo(SHADERTYPE_VERTEX).infoLog << "\n"
283 << "Fragment: " << testProgram.getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
284 << "Program: " << testProgram.getProgramInfo().infoLog << tcu::TestLog::EndMessage;
286 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
290 ShaderProgram* readDepthProgram = DE_NULL;
291 GLuint readDepthProgramId = 0;
293 // Prepare shader program for reading depth buffer indirectly
294 if (!glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
296 std::string vertexTexture = std::string(poc_shader_version_310es) + poc_vertexTexture;
297 std::string fragmentTexture = std::string(poc_shader_version_310es) + poc_fragmentTexture;
299 ProgramSources readDepthSources = makeVtxFragSources(vertexTexture, fragmentTexture);
301 readDepthProgram = new ShaderProgram(gl, readDepthSources);
303 if (!readDepthProgram->isOk())
305 m_testCtx.getLog() << tcu::TestLog::Message << "ReadDepthProgram build failed.\n"
306 << "Vertex: " << readDepthProgram->getShaderInfo(SHADERTYPE_VERTEX).infoLog << "\n"
307 << "Fragment: " << readDepthProgram->getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
308 << "Program: " << readDepthProgram->getProgramInfo().infoLog << tcu::TestLog::EndMessage;
310 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
314 readDepthProgramId = readDepthProgram->getProgram();
317 gl.useProgram(testProgram.getProgram());
318 GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram");
323 // Setup depth testing
324 gl.enable(GL_DEPTH_TEST);
325 GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable");
327 gl.depthFunc(GL_ALWAYS);
328 GLU_EXPECT_NO_ERROR(gl.getError(), "glDepthFunc");
330 // Generate vertex array object
331 gl.genVertexArrays(1, &vao);
332 GLU_EXPECT_NO_ERROR(gl.getError(), "glGenVertexArrays");
334 gl.bindVertexArray(vao);
335 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindVertexArray");
337 // Setup vertex array buffer
338 gl.genBuffers(1, &arrayBuffer);
339 GLU_EXPECT_NO_ERROR(gl.getError(), "glGenBuffers");
341 gl.bindBuffer(GL_ARRAY_BUFFER, arrayBuffer);
342 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer");
344 gl.bufferData(GL_ARRAY_BUFFER, 12 * sizeof(GLfloat), vertices, GL_STATIC_DRAW);
345 GLU_EXPECT_NO_ERROR(gl.getError(), "glBufferData");
347 // Setup vertex attrib pointer
348 gl.enableVertexAttribArray(0);
349 GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray");
351 gl.vertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
352 GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer");
354 // Bind framebuffer for drawing
355 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
356 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer");
359 for (GLuint i = 0; i < m_testValues.size(); ++i)
361 // Prepare verification variables
362 GLfloat depthValue = 0.0f;
363 GLfloat depthValueOffset = 0.0f;
364 GLfloat depthValueOffsetClamp = 0.0f;
366 // Draw reference polygon
367 gl.disable(GL_POLYGON_OFFSET_FILL);
368 GLU_EXPECT_NO_ERROR(gl.getError(), "glDisable");
370 gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
371 GLU_EXPECT_NO_ERROR(gl.getError(), "glClear");
373 gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
374 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays");
376 // Get reference depth value
377 depthValue = readDepthValue(gl, readDepthProgramId);
379 // Draw polygon with depth offset
380 gl.enable(GL_POLYGON_OFFSET_FILL);
381 GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable");
383 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
384 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer");
386 gl.polygonOffset(m_testValues[i].factor, m_testValues[i].units);
387 GLU_EXPECT_NO_ERROR(gl.getError(), "glPolygonOffset");
389 gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
390 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays");
392 depthValueOffset = readDepthValue(gl, readDepthProgramId);
394 // Draw reference polygon
395 gl.disable(GL_POLYGON_OFFSET_FILL);
396 GLU_EXPECT_NO_ERROR(gl.getError(), "glDisable");
398 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
399 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer");
401 gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
402 GLU_EXPECT_NO_ERROR(gl.getError(), "glClear");
404 gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
405 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays");
407 // Draw polygon with depth offset
408 gl.enable(GL_POLYGON_OFFSET_FILL);
409 GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable");
411 gl.polygonOffsetClamp(m_testValues[i].factor, m_testValues[i].units, m_testValues[i].clamp);
412 GLU_EXPECT_NO_ERROR(gl.getError(), "glPolygonOffsetClamp");
414 gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
415 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays");
417 depthValueOffsetClamp = readDepthValue(gl, readDepthProgramId);
420 result = result && verify(i, depthValue, depthValueOffset, depthValueOffsetClamp);
424 gl.disableVertexAttribArray(0);
425 GLU_EXPECT_NO_ERROR(gl.getError(), "glDisableVertexAttribArray");
427 gl.deleteVertexArrays(1, &arrayBuffer);
428 GLU_EXPECT_NO_ERROR(gl.getError(), "glDeleteVertexArrays");
430 gl.deleteVertexArrays(1, &vao);
431 GLU_EXPECT_NO_ERROR(gl.getError(), "glDeleteVertexArrays");
433 gl.disable(GL_POLYGON_OFFSET_FILL);
434 GLU_EXPECT_NO_ERROR(gl.getError(), "glDisable");
436 if (readDepthProgram)
437 delete readDepthProgram;
440 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
442 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
447 * @param gl Function bindings
449 float PolygonOffsetClampValueTestCaseBase::readDepthValue(const glw::Functions& gl, const GLuint readDepthProgramId)
451 GLfloat depthValue = 0.0f;
453 if (glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
455 gl.readPixels(0, 0, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depthValue);
456 GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels");
458 // OpenGL ES does not support reading pixels directly from depth buffer
461 // Bind framebuffer for readback
462 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fboReadback);
463 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer");
465 gl.disable(GL_DEPTH_TEST);
466 GLU_EXPECT_NO_ERROR(gl.getError(), "glDisable");
468 gl.useProgram(readDepthProgramId);
469 GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram");
471 gl.activeTexture(GL_TEXTURE0);
472 GLU_EXPECT_NO_ERROR(gl.getError(), "glActiveTexture");
473 gl.bindTexture(GL_TEXTURE_2D, m_depthBuf);
474 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture");
476 GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i");
478 gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
479 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays");
482 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
483 GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels");
485 gl.enable(GL_DEPTH_TEST);
486 GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable");
488 // Convert read depth value to GLfloat normalized
489 depthValue = (GLfloat)(pixels[0] + pixels[1] * 256) / 0xFFFF;
491 // Bind framebuffer for drawing
492 gl.bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
493 GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer");
501 * @param context Rendering context
503 PolygonOffsetClampMinMaxTestCase::PolygonOffsetClampMinMaxTestCase(deqp::Context& context)
504 : PolygonOffsetClampValueTestCaseBase(
505 context, "PolygonOffsetClampMinMax",
506 "Verifies if polygon offset clamp works as expected for non-zero, finite clamp values")
510 /** Initialization method that fills polygonOffset* testing values
512 void PolygonOffsetClampMinMaxTestCase::init()
514 PolygonOffsetClampValueTestCaseBase::init();
516 m_testValues.clear();
517 m_testValues.push_back(PolygonOffsetClampValues(0.0f, -1000.0f, -0.0001f)); // Min offset case
518 m_testValues.push_back(PolygonOffsetClampValues(0.0f, 1000.0f, 0.0001f)); // Max offset case
521 /** Verification method that determines if depth values are as expected
523 * @param caseNo Case iteration number
524 * @param depth Reference depth value
525 * @param offsetDepth Case iteration number
526 * @param offsetClampDepth Case iteration number
528 bool PolygonOffsetClampMinMaxTestCase::verify(GLuint caseNo, GLfloat depth, GLfloat offsetDepth,
529 GLfloat offsetClampDepth)
534 if (depth <= offsetDepth || depth <= offsetClampDepth || offsetDepth >= offsetClampDepth)
536 m_testCtx.getLog() << tcu::TestLog::Message << "PolygonOffsetClampEXT failed at MIN offset test.\n"
537 << "Expected result: "
538 << "refDepth[" << depth << "] > "
539 << "offsetClampDepth[" << offsetClampDepth << "] > "
540 << "offsetDepth[" << offsetDepth << "]" << tcu::TestLog::EndMessage;
546 else if (caseNo == 1)
548 if (depth >= offsetDepth || depth >= offsetClampDepth || offsetDepth <= offsetClampDepth)
550 m_testCtx.getLog() << tcu::TestLog::Message << "PolygonOffsetClampEXT failed at MAX offset test.\n"
551 << "Expected result: "
552 << "refDepth[" << depth << "] < "
553 << "offsetClampDepth[" << offsetClampDepth << "] < "
554 << "offsetDepth[" << offsetDepth << "]" << tcu::TestLog::EndMessage;
568 * @param context Rendering context
570 PolygonOffsetClampZeroInfinityTestCase::PolygonOffsetClampZeroInfinityTestCase(deqp::Context& context)
571 : PolygonOffsetClampValueTestCaseBase(
572 context, "PolygonOffsetClampZeroInfinity",
573 "Verifies if polygon offset clamp works as expected for zero and infinite clamp values")
577 /** Initialization method that fills polygonOffset* testing values
579 void PolygonOffsetClampZeroInfinityTestCase::init()
581 PolygonOffsetClampValueTestCaseBase::init();
583 m_testValues.clear();
584 m_testValues.push_back(PolygonOffsetClampValues(0.0f, -1000.0f, 0.0f)); // Min offset, zero clamp case
585 m_testValues.push_back(PolygonOffsetClampValues(0.0f, -1000.0f, -INFINITY)); // Min Offset, infinity clamp case
586 m_testValues.push_back(PolygonOffsetClampValues(0.0f, 1000.0f, 0.0f)); // Max offset, zero clamp case
587 m_testValues.push_back(PolygonOffsetClampValues(0.0f, 1000.0f, INFINITY)); // Max Offset, infinity clamp case
590 bool PolygonOffsetClampZeroInfinityTestCase::verify(GLuint caseNo, GLfloat depth, GLfloat offsetDepth,
591 GLfloat offsetClampDepth)
595 if (depth == offsetDepth || depth == offsetClampDepth || offsetDepth != offsetClampDepth)
597 m_testCtx.getLog() << tcu::TestLog::Message
598 << "PolygonOffsetClampEXT failed at Zero/Infinity offset clamp test.\n"
599 << "Expected result: "
600 << "refDepth[" << depth << "] != "
601 << "(offsetClampDepth[" << offsetClampDepth << "] == "
602 << "offsetDepth[" << offsetDepth << "])" << tcu::TestLog::EndMessage;
612 * @param context Rendering context.
614 PolygonOffsetClamp::PolygonOffsetClamp(deqp::Context& context)
615 : TestCaseGroup(context, "polygon_offset_clamp",
616 "Verify conformance of CTS_EXT_polygon_offset_clamp implementation")
620 /** Initializes the test group contents. */
621 void PolygonOffsetClamp::init()
623 addChild(new PolygonOffsetClampAvailabilityTestCase(m_context));
624 addChild(new PolygonOffsetClampMinMaxTestCase(m_context));
625 addChild(new PolygonOffsetClampZeroInfinityTestCase(m_context));
627 } /* glcts namespace */