return STOP;
}
-/** Constructor.
- *
- * @param context Rendering context handle.
- **/
-DrawElementsBaseVertexNegativeMappedBufferObjectsTest::DrawElementsBaseVertexNegativeMappedBufferObjectsTest(
- Context& context, const ExtParameters& extParams)
- : DrawElementsBaseVertexTestBase(
- context, extParams, "invalid_mapped_bos",
- "Tries to use mapped VBO and Index Buffer Object for the \"base vertex\" draw calls")
-{
- /* Left blank on purpose */
-}
-
-/** Executes test iteration.
- *
- * @return Returns STOP when test has finished executing, CONTINUE if more iterations are needed.
- */
-tcu::TestNode::IterateResult DrawElementsBaseVertexNegativeMappedBufferObjectsTest::iterate()
-{
- const glw::Functions& gl = m_context.getRenderContext().getFunctions();
-
- /* The test needs to be run in four iterations, where for each iteration we configure the VAO
- * in a slightly different manner.
- */
- for (int iteration = 0; iteration < 4; ++iteration)
- {
- bool use_clientside_index_data = ((iteration & (1 << 0)) != 0);
- bool use_clientside_vertex_data = ((iteration & (1 << 1)) != 0);
-
- /* OpenGL does not support client-side data. */
- if (!glu::isContextTypeES(m_context.getRenderContext().getType()))
- {
- if (use_clientside_index_data || use_clientside_vertex_data)
- {
- continue;
- }
- }
-
- /* Skip the iteration where no array buffer is used */
- if (use_clientside_vertex_data)
- {
- continue;
- }
-
- /* Set up the work environment */
- setUpNegativeTestObjects(use_clientside_vertex_data, use_clientside_index_data);
-
- /* Map the buffer object into process space */
- const glw::GLvoid* bo_ptr = gl.mapBufferRange(GL_ARRAY_BUFFER, 0, /* offset */
- m_bo_negative_data_vertex_size, GL_MAP_READ_BIT);
- (void)bo_ptr;
- GLU_EXPECT_NO_ERROR(gl.getError(), "glMapBufferRange() call failed.");
-
- /* Perform draw calls that would otherwise have been valid, if it
- * were not for the mapped VBO
- */
- glw::GLenum error_code = GL_NONE;
-
- gl.drawElementsBaseVertex(GL_TRIANGLES, 3, /* count */
- GL_UNSIGNED_INT, m_draw_call_index_offset, 0); /* basevertex */
-
- error_code = gl.getError();
- if (error_code != GL_INVALID_OPERATION)
- {
- std::stringstream error_sstream;
-
- error_sstream << "Invalid error code generated by "
- << getFunctionName(FUNCTION_GL_DRAW_ELEMENTS_BASE_VERTEX);
-
- m_testCtx.getLog() << tcu::TestLog::Message << getFunctionName(FUNCTION_GL_DRAW_ELEMENTS_BASE_VERTEX)
- << " returned error code [" << error_code << "] instead of GL_INVALID_OPERATION."
- << tcu::TestLog::EndMessage;
-
- TCU_FAIL(error_sstream.str().c_str());
- } /* if (error_code != GL_INVALID_OPERATION) */
-
- gl.drawElementsInstancedBaseVertex(GL_TRIANGLES, 3, /* count */
- GL_UNSIGNED_INT, m_draw_call_index_offset, 1, /* instancecount */
- 0); /* basevertex */
-
- error_code = gl.getError();
- if (error_code != GL_INVALID_OPERATION)
- {
- std::stringstream error_sstream;
-
- error_sstream << "Invalid error code generated by "
- << getFunctionName(FUNCTION_GL_DRAW_ELEMENTS_INSTANCED_BASE_VERTEX);
-
- m_testCtx.getLog() << tcu::TestLog::Message
- << getFunctionName(FUNCTION_GL_DRAW_ELEMENTS_INSTANCED_BASE_VERTEX)
- << " returned error code [" << error_code << "] instead of GL_INVALID_OPERATION."
- << tcu::TestLog::EndMessage;
-
- TCU_FAIL(error_sstream.str().c_str());
- }
-
- gl.drawRangeElementsBaseVertex(GL_TRIANGLES, 0, 2, /* end */
- 3, /* count */
- GL_UNSIGNED_INT, m_draw_call_index_offset, 0); /* basevertex */
-
- error_code = gl.getError();
- if (error_code != GL_INVALID_OPERATION)
- {
- std::stringstream error_sstream;
-
- error_sstream << "Invalid error code generated by "
- << getFunctionName(FUNCTION_GL_DRAW_RANGE_ELEMENTS_BASE_VERTEX);
-
- m_testCtx.getLog() << tcu::TestLog::Message << getFunctionName(FUNCTION_GL_DRAW_RANGE_ELEMENTS_BASE_VERTEX)
- << " returned error code [" << error_code << "] instead of GL_INVALID_OPERATION."
- << tcu::TestLog::EndMessage;
-
- TCU_FAIL(error_sstream.str().c_str());
- }
-
- /* Unmap the BO before we proceed */
- gl.unmapBuffer(GL_ARRAY_BUFFER);
- GLU_EXPECT_NO_ERROR(gl.getError(), "glUnmapBuffer() call failed");
-
- } /* for (all test iterations) */
-
- /* Test case passed */
- m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
-
- return STOP;
-}
-
/** Constructor.
*
* @param context Rendering context.
addChild(new DrawElementsBaseVertexNegativeInvalidPrimcountArgumentTest(m_context, m_extParams));
addChild(new DrawElementsBaseVertexNegativeInvalidStartEndArgumentsTest(m_context, m_extParams));
addChild(new DrawElementsBaseVertexNegativeInvalidTypeArgumentTest(m_context, m_extParams));
- addChild(new DrawElementsBaseVertexNegativeMappedBufferObjectsTest(m_context, m_extParams));
}
} /* glcts namespace */