Skip to content

Commit 45feb8c

Browse files
committed
Allocator docs
1 parent b01a2da commit 45feb8c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/vs/editor/browser/view/gpu/atlas/textureAtlasAllocator.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export interface ITextureAtlasAllocator {
1717

1818
// #region Shelf allocator
1919

20+
/**
21+
* The shelf allocator is a simple allocator that places glyphs in rows, starting a new row when the
22+
* current row is full. Due to its simplicity, it can waste space but it is very fast.
23+
*/
2024
export class TextureAtlasShelfAllocator implements ITextureAtlasAllocator {
2125
private _currentRow: ITextureAtlasShelf = {
2226
x: 0,
@@ -139,6 +143,15 @@ interface ITextureAtlasShelf {
139143

140144
// #region Slab allocator
141145

146+
/**
147+
* The slab allocator is a more complex allocator that places glyphs in square slabs of a fixed
148+
* size. Slabs are defined by a small range of glyphs sizes they can house, this places like-sized
149+
* glyphs in the same slab which reduces wasted space.
150+
*
151+
* Slabs also may contain "unused" regions on the left and bottom depending on the size of the
152+
* glyphs they include. This space is used to place very thin or short glyphs, which would otherwise
153+
* waste a lot of space in their own slab.
154+
*/
142155
export class TextureAtlasSlabAllocator implements ITextureAtlasAllocator {
143156
// TODO: Is there a better way to index slabs other than an unsorted list?
144157
private _slabs: ITextureAtlasSlab[] = [];

0 commit comments

Comments
 (0)