@@ -3352,33 +3352,34 @@ void CMeshDX8::CheckIndices( CPrimList *pPrim, int numPrimitives )
3352
3352
{
3353
3353
Assert ( pPrim->m_FirstIndex >= 0 && pPrim->m_FirstIndex < g_pLastIndex->IndexCount () );
3354
3354
3355
- const int maxVertexIdx = ( int )( s_FirstVertex + m_FirstIndex ) ;
3355
+ const unsigned maxVertexIdx = s_FirstVertex + m_FirstIndex;
3356
3356
3357
3357
{
3358
3358
CVertexBuffer* pMesh = g_pLastVertex;
3359
3359
3360
- Assert ( pMesh && maxVertexIdx < pMesh->VertexCount () );
3360
+ Assert ( pMesh && maxVertexIdx < ( unsigned ) pMesh->VertexCount () );
3361
3361
}
3362
3362
3363
+ if ( g_pLastColorMesh )
3363
3364
{
3364
- CVertexBuffer* pMesh = g_pLastColorMesh ? g_pLastColorMesh ->m_pVertexBuffer : NULL ;
3365
+ CVertexBuffer* pMesh = g_pLastColorMesh->m_pVertexBuffer ;
3365
3366
3366
- if ( pMesh )
3367
- {
3368
- Assert ( maxVertexIdx < pMesh->VertexCount () );
3369
- }
3367
+ Assert ( maxVertexIdx < (unsigned )pMesh->VertexCount () );
3370
3368
}
3371
3369
3372
- for (int j = 0 ; j < nIndexCount; j++)
3370
+ const int upperPrimIndexBound = nIndexCount + pPrim->m_FirstIndex ;
3371
+ const int upperShadowIndexBound = s_FirstVertex + s_NumVertices;
3372
+
3373
+ for (int j = pPrim->m_FirstIndex ; j < upperPrimIndexBound; j++)
3373
3374
{
3374
- const unsigned int index = g_pLastIndex->GetShadowIndex ( j + pPrim-> m_FirstIndex );
3375
+ const unsigned index = g_pLastIndex->GetShadowIndex ( j );
3375
3376
3376
- if (index >= s_FirstVertex && index < s_FirstVertex + s_NumVertices )
3377
+ if (index >= s_FirstVertex && index < upperShadowIndexBound )
3377
3378
{
3378
3379
continue ;
3379
3380
}
3380
3381
3381
- Warning (" %s invalid index: %d [%u..%u]\n " , __FUNCTION__, index, s_FirstVertex, s_FirstVertex + s_NumVertices - 1 );
3382
+ Warning (" %s invalid index: %u [%u..%u]\n " , __FUNCTION__, index, s_FirstVertex, upperShadowIndexBound - 1 );
3382
3383
3383
3384
Assert ( false );
3384
3385
}
@@ -3451,7 +3452,7 @@ void CMeshDX8::RenderPass()
3451
3452
3452
3453
numPrimitives );// Number of primitives to render. The number of vertices used is a function of the primitive count and the primitive type.
3453
3454
}
3454
- }
3455
+ }
3455
3456
}
3456
3457
}
3457
3458
0 commit comments