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: Avoid invalidating lines and clearing render data when we can avoid it #234433

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

Comments

@Tyriar
Copy link
Member

Tyriar commented Nov 22, 2024

Currently the up to date line cache and render buffer is cleared more aggressively than should be necessary:

public override onDecorationsChanged(e: ViewDecorationsChangedEvent): boolean {
// TODO: Don't clear all cells if we can avoid it
this._invalidateAllLines();
return true;
}
public override onTokensChanged(e: ViewTokensChangedEvent): boolean {
// TODO: This currently fires for the entire viewport whenever scrolling stops
// https://github.com/microsoft/vscode/issues/233942
for (const range of e.ranges) {
for (let i = range.fromLineNumber; i <= range.toLineNumber; i++) {
this._upToDateLines[0].delete(i);
this._upToDateLines[1].delete(i);
}
}
return true;
}
public override onLinesDeleted(e: ViewLinesDeletedEvent): boolean {
// TODO: This currently invalidates everything after the deleted line, it could shift the
// line data up to retain some up to date lines
// TODO: This does not invalidate lines that are no longer in the file
this._invalidateLinesFrom(e.fromLineNumber);
// Queue updates that need to happen on the active buffer, not just the cache. This is
// deferred since the active buffer could be locked by the GPU which would block the main
// thread.
this._queueBufferUpdate(e);
return true;
}
public override onLinesInserted(e: ViewLinesInsertedEvent): boolean {
// TODO: This currently invalidates everything after the deleted line, it could shift the
// line data up to retain some up to date lines
this._invalidateLinesFrom(e.fromLineNumber);
return true;
}

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 plan-item VS Code - planned item for upcoming
Projects
Status: No status
Development

No branches or pull requests

1 participant