, m_vertex_data_bo_size(0)
, m_expected_adjacency_geometry(0)
, m_expected_geometry(0)
+ , m_alternate_expected_adjacency_geometry(0)
+ , m_alternate_expected_geometry(0)
, m_index_data(0)
, m_tf_mode(0)
, m_vertex_data(0)
m_expected_geometry = 0;
}
+ if (m_alternate_expected_adjacency_geometry)
+ {
+ delete[] m_alternate_expected_adjacency_geometry;
+ m_alternate_expected_adjacency_geometry = 0;
+ }
+
+ if (m_alternate_expected_geometry)
+ {
+ delete[] m_alternate_expected_geometry;
+ m_alternate_expected_geometry = 0;
+ }
+
if (m_vertex_data)
{
delete[] m_vertex_data;
float* result_adjacency_geometry_ptr = 0;
float* result_geometry_ptr = 0;
+ bool hasAlternateData = m_test_data.m_alternate_expected_geometry != nullptr &&
+ m_test_data.m_alternate_expected_adjacency_geometry != nullptr;
+ bool adjacentMatchesExpected = true;
+ bool adjacentMatchesAlternateExpected = hasAlternateData;
+
/* If gs is available read adjacency data using TF and compare with expected data*/
if (m_test_data.m_gs_code)
{
GLU_EXPECT_NO_ERROR(gl.getError(), "Error when mapping data to client space");
std::stringstream sstreamExpected;
+ std::stringstream sstreamAlternateExpected;
std::stringstream sstreamResult;
sstreamExpected << "[";
+ if (hasAlternateData)
+ sstreamAlternateExpected << "[";
sstreamResult << "[";
+ unsigned int differentExpectedIndex = 0;
+ unsigned int differentAlternateExpectedIndex = 0;
for (unsigned int n = 0; n < m_test_data.m_geometry_bo_size / sizeof(float); ++n)
{
sstreamExpected << m_test_data.m_expected_adjacency_geometry[n] << ", ";
+ if (hasAlternateData)
+ sstreamAlternateExpected << m_test_data.m_alternate_expected_adjacency_geometry[n] << ", ";
sstreamResult << result_adjacency_geometry_ptr[n] << ", ";
- if (de::abs(result_adjacency_geometry_ptr[n] - m_test_data.m_expected_adjacency_geometry[n]) >= m_epsilon)
+ if (adjacentMatchesExpected &&
+ de::abs(result_adjacency_geometry_ptr[n] -
+ m_test_data.m_expected_adjacency_geometry[n]) >= m_epsilon)
+ {
+ adjacentMatchesExpected = false;
+ differentExpectedIndex = n;
+ }
+ if (adjacentMatchesAlternateExpected &&
+ de::abs(result_adjacency_geometry_ptr[n] - m_test_data.m_alternate_expected_adjacency_geometry[n]) >=
+ m_epsilon)
+ {
+ adjacentMatchesAlternateExpected = false;
+ differentAlternateExpectedIndex = n;
+ }
+ if (!adjacentMatchesExpected && !adjacentMatchesAlternateExpected)
{
gl.unmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
- m_testCtx.getLog() << tcu::TestLog::Message << "At [" << n
+ m_testCtx.getLog() << tcu::TestLog::Message << "At [" << differentExpectedIndex
<< "] position adjacency buffer position Reference value is different than the "
"rendered data (epsilon "
<< m_epsilon << " )"
- << " (" << m_test_data.m_expected_adjacency_geometry[n] << ") vs "
- << "(" << result_adjacency_geometry_ptr[n] << ")" << tcu::TestLog::EndMessage;
+ << " (" << m_test_data.m_expected_adjacency_geometry[differentExpectedIndex]
+ << ") vs "
+ << "(" << result_adjacency_geometry_ptr[differentExpectedIndex] << ")"
+ << tcu::TestLog::EndMessage;
+
+ if (hasAlternateData)
+ {
+ m_testCtx.getLog()
+ << tcu::TestLog::Message << "At [" << differentAlternateExpectedIndex
+ << "] alternate position adjacency buffer position Reference value is different than the "
+ "rendered data (epsilon "
+ << m_epsilon << " )"
+ << " (" << m_test_data.m_alternate_expected_adjacency_geometry[differentAlternateExpectedIndex]
+ << ") vs "
+ << "(" << result_adjacency_geometry_ptr[differentAlternateExpectedIndex] << ")"
+ << tcu::TestLog::EndMessage;
+ }
m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
return STOP;
}
sstreamExpected << "]";
+ if (hasAlternateData)
+ sstreamAlternateExpected << "]";
sstreamResult << "]";
m_testCtx.getLog() << tcu::TestLog::Message << "Adjacency Expected: " << sstreamExpected.str().c_str()
<< tcu::TestLog::EndMessage;
+ if (hasAlternateData)
+ m_testCtx.getLog() << tcu::TestLog::Message
+ << "Alternate adjacency Expected: " << sstreamAlternateExpected.str().c_str()
+ << tcu::TestLog::EndMessage;
m_testCtx.getLog() << tcu::TestLog::Message << "Adjacency Result: " << sstreamResult.str().c_str()
<< tcu::TestLog::EndMessage;
GLU_EXPECT_NO_ERROR(gl.getError(), "Error when mapping data to client space");
std::stringstream sstreamExpected;
+ std::stringstream sstreamAlternateExpected;
std::stringstream sstreamResult;
sstreamExpected << "[";
+ if (hasAlternateData)
+ {
+ sstreamAlternateExpected << "[";
+ }
sstreamResult << "[";
+ bool matchesExpected = true;
+ bool matchesAlternateExpected = hasAlternateData;
+ unsigned int differentIndex = 0;
+ unsigned int differentAlternateIndex = 0;
+
for (unsigned int n = 0; n < m_test_data.m_geometry_bo_size / sizeof(float); ++n)
{
sstreamExpected << m_test_data.m_expected_geometry[n] << ", ";
+ if (hasAlternateData)
+ {
+ sstreamAlternateExpected << m_test_data.m_alternate_expected_geometry[n] << ", ";
+ }
sstreamResult << result_geometry_ptr[n] << ", ";
- if (de::abs(result_geometry_ptr[n] - m_test_data.m_expected_geometry[n]) >= m_epsilon)
+ if (matchesExpected && de::abs(result_geometry_ptr[n] - m_test_data.m_expected_geometry[n]) >= m_epsilon)
+ {
+ matchesExpected = false;
+ differentIndex = n;
+ }
+ if (matchesAlternateExpected &&
+ de::abs(result_geometry_ptr[n] - m_test_data.m_alternate_expected_geometry[n]) >= m_epsilon)
+ {
+ matchesAlternateExpected = false;
+ differentAlternateIndex = n;
+ }
+ if (!matchesExpected && !matchesAlternateExpected)
{
gl.unmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
m_testCtx.getLog()
- << tcu::TestLog::Message << "At [" << n
+ << tcu::TestLog::Message << "At [" << differentIndex
<< "] position geometry buffer position Reference value is different than the rendered data (epsilon "
<< m_epsilon << " )"
- << " (" << m_test_data.m_expected_geometry[n] << ") vs "
- << "(" << result_geometry_ptr[n] << ")" << tcu::TestLog::EndMessage;
+ << " (" << m_test_data.m_expected_geometry[differentIndex] << ") vs "
+ << "(" << result_geometry_ptr[differentIndex] << ")" << tcu::TestLog::EndMessage;
+
+ if (hasAlternateData)
+ {
+ m_testCtx.getLog()
+ << tcu::TestLog::Message << "At [" << differentAlternateIndex
+ << "] alternate position geometry buffer position Reference value is different than the rendered data (epsilon "
+ << m_epsilon << " )"
+ << " (" << m_test_data.m_alternate_expected_geometry[differentAlternateIndex] << ") vs "
+ << "(" << result_geometry_ptr[differentAlternateIndex] << ")" << tcu::TestLog::EndMessage;
+ }
m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
return STOP;
}
}
+ if (matchesExpected && !adjacentMatchesExpected)
+ {
+ m_testCtx.getLog() << tcu::TestLog::Message
+ << "Geometry matches OpenGL ordering but adjacent geometry matches Vulkan ordering"
+ << tcu::TestLog::EndMessage;
+
+ m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
+ return STOP;
+ }
+ if (matchesAlternateExpected && !adjacentMatchesAlternateExpected)
+ {
+ m_testCtx.getLog() << tcu::TestLog::Message
+ << "Geometry matches Vulkan ordering but adjacent geometry matches OpenGL ordering"
+ << tcu::TestLog::EndMessage;
+
+ m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
+ return STOP;
+ }
+
sstreamExpected << "]";
sstreamResult << "]";
+ if (hasAlternateData)
+ {
+ sstreamAlternateExpected << "]";
+
+ sstreamExpected << "\nor\n" << sstreamAlternateExpected.str();
+ }
m_testCtx.getLog() << tcu::TestLog::Message << "Expected: " << sstreamExpected.str().c_str()
<< tcu::TestLog::EndMessage;
m_testCtx.getLog() << tcu::TestLog::Message << "Result: " << sstreamResult.str().c_str()
static_cast<glw::GLuint>(test_data.m_n_vertices * m_n_components_input * sizeof(float));
/* Allocate memory for input and expected data */
- test_data.m_expected_adjacency_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
- test_data.m_expected_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
- test_data.m_vertex_data = new float[test_data.m_vertex_data_bo_size / sizeof(float)];
+ test_data.m_expected_adjacency_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
+ test_data.m_expected_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
+ test_data.m_alternate_expected_adjacency_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
+ test_data.m_alternate_expected_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
+ test_data.m_vertex_data = new float[test_data.m_vertex_data_bo_size / sizeof(float)];
- travellerExpectedAdjacencyGeometryPtr = test_data.m_expected_adjacency_geometry;
- travellerExpectedGeometryPtr = test_data.m_expected_geometry;
travellerPtr = test_data.m_vertex_data;
/* Set input and expected values */
++travellerPtr;
}
- for (unsigned int n = 0; n < nTriangles; ++n)
+ for (unsigned int j = 0; j < 2; ++j)
{
- /* Derived from per table 2.X1 from the spec */
- int vertexIndex[3] = { -1, -1, -1 };
- int adjVertexIndex[3] = { -1, -1, -1 };
-
- if (n == 0)
+ if (j == 0)
{
- /* first (i==0) */
- adjVertexIndex[0] = 2;
- adjVertexIndex[1] = 7;
- adjVertexIndex[2] = 4;
- vertexIndex[0] = 1;
- vertexIndex[1] = 3;
- vertexIndex[2] = 5;
+ travellerExpectedAdjacencyGeometryPtr = test_data.m_expected_adjacency_geometry;
+ travellerExpectedGeometryPtr = test_data.m_expected_geometry;
}
- else if (n == nTriangles - 1)
+ else
{
- if (n % 2 == 0)
- {
- /* last (i==n-1, i even) */
- adjVertexIndex[0] = 2 * n - 1;
- adjVertexIndex[1] = 2 * n + 6;
- adjVertexIndex[2] = 2 * n + 4;
- vertexIndex[0] = 2 * n + 1;
- vertexIndex[1] = 2 * n + 3;
- vertexIndex[2] = 2 * n + 5;
- }
- else
- {
- /* last (i==n-1, i odd) */
- adjVertexIndex[0] = 2 * n - 1;
- adjVertexIndex[1] = 2 * n + 4;
- adjVertexIndex[2] = 2 * n + 6;
- vertexIndex[0] = 2 * n + 3;
- vertexIndex[1] = 2 * n + 1;
- vertexIndex[2] = 2 * n + 5;
- }
+ travellerExpectedAdjacencyGeometryPtr = test_data.m_alternate_expected_adjacency_geometry;
+ travellerExpectedGeometryPtr = test_data.m_alternate_expected_geometry;
}
- else
+ for (unsigned int n = 0; n < nTriangles; ++n)
{
- if (n % 2 == 0)
+ /* Derived from per table 2.X1 from the spec */
+ int vertexIndex[3] = { -1, -1, -1 };
+ int adjVertexIndex[3] = { -1, -1, -1 };
+
+ if (n == 0)
+ {
+ /* first (i==0) */
+ adjVertexIndex[0] = 2;
+ adjVertexIndex[1] = 7;
+ adjVertexIndex[2] = 4;
+ vertexIndex[0] = 1;
+ vertexIndex[1] = 3;
+ vertexIndex[2] = 5;
+ }
+ else if (n == nTriangles - 1)
{
- /* middle (i even) */
- adjVertexIndex[0] = 2 * n - 1;
- adjVertexIndex[1] = 2 * n + 7;
- adjVertexIndex[2] = 2 * n + 4;
- vertexIndex[0] = 2 * n + 1;
- vertexIndex[1] = 2 * n + 3;
- vertexIndex[2] = 2 * n + 5;
+ if (n % 2 == 0)
+ {
+ /* last (i==n-1, i even) */
+ adjVertexIndex[0] = 2 * n - 1;
+ adjVertexIndex[1] = 2 * n + 6;
+ adjVertexIndex[2] = 2 * n + 4;
+ vertexIndex[0] = 2 * n + 1;
+ vertexIndex[1] = 2 * n + 3;
+ vertexIndex[2] = 2 * n + 5;
+ }
+ else
+ {
+ /* last (i==n-1, i odd) */
+ if (j == 0)
+ {
+ adjVertexIndex[0] = 2 * n - 1;
+ adjVertexIndex[1] = 2 * n + 4;
+ adjVertexIndex[2] = 2 * n + 6;
+ vertexIndex[0] = 2 * n + 3;
+ vertexIndex[1] = 2 * n + 1;
+ vertexIndex[2] = 2 * n + 5;
+ }
+ else
+ {
+ adjVertexIndex[0] = 2 * n + 4;
+ adjVertexIndex[1] = 2 * n + 6;
+ adjVertexIndex[2] = 2 * n - 1;
+ vertexIndex[0] = 2 * n + 1;
+ vertexIndex[1] = 2 * n + 5;
+ vertexIndex[2] = 2 * n + 3;
+ }
+ }
}
else
{
- /* middle (i odd) */
- adjVertexIndex[0] = 2 * n - 1;
- adjVertexIndex[1] = 2 * n + 4;
- adjVertexIndex[2] = 2 * n + 7;
- vertexIndex[0] = 2 * n + 3;
- vertexIndex[1] = 2 * n + 1;
- vertexIndex[2] = 2 * n + 5;
+ if (n % 2 == 0)
+ {
+ /* middle (i even) */
+ adjVertexIndex[0] = 2 * n - 1;
+ adjVertexIndex[1] = 2 * n + 7;
+ adjVertexIndex[2] = 2 * n + 4;
+ vertexIndex[0] = 2 * n + 1;
+ vertexIndex[1] = 2 * n + 3;
+ vertexIndex[2] = 2 * n + 5;
+ }
+ else
+ {
+ /* middle (i odd) */
+ if (j == 0)
+ {
+
+ adjVertexIndex[0] = 2 * n - 1;
+ adjVertexIndex[1] = 2 * n + 4;
+ adjVertexIndex[2] = 2 * n + 7;
+ vertexIndex[0] = 2 * n + 3;
+ vertexIndex[1] = 2 * n + 1;
+ vertexIndex[2] = 2 * n + 5;
+ }
+ else
+ {
+ adjVertexIndex[0] = 2 * n + 4;
+ adjVertexIndex[1] = 2 * n + 7;
+ adjVertexIndex[2] = 2 * n - 1;
+ vertexIndex[0] = 2 * n + 1;
+ vertexIndex[1] = 2 * n + 5;
+ vertexIndex[2] = 2 * n + 3;
+ }
+ }
}
- }
- /* Spec assumes vertices are indexed from 1 */
- vertexIndex[0]--;
- vertexIndex[1]--;
- vertexIndex[2]--;
- adjVertexIndex[0]--;
- adjVertexIndex[1]--;
- adjVertexIndex[2]--;
-
- *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[0]].x;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[0]].y;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 0;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 1;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[1]].x;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[1]].y;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 0;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 1;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[2]].x;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[2]].y;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 0;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 1;
- ++travellerExpectedAdjacencyGeometryPtr;
-
- *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[0]].x;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[0]].y;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 0;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 1;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[1]].x;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[1]].y;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 0;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 1;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[2]].x;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[2]].y;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 0;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 1;
- ++travellerExpectedGeometryPtr;
- } /* for (all triangles) */
+ /* Spec assumes vertices are indexed from 1 */
+ vertexIndex[0]--;
+ vertexIndex[1]--;
+ vertexIndex[2]--;
+ adjVertexIndex[0]--;
+ adjVertexIndex[1]--;
+ adjVertexIndex[2]--;
+
+ *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[0]].x;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[0]].y;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 0;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 1;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[1]].x;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[1]].y;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 0;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 1;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[2]].x;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[adjVertexIndex[2]].y;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 0;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 1;
+ ++travellerExpectedAdjacencyGeometryPtr;
+
+ *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[0]].x;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[0]].y;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 0;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 1;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[1]].x;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[1]].y;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 0;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 1;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[2]].x;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = test_data.m_grid->m_triangle_strip.m_points[vertexIndex[2]].y;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 0;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 1;
+ ++travellerExpectedGeometryPtr;
+ } /* for (all triangles) */
+ }
}
/** Set triangle strip vertex data used to be used by indiced draw calls.
test_data.m_index_data_bo_size = static_cast<glw::GLuint>(test_data.m_n_vertices * sizeof(unsigned int));
/* Allocate memory for input and expected data */
- test_data.m_expected_adjacency_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
- test_data.m_expected_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
- test_data.m_index_data = new unsigned int[test_data.m_index_data_bo_size / sizeof(unsigned int)];
- test_data.m_vertex_data = new float[test_data.m_vertex_data_bo_size / sizeof(float)];
+ test_data.m_expected_adjacency_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
+ test_data.m_expected_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
+ test_data.m_alternate_expected_adjacency_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
+ test_data.m_alternate_expected_geometry = new float[test_data.m_geometry_bo_size / sizeof(float)];
+ test_data.m_index_data = new unsigned int[test_data.m_index_data_bo_size / sizeof(unsigned int)];
+ test_data.m_vertex_data = new float[test_data.m_vertex_data_bo_size / sizeof(float)];
- travellerExpectedAdjacencyGeometryPtr = test_data.m_expected_adjacency_geometry;
- travellerExpectedGeometryPtr = test_data.m_expected_geometry;
travellerIndicesPtr = test_data.m_index_data;
travellerPtr = test_data.m_vertex_data;
++travellerPtr;
}
- for (unsigned int n = 0; n < nTriangles; ++n)
+ for (unsigned int j = 0; j < 2; ++j)
{
- /* Derived from per table 2.X1 from the spec */
- int vertexIndex[3] = { -1, -1, -1 };
- int adjVertexIndex[3] = { -1, -1, -1 };
-
- if (n == 0)
+ if (j == 0)
{
- /* first (i==0) */
- adjVertexIndex[0] = 2;
- adjVertexIndex[1] = 7;
- adjVertexIndex[2] = 4;
- vertexIndex[0] = 1;
- vertexIndex[1] = 3;
- vertexIndex[2] = 5;
+ travellerExpectedAdjacencyGeometryPtr = test_data.m_expected_adjacency_geometry;
+ travellerExpectedGeometryPtr = test_data.m_expected_geometry;
}
- else if (n == nTriangles - 1)
+ else
{
- if (n % 2 == 0)
- {
- /* last (i==n-1, i even) */
- adjVertexIndex[0] = 2 * n - 1;
- adjVertexIndex[1] = 2 * n + 6;
- adjVertexIndex[2] = 2 * n + 4;
- vertexIndex[0] = 2 * n + 1;
- vertexIndex[1] = 2 * n + 3;
- vertexIndex[2] = 2 * n + 5;
- }
- else
- {
- /* last (i==n-1, i odd) */
- adjVertexIndex[0] = 2 * n - 1;
- adjVertexIndex[1] = 2 * n + 4;
- adjVertexIndex[2] = 2 * n + 6;
- vertexIndex[0] = 2 * n + 3;
- vertexIndex[1] = 2 * n + 1;
- vertexIndex[2] = 2 * n + 5;
- }
+ travellerExpectedAdjacencyGeometryPtr = test_data.m_alternate_expected_adjacency_geometry;
+ travellerExpectedGeometryPtr = test_data.m_alternate_expected_geometry;
}
- else
+
+ for (unsigned int n = 0; n < nTriangles; ++n)
{
- if (n % 2 == 0)
+ /* Derived from per table 2.X1 from the spec */
+ int vertexIndex[3] = { -1, -1, -1 };
+ int adjVertexIndex[3] = { -1, -1, -1 };
+
+ if (n == 0)
+ {
+ /* first (i==0) */
+ adjVertexIndex[0] = 2;
+ adjVertexIndex[1] = 7;
+ adjVertexIndex[2] = 4;
+ vertexIndex[0] = 1;
+ vertexIndex[1] = 3;
+ vertexIndex[2] = 5;
+ }
+ else if (n == nTriangles - 1)
{
- /* middle (i even) */
- adjVertexIndex[0] = 2 * n - 1;
- adjVertexIndex[1] = 2 * n + 7;
- adjVertexIndex[2] = 2 * n + 4;
- vertexIndex[0] = 2 * n + 1;
- vertexIndex[1] = 2 * n + 3;
- vertexIndex[2] = 2 * n + 5;
+ if (n % 2 == 0)
+ {
+ /* last (i==n-1, i even) */
+ adjVertexIndex[0] = 2 * n - 1;
+ adjVertexIndex[1] = 2 * n + 6;
+ adjVertexIndex[2] = 2 * n + 4;
+ vertexIndex[0] = 2 * n + 1;
+ vertexIndex[1] = 2 * n + 3;
+ vertexIndex[2] = 2 * n + 5;
+ }
+ else
+ {
+ /* last (i==n-1, i odd) */
+ if (j == 0)
+ {
+ adjVertexIndex[0] = 2 * n - 1;
+ adjVertexIndex[1] = 2 * n + 4;
+ adjVertexIndex[2] = 2 * n + 6;
+ vertexIndex[0] = 2 * n + 3;
+ vertexIndex[1] = 2 * n + 1;
+ vertexIndex[2] = 2 * n + 5;
+ }
+ else
+ {
+ adjVertexIndex[0] = 2 * n + 4;
+ adjVertexIndex[1] = 2 * n + 6;
+ adjVertexIndex[2] = 2 * n - 1;
+ vertexIndex[0] = 2 * n + 1;
+ vertexIndex[1] = 2 * n + 5;
+ vertexIndex[2] = 2 * n + 3;
+ }
+ }
}
else
{
- /* middle (i odd) */
- adjVertexIndex[0] = 2 * n - 1;
- adjVertexIndex[1] = 2 * n + 4;
- adjVertexIndex[2] = 2 * n + 7;
- vertexIndex[0] = 2 * n + 3;
- vertexIndex[1] = 2 * n + 1;
- vertexIndex[2] = 2 * n + 5;
+ if (n % 2 == 0)
+ {
+ /* middle (i even) */
+ adjVertexIndex[0] = 2 * n - 1;
+ adjVertexIndex[1] = 2 * n + 7;
+ adjVertexIndex[2] = 2 * n + 4;
+ vertexIndex[0] = 2 * n + 1;
+ vertexIndex[1] = 2 * n + 3;
+ vertexIndex[2] = 2 * n + 5;
+ }
+ else
+ {
+ /* middle (i odd) */
+ if (j == 0)
+ {
+ adjVertexIndex[0] = 2 * n - 1;
+ adjVertexIndex[1] = 2 * n + 4;
+ adjVertexIndex[2] = 2 * n + 7;
+ vertexIndex[0] = 2 * n + 3;
+ vertexIndex[1] = 2 * n + 1;
+ vertexIndex[2] = 2 * n + 5;
+ }
+ else
+ {
+ adjVertexIndex[0] = 2 * n + 4;
+ adjVertexIndex[1] = 2 * n + 7;
+ adjVertexIndex[2] = 2 * n - 1;
+ vertexIndex[0] = 2 * n + 1;
+ vertexIndex[1] = 2 * n + 5;
+ vertexIndex[2] = 2 * n + 3;
+ }
+ }
}
- }
-
- /* Spec assumes vertices are indexed from 1 */
- vertexIndex[0]--;
- vertexIndex[1]--;
- vertexIndex[2]--;
- adjVertexIndex[0]--;
- adjVertexIndex[1]--;
- adjVertexIndex[2]--;
- *travellerExpectedAdjacencyGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[0]]].x;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[0]]].y;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 0;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 1;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[1]]].x;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[1]]].y;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 0;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 1;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[2]]].x;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[2]]].y;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 0;
- ++travellerExpectedAdjacencyGeometryPtr;
- *travellerExpectedAdjacencyGeometryPtr = 1;
- ++travellerExpectedAdjacencyGeometryPtr;
-
- *travellerExpectedGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[0]]].x;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[0]]].y;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 0;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 1;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[1]]].x;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[1]]].y;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 0;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 1;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[2]]].x;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr =
- test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[2]]].y;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 0;
- ++travellerExpectedGeometryPtr;
- *travellerExpectedGeometryPtr = 1;
- ++travellerExpectedGeometryPtr;
- } /* for (all triangles) */
+ /* Spec assumes vertices are indexed from 1 */
+ vertexIndex[0]--;
+ vertexIndex[1]--;
+ vertexIndex[2]--;
+ adjVertexIndex[0]--;
+ adjVertexIndex[1]--;
+ adjVertexIndex[2]--;
+
+ *travellerExpectedAdjacencyGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[0]]].x;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[0]]].y;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 0;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 1;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[1]]].x;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[1]]].y;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 0;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 1;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[2]]].x;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[adjVertexIndex[2]]].y;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 0;
+ ++travellerExpectedAdjacencyGeometryPtr;
+ *travellerExpectedAdjacencyGeometryPtr = 1;
+ ++travellerExpectedAdjacencyGeometryPtr;
+
+ *travellerExpectedGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[0]]].x;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[0]]].y;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 0;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 1;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[1]]].x;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[1]]].y;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 0;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 1;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[2]]].x;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr =
+ test_data.m_grid->m_triangle_strip.m_points[test_data.m_index_data[vertexIndex[2]]].y;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 0;
+ ++travellerExpectedGeometryPtr;
+ *travellerExpectedGeometryPtr = 1;
+ ++travellerExpectedGeometryPtr;
+ } /* for (all triangles) */
+ }
}
}