Skip to content

Commit bcbb5ea

Browse files
authored
Merge pull request microsoft#232986 from microsoft/tyriar/232979
Log instead of throw on attmept to upload unsupported page count
2 parents e43f207 + f07fa19 commit bcbb5ea

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
@@ -177,12 +177,12 @@ export class ViewLinesGpu extends ViewPart implements IViewLines {
177177
this._renderStrategy = this._register(this._instantiationService.createInstance(FullFileRenderStrategy, this._context, this._device, this.canvas, atlas));
178178

179179
this._glyphStorageBuffer[0] = this._register(GPULifecycle.createBuffer(this._device, {
180-
label: 'Monaco glyph storage buffer',
180+
label: 'Monaco glyph storage buffer [0]',
181181
size: GlyphStorageBufferInfo.BytesPerEntry * TextureAtlasPage.maximumGlyphCount,
182182
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
183183
})).object;
184184
this._glyphStorageBuffer[1] = this._register(GPULifecycle.createBuffer(this._device, {
185-
label: 'Monaco glyph storage buffer',
185+
label: 'Monaco glyph storage buffer [1]',
186186
size: GlyphStorageBufferInfo.BytesPerEntry * TextureAtlasPage.maximumGlyphCount,
187187
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
188188
})).object;
@@ -300,6 +300,12 @@ export class ViewLinesGpu extends ViewPart implements IViewLines {
300300

301301
private _updateAtlasStorageBufferAndTexture() {
302302
for (const [layerIndex, page] of ViewGpuContext.atlas.pages.entries()) {
303+
if (layerIndex >= 2) {
304+
// TODO: Support arbitrary number of layers
305+
console.log(`Attempt to upload atlas page [${layerIndex}], only 2 are supported currently`);
306+
continue;
307+
}
308+
303309
// Skip the update if it's already the latest version
304310
if (page.version === this._atlasGpuTextureVersions[layerIndex]) {
305311
continue;

0 commit comments

Comments
 (0)