static RSS::FinderPattern ParseFoundFinderPattern(const BitArray& row, int rowNumber, bool right, BitArray::Range range, FinderCounters& finderCounters) { if (!range || range.begin == row.begin()) return {}; // Actually we found elements 2-5 -> Locate element 1 auto i = std::find(BitArray::ReverseIterator(range.begin), row.rend(), *range.begin); int firstCounter = range.begin - i.base(); range.begin = i.base(); // Make 'counters' hold 1-4 std::copy_backward(finderCounters.begin(), finderCounters.end() - 1, finderCounters.end()); finderCounters[0] = firstCounter; int value = RSS::ReaderHelper::ParseFinderValue(finderCounters, FINDER_PATTERNS); if (value < 0) return {}; int start = range.begin - row.begin(); int end = range.end - row.begin(); if (right) { // row is actually reversed start = row.size() - 1 - start; end = row.size() - 1 - end; } return {value, range.begin - row.begin(), range.end - row.begin(), {ResultPoint(start, rowNumber), ResultPoint(end, rowNumber)}}; }
void ShaderMultiDrawElementsParametersTestCase::initChild() { // Set expected result vector [x, y, red, green, blue] m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -1.0f + 0.05f, 0.0f, 0.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -1.0f + 0.15f, 1.0f, 1.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -1.0f + 0.05f, 1.0f, 1.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -1.0f + 0.15f, 1.0f, 0.0f, 0.0f)); }
void ShaderMultiDrawArraysIndirectParametersTestCase::initChild() { const Functions& gl = m_context.getRenderContext().getFunctions(); // Set expected result vector [x, y, red, green, blue] m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -1.0f + 0.05f, 0.0f, 1.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -1.0f + 0.15f, 1.0f, 1.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -1.0f + 0.05f, 1.0f, 0.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -1.0f + 0.15f, 1.0f, 0.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -0.8f + 0.05f, 0.0f, 0.0f, 1.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -0.8f + 0.15f, 0.0f, 0.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -0.8f + 0.05f, 0.0f, 0.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -0.8f + 0.15f, 0.0f, 0.0f, 0.0f)); const SDPDrawArraysIndirectCommand indirect[] = { { 5, 1, 1, 0 }, { 4, 1, 0, 0 }, { 3, 1, 0, 1 }, }; // Setup indirect command buffer gl.genBuffers(1, &m_drawIndirectBuffer); GLU_EXPECT_NO_ERROR(gl.getError(), "glGenBuffers"); gl.bindBuffer(GL_DRAW_INDIRECT_BUFFER, m_drawIndirectBuffer); GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer"); gl.bufferData(GL_DRAW_INDIRECT_BUFFER, 3 * sizeof(SDPDrawArraysIndirectCommand), indirect, GL_STATIC_DRAW); GLU_EXPECT_NO_ERROR(gl.getError(), "glBufferData"); }
/** * recenters the points of a constant distance towards the center * * @param y bottom most point * @param z left most point * @param x right most point * @param t top most point * @return {@link ResultPoint}[] describing the corners of the rectangular * region. The first and last points are opposed on the diagonal, as * are the second and third. The first point will be the topmost * point and the last, the bottommost. The second point will be * leftmost and the third, the rightmost */ static void CenterEdges(const ResultPoint& y, const ResultPoint& z, const ResultPoint& x, const ResultPoint& t, int width, ResultPoint& p0, ResultPoint& p1, ResultPoint& p2, ResultPoint& p3) { // // t t // z x // x OR z // y y // float yi = y.x(); float yj = y.y(); float zi = z.x(); float zj = z.y(); float xi = x.x(); float xj = x.y(); float ti = t.x(); float tj = t.y(); if (yi < width / 2.0f) { p0 = ResultPoint(ti - CORR, tj + CORR); p1 = ResultPoint(zi + CORR, zj + CORR); p2 = ResultPoint(xi - CORR, xj - CORR); p3 = ResultPoint(yi + CORR, yj - CORR); } else { p0 = ResultPoint(ti + CORR, tj + CORR); p1 = ResultPoint(zi + CORR, zj - CORR); p2 = ResultPoint(xi - CORR, xj + CORR); p3 = ResultPoint(yi - CORR, yj - CORR); } }
void ShaderMultiDrawElementsIndirectCountParametersTestCase::initChild() { if (!m_context.getContextInfo().isExtensionSupported("GL_ARB_indirect_parameters")) TCU_THROW(NotSupportedError, "Extension GL_ARB_indirect_parameters not supported"); const Functions& gl = m_context.getRenderContext().getFunctions(); // Set expected result vector [x, y, red, green, blue] m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -1.0f + 0.05f, 1.0f, 0.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -1.0f + 0.15f, 0.0f, 0.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -1.0f + 0.05f, 0.0f, 0.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -1.0f + 0.15f, 0.0f, 0.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-0.8f + 0.05f, -0.8f + 0.05f, 0.0f, 0.0f, 0.0f)); m_resultPoints.push_back(ResultPoint(-0.8f + 0.05f, -0.8f + 0.15f, 0.0f, 1.0f, 1.0f)); m_resultPoints.push_back(ResultPoint(-0.8f + 0.15f, -0.8f + 0.05f, 0.0f, 0.0f, 1.0f)); m_resultPoints.push_back(ResultPoint(-0.8f + 0.15f, -0.8f + 0.15f, 0.0f, 0.0f, 0.0f)); const SDPDrawElementsIndirectCommand indirect[] = { { 3, 1, 0, 0, 0 }, { 3, 1, 0, 1, 1 }, { 4, 1, 0, 1, 1 }, }; const GLushort parameters[] = { 1, 1, 1 }; // Setup indirect command buffer gl.genBuffers(1, &m_drawIndirectBuffer); GLU_EXPECT_NO_ERROR(gl.getError(), "glGenBuffers"); gl.bindBuffer(GL_DRAW_INDIRECT_BUFFER, m_drawIndirectBuffer); GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer"); gl.bufferData(GL_DRAW_INDIRECT_BUFFER, 3 * sizeof(SDPDrawElementsIndirectCommand), indirect, GL_STATIC_DRAW); GLU_EXPECT_NO_ERROR(gl.getError(), "glBufferData"); // Setup indirect command buffer gl.genBuffers(1, &m_parameterBuffer); GLU_EXPECT_NO_ERROR(gl.getError(), "glGenBuffers"); gl.bindBuffer(GL_PARAMETER_BUFFER_ARB, m_parameterBuffer); GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer"); gl.bufferData(GL_PARAMETER_BUFFER_ARB, 3 * sizeof(GLushort), parameters, GL_STATIC_DRAW); GLU_EXPECT_NO_ERROR(gl.getError(), "glBufferData"); }