Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor GPU: Consider changing the strategy for allocating glyphs into slabs #227116

Open
Tyriar opened this issue Aug 29, 2024 · 0 comments
Open
Assignees
Labels
editor-gpu Editor GPU rendering related issues perf plan-item VS Code - planned item for upcoming
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Aug 29, 2024

Slabs right now are reserved for glyphs of the exact width and height of the slab. This could be wasteful and will likely just be more so as the device pixel ratio increases. We should consider using a different strategy as called out here:

// TODO: Include font size as well as DPR in nearestXPixels calculation
// Round slab glyph dimensions to the nearest x pixels, where x scaled with device pixel ratio
// const nearestXPixels = Math.max(1, Math.floor(dpr / 0.5));
// const nearestXPixels = Math.max(1, Math.floor(dpr));
const desiredSlabSize = {
// Nearest square number
// TODO: This can probably be optimized
// w: 1 << Math.ceil(Math.sqrt(glyphWidth)),
// h: 1 << Math.ceil(Math.sqrt(glyphHeight)),
// Nearest x px
// w: Math.ceil(glyphWidth / nearestXPixels) * nearestXPixels,
// h: Math.ceil(glyphHeight / nearestXPixels) * nearestXPixels,
// Round odd numbers up
// w: glyphWidth % 0 === 1 ? glyphWidth + 1 : glyphWidth,
// h: glyphHeight % 0 === 1 ? glyphHeight + 1 : glyphHeight,
// Exact number only
w: glyphWidth,
h: glyphHeight,
};

@Tyriar Tyriar added this to the October 2024 milestone Aug 29, 2024
@Tyriar Tyriar self-assigned this Aug 29, 2024
@Tyriar Tyriar added plan-item VS Code - planned item for upcoming editor-gpu Editor GPU rendering related issues perf labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-gpu Editor GPU rendering related issues perf plan-item VS Code - planned item for upcoming
Projects
Status: No status
Development

No branches or pull requests

1 participant