<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Assertion fail with triangle strips"
href="https://bugs.freedesktop.org/show_bug.cgi?id=85419">85419</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Assertion fail with triangle strips
</td>
</tr>
<tr>
<th>Product</th>
<td>Mesa
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86 (IA32)
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>Other
</td>
</tr>
<tr>
<th>Assignee</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jrevans1@earthlink.net
</td>
</tr></table>
<p>
<div>
<pre>When using Mesa 10.3.0 and 10.3.1 I get an assertion fail in
'src/gallium/drivers/llvmpipe/lp_setup_tri.c:495'
I am rendering a sphere in software mode (great for debugging, with
MESA_DEBUG=1) using Gallium 0.4 on llvmpipe (LLVM 3.4) and 3.3 Core Profile.
Following is the code I am using to generate and render my sphere:
// m_numLon = 36;
// m_numLat = 18;
// m_radius = 0.5;
const unsigned int RESTART_INDEX = 0xFFFF;
glPrimitiveRestartIndex( RESTART_INDEX );
float deltaLon = TWOPI / m_numLon;
float deltaLat = PI / m_numLat;
float lonTexCoord, latTexCoord;
float r, x, y, z;
GlVec3 vertex, normal;
// The North-Pole
vertex = GlVec3( 0.0, 0.0, m_radius );
normal = vertex.normalized();
lonTexCoord = 0.0;
latTexCoord = 0.0;
m_vertices << vertex << normal << GlVec2( lonTexCoord, latTexCoord );
numVerts++;
// The sphere is composed of numLon triangle strips
for ( unsigned int lonNum = 0; lonNum < m_numLon; lonNum++ )
{
for ( unsigned int latNum = 1; latNum < m_numLat; latNum++ )
{
lonTexCoord = ((float) lonNum) / ((float) m_numLon);
latTexCoord = ((float) latNum) / ((float) m_numLat);
r = m_radius * ::sin( latNum * deltaLat );
z = m_radius * ::cos( latNum * deltaLat );
y = r * ::sin( lonNum * deltaLon );
x = r * ::cos( lonNum * deltaLon );
vertex = GlVec3( x, y, z );
normal = vertex.normalized();
m_vertices << vertex << normal << GlVec2( lonTexCoord, latTexCoord );
numVerts++;
}
}
// The South-Pole
vertex = GlVec3( 0.0, 0.0, -m_radius );
normal = vertex.normalized();
lonTexCoord = 1.0;
latTexCoord = 1.0;
m_vertices << vertex << normal << GlVec2( lonTexCoord, latTexCoord );
numVerts++;
// generate the indices
for ( unsigned int lonNum = 0; lonNum < m_numLon; lonNum++ )
{
// index to the north pole
m_indices << 0;
for ( unsigned int latNum = 1; latNum < m_numLat; latNum++ )
{
m_indices << latNum + lonNum*(m_numLat-1);
m_indices << latNum + ((lonNum+1) % m_numLon)*(m_numLat-1);
}
// index to the south pole
m_indices << numVerts - 1;
// signal the renderer that we are done with this primitive and it
// needs to start a new triangle strip.
m_indices << RESTART_INDEX;
}
// load vertex data
vbo.bind();
glBufferData( vbo, numVerts*sizeof(float), m_vertices.data(), GL_STATIC_DRAW );
// load index data
ibo.bind();
glBufferData(ibo, m_indices.count()*sizeof(unsigned int), m_indices.data(),
GL_STATIC_DRAW);
// render the data
...
vao.bind();
vbo.bind();
int offset = 0;
glVertexAttribPointer( vLoc, 3, GL_FLOAT, GL_TRUE, 8*sizeof(float),
reinterpret_cast<const void* >(offset) );
glEnableVertexAttribArray( vLoc );
glDrawElements( GL_TRIANGLE_STRIP, 0, numVerts );
Using the same vertices and different index ordering I can draw using
GL_LINE_STRIP and see that the generate vertices are indeed correct. Printing
out the indices shows that they are also correct.
If I revert to an older Mesa (such as 10.2.8) then I no longer get an assertion
error. Instead every other triangle strip is culled as though it were facing
the opposite direction (If I turn off culling, then the entire sphere is
rendered).</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>