From f07fa196707f7128637f3d0eb4f7bc3844dd1d4f Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 4 Nov 2024 07:09:27 -0800 Subject: [PATCH] Log instead of throw on attmept to upload unsupported page count Fixes #232979 --- src/vs/editor/browser/gpu/atlas/textureAtlasPage.ts | 2 ++ .../browser/viewParts/viewLinesGpu/viewLinesGpu.ts | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/browser/gpu/atlas/textureAtlasPage.ts b/src/vs/editor/browser/gpu/atlas/textureAtlasPage.ts index 8c0d35ee85e75..01edf66913051 100644 --- a/src/vs/editor/browser/gpu/atlas/textureAtlasPage.ts +++ b/src/vs/editor/browser/gpu/atlas/textureAtlasPage.ts @@ -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; } diff --git a/src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts b/src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts index 693bfc1f5da72..4b73b95d23282 100644 --- a/src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts +++ b/src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts @@ -176,12 +176,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; @@ -289,6 +289,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;