Skip to content

Editor GPU: Avoid invalidating lines and clearing render data when we can avoid it #234433

Open
@Tyriar

Description

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;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

editor-gpuEditor GPU rendering related issuesperfplan-itemVS Code - planned item for upcoming

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions