Skip to content

Commit

Permalink
Merge pull request microsoft#232986 from microsoft/tyriar/232979
Browse files Browse the repository at this point in the history
Log instead of throw on attmept to upload unsupported page count
  • Loading branch information
Tyriar authored Nov 4, 2024
2 parents e43f207 + f07fa19 commit bcbb5ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/vs/editor/browser/gpu/atlas/textureAtlasPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export class TextureAtlasPage extends Disposable implements IReadableTextureAtla

// Ensure the glyph was allocated
if (glyph === undefined) {
// TODO: undefined here can mean the glyph was too large for a slab on the page, this
// can lead to big problems if we don't handle it properly https://github.com/microsoft/vscode/issues/232984
return undefined;
}

Expand Down
10 changes: 8 additions & 2 deletions src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ export class ViewLinesGpu extends ViewPart implements IViewLines {
this._renderStrategy = this._register(this._instantiationService.createInstance(FullFileRenderStrategy, this._context, this._device, this.canvas, atlas));

this._glyphStorageBuffer[0] = this._register(GPULifecycle.createBuffer(this._device, {
label: 'Monaco glyph storage buffer',
label: 'Monaco glyph storage buffer [0]',
size: GlyphStorageBufferInfo.BytesPerEntry * TextureAtlasPage.maximumGlyphCount,
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
})).object;
this._glyphStorageBuffer[1] = this._register(GPULifecycle.createBuffer(this._device, {
label: 'Monaco glyph storage buffer',
label: 'Monaco glyph storage buffer [1]',
size: GlyphStorageBufferInfo.BytesPerEntry * TextureAtlasPage.maximumGlyphCount,
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
})).object;
Expand Down Expand Up @@ -300,6 +300,12 @@ export class ViewLinesGpu extends ViewPart implements IViewLines {

private _updateAtlasStorageBufferAndTexture() {
for (const [layerIndex, page] of ViewGpuContext.atlas.pages.entries()) {
if (layerIndex >= 2) {
// TODO: Support arbitrary number of layers
console.log(`Attempt to upload atlas page [${layerIndex}], only 2 are supported currently`);
continue;
}

// Skip the update if it's already the latest version
if (page.version === this._atlasGpuTextureVersions[layerIndex]) {
continue;
Expand Down

0 comments on commit bcbb5ea

Please sign in to comment.