[canvas] fix canvas max tile queue count. Off-by-one was causing some paths to be culled in segment setup shader's bounds check

This commit is contained in:
martinfouilleul 2023-08-13 14:51:27 +02:00
parent 39010f5365
commit 72bb238d08
2 changed files with 16 additions and 4 deletions

View File

@ -373,8 +373,14 @@ void mg_gl_canvas_encode_path(mg_gl_canvas_backend* backend, mg_primitive* primi
path->textureID = -1;
}
int nTilesX = ((path->box.z - path->box.x)*scale - 1) / MG_GL_TILE_SIZE + 1;
int nTilesY = ((path->box.w - path->box.y)*scale - 1) / MG_GL_TILE_SIZE + 1;
int firstTileX = path->box.x*scale / MG_GL_TILE_SIZE;
int firstTileY = path->box.y*scale / MG_GL_TILE_SIZE;
int lastTileX = path->box.z*scale / MG_GL_TILE_SIZE;
int lastTileY = path->box.w*scale / MG_GL_TILE_SIZE;
int nTilesX = lastTileX - firstTileX + 1;
int nTilesY = lastTileY - firstTileY + 1;
backend->maxTileQueueCount += (nTilesX * nTilesY);
}

View File

@ -255,8 +255,14 @@ void mg_mtl_encode_path(mg_mtl_canvas_backend* backend, mg_primitive* primitive,
}
path->texture = backend->currentImageIndex;
int nTilesX = ((path->box.z - path->box.x)*scale - 1) / MG_MTL_TILE_SIZE + 1;
int nTilesY = ((path->box.w - path->box.y)*scale - 1) / MG_MTL_TILE_SIZE + 1;
int firstTileX = path->box.x*scale / MG_MTL_TILE_SIZE;
int firstTileY = path->box.y*scale / MG_MTL_TILE_SIZE;
int lastTileX = path->box.z*scale / MG_MTL_TILE_SIZE;
int lastTileY = path->box.w*scale / MG_MTL_TILE_SIZE;
int nTilesX = lastTileX - firstTileX + 1;
int nTilesY = lastTileY - firstTileY + 1;
backend->maxTileQueueCount += (nTilesX * nTilesY);
}