fix VertexManager::GetRemainingIndices
the old implementation returns the amound of primitives fit into index buffers but also gc needs more than one index per primitve
This commit is contained in:
parent
f3f89e1d00
commit
10983b0eae
|
@ -59,6 +59,9 @@ void VertexManager::PrepareForAdditionalData(int primitive, u32 count, u32 strid
|
||||||
if (needed_vertex_bytes > GetRemainingSize())
|
if (needed_vertex_bytes > GetRemainingSize())
|
||||||
ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all vertices! "
|
ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all vertices! "
|
||||||
"Increase MAXVBUFFERSIZE or we need primitive breaking afterall.");
|
"Increase MAXVBUFFERSIZE or we need primitive breaking afterall.");
|
||||||
|
if (count > GetRemainingIndices(primitive))
|
||||||
|
ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all indices! "
|
||||||
|
"Increase MAXIBUFFERSIZE or we need primitive breaking afterall.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,24 +75,24 @@ u32 VertexManager::GetRemainingIndices(int primitive)
|
||||||
switch (primitive)
|
switch (primitive)
|
||||||
{
|
{
|
||||||
case GX_DRAW_QUADS:
|
case GX_DRAW_QUADS:
|
||||||
|
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 6 * 4;
|
||||||
case GX_DRAW_TRIANGLES:
|
case GX_DRAW_TRIANGLES:
|
||||||
|
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen());
|
||||||
case GX_DRAW_TRIANGLE_STRIP:
|
case GX_DRAW_TRIANGLE_STRIP:
|
||||||
|
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 3 + 2;
|
||||||
case GX_DRAW_TRIANGLE_FAN:
|
case GX_DRAW_TRIANGLE_FAN:
|
||||||
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 3;
|
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 3 + 2;
|
||||||
break;
|
|
||||||
|
|
||||||
case GX_DRAW_LINES:
|
case GX_DRAW_LINES:
|
||||||
|
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen());
|
||||||
case GX_DRAW_LINE_STRIP:
|
case GX_DRAW_LINE_STRIP:
|
||||||
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen()) / 2;
|
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen()) / 2 + 1;
|
||||||
break;
|
|
||||||
|
|
||||||
case GX_DRAW_POINTS:
|
case GX_DRAW_POINTS:
|
||||||
return (MAXIBUFFERSIZE - IndexGenerator::GetPointindexLen());
|
return (MAXIBUFFERSIZE - IndexGenerator::GetPointindexLen());
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue