Skip to content

Commit f07fa19

Browse files
committed
Log instead of throw on attmept to upload unsupported page count
Fixes microsoft#232979
1 parent 4a35ffa commit f07fa19

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/vs/editor/browser/gpu/atlas/textureAtlasPage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ export class TextureAtlasPage extends Disposable implements IReadableTextureAtla
8383

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

src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ export class ViewLinesGpu extends ViewPart implements IViewLines {
176176
this._renderStrategy = this._register(this._instantiationService.createInstance(FullFileRenderStrategy, this._context, this._device, this.canvas, atlas));
177177

178178
this._glyphStorageBuffer[0] = this._register(GPULifecycle.createBuffer(this._device, {
179-
label: 'Monaco glyph storage buffer',
179+
label: 'Monaco glyph storage buffer [0]',
180180
size: GlyphStorageBufferInfo.BytesPerEntry * TextureAtlasPage.maximumGlyphCount,
181181
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
182182
})).object;
183183
this._glyphStorageBuffer[1] = this._register(GPULifecycle.createBuffer(this._device, {
184-
label: 'Monaco glyph storage buffer',
184+
label: 'Monaco glyph storage buffer [1]',
185185
size: GlyphStorageBufferInfo.BytesPerEntry * TextureAtlasPage.maximumGlyphCount,
186186
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
187187
})).object;
@@ -289,6 +289,12 @@ export class ViewLinesGpu extends ViewPart implements IViewLines {
289289

290290
private _updateAtlasStorageBufferAndTexture() {
291291
for (const [layerIndex, page] of ViewGpuContext.atlas.pages.entries()) {
292+
if (layerIndex >= 2) {
293+
// TODO: Support arbitrary number of layers
294+
console.log(`Attempt to upload atlas page [${layerIndex}], only 2 are supported currently`);
295+
continue;
296+
}
297+
292298
// Skip the update if it's already the latest version
293299
if (page.version === this._atlasGpuTextureVersions[layerIndex]) {
294300
continue;

0 commit comments

Comments
 (0)