Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/editor/browser/gpu/renderStrategy/baseRenderStrategy.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ViewEventHandler } from '../../../common/viewEventHandler.js';
7
import type { ViewportData } from '../../../common/viewLayout/viewLinesViewportData.js';
8
import type { ViewContext } from '../../../common/viewModel/viewContext.js';
9
import type { ViewLineOptions } from '../../viewParts/viewLines/viewLineOptions.js';
10
import type { IGpuRenderStrategy } from '../gpu.js';
11
import { GlyphRasterizer } from '../raster/glyphRasterizer.js';
12
import type { ViewGpuContext } from '../viewGpuContext.js';
13
14
export abstract class BaseRenderStrategy extends ViewEventHandler implements IGpuRenderStrategy {
15
16
get glyphRasterizer() { return this._glyphRasterizer.value; }
17
18
abstract type: string;
19
abstract wgsl: string;
20
abstract bindGroupEntries: GPUBindGroupEntry[];
21
22
constructor(
23
protected readonly _context: ViewContext,
24
protected readonly _viewGpuContext: ViewGpuContext,
25
protected readonly _device: GPUDevice,
26
protected readonly _glyphRasterizer: { value: GlyphRasterizer },
27
) {
28
super();
29
30
this._context.addEventHandler(this);
31
}
32
33
abstract reset(): void;
34
abstract update(viewportData: ViewportData, viewLineOptions: ViewLineOptions): number;
35
abstract draw(pass: GPURenderPassEncoder, viewportData: ViewportData): void;
36
}
37
38