From f757c965ee0abd33dbc9577ef60a52748f3bdfd9 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 27 May 2026 15:38:58 +0000 Subject: [PATCH] fix(addon-webgl): keep VAO WebGL types non-nullable Co-authored-by: Daniel Imms --- addons/addon-webgl/src/GlyphRenderer.ts | 6 +++--- addons/addon-webgl/src/RectangleRenderer.ts | 6 +++--- addons/addon-webgl/src/Types.ts | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/addon-webgl/src/GlyphRenderer.ts b/addons/addon-webgl/src/GlyphRenderer.ts index 7a7e98496..cfa156037 100644 --- a/addons/addon-webgl/src/GlyphRenderer.ts +++ b/addons/addon-webgl/src/GlyphRenderer.ts @@ -136,9 +136,9 @@ export class GlyphRenderer extends Disposable { this._textureLocation = throwIfFalsy(gl.getUniformLocation(this._program, 'u_texture')); // Create and set the vertex array object - this._vertexArrayObject = gl.createVertexArray(); - this._register(toDisposable(() => gl.deleteVertexArray(this._vertexArrayObject))); - gl.bindVertexArray(this._vertexArrayObject); + const vertexArrayObject = this._vertexArrayObject = gl.createVertexArray(); + this._register(toDisposable(() => gl.deleteVertexArray(vertexArrayObject))); + gl.bindVertexArray(vertexArrayObject); // Setup a_unitquad, this defines the 4 vertices of a rectangle const unitQuadVertices = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]); diff --git a/addons/addon-webgl/src/RectangleRenderer.ts b/addons/addon-webgl/src/RectangleRenderer.ts index b2225de3a..55926ed14 100644 --- a/addons/addon-webgl/src/RectangleRenderer.ts +++ b/addons/addon-webgl/src/RectangleRenderer.ts @@ -102,9 +102,9 @@ export class RectangleRenderer extends Disposable { this._projectionLocation = throwIfFalsy(gl.getUniformLocation(this._program, 'u_projection')); // Create and set the vertex array object - this._vertexArrayObject = gl.createVertexArray(); - this._register(toDisposable(() => gl.deleteVertexArray(this._vertexArrayObject))); - gl.bindVertexArray(this._vertexArrayObject); + const vertexArrayObject = this._vertexArrayObject = gl.createVertexArray(); + this._register(toDisposable(() => gl.deleteVertexArray(vertexArrayObject))); + gl.bindVertexArray(vertexArrayObject); // Setup a_unitquad, this defines the 4 vertices of a rectangle const unitQuadVertices = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]); diff --git a/addons/addon-webgl/src/Types.ts b/addons/addon-webgl/src/Types.ts index b3c51e842..294582e37 100644 --- a/addons/addon-webgl/src/Types.ts +++ b/addons/addon-webgl/src/Types.ts @@ -28,8 +28,8 @@ export interface ICursorRenderModel { export interface IWebGL2RenderingContext extends WebGLRenderingContext { vertexAttribDivisor(index: number, divisor: number): void; createVertexArray(): IWebGLVertexArrayObject; - deleteVertexArray(vao: IWebGLVertexArrayObject | null): void; - bindVertexArray(vao: IWebGLVertexArrayObject | null): void; + deleteVertexArray(vao: IWebGLVertexArrayObject): void; + bindVertexArray(vao: IWebGLVertexArrayObject): void; drawElementsInstanced(mode: number, count: number, type: number, offset: number, instanceCount: number): void; }