Skip to content

Commit

Permalink
Fix u16 max vertex count value
Browse files Browse the repository at this point in the history
  • Loading branch information
xCollateral committed Jul 22, 2024
1 parent 5b84125 commit 32a80ec
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class AutoIndexBuffer {
public static final int U16_MAX_INDEX_COUNT = 65536;
public static final int QUAD_U16_MAX_VERTEX_COUNT = U16_MAX_INDEX_COUNT * 2 / 3;
public static final int QUAD_U16_MAX_VERTEX_COUNT = U16_MAX_INDEX_COUNT * 3 / 2;

int vertexCount;
DrawType drawType;
Expand All @@ -29,7 +29,7 @@ private void createIndexBuffer(int vertexCount) {

switch (this.drawType) {
case QUADS -> {
if (vertexCount < QUAD_U16_MAX_VERTEX_COUNT)
if (vertexCount <= QUAD_U16_MAX_VERTEX_COUNT)
buffer = genQuadIndices(vertexCount);
else {
indexType = IndexBuffer.IndexType.INT;
Expand Down

0 comments on commit 32a80ec

Please sign in to comment.