From: Chris Duncan Date: Wed, 18 Dec 2024 22:47:00 +0000 (-0800) Subject: Single-pixel rendering idea hurt performance, so scrap the setup for it and just... X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=b522c89090da75080487e3b7e7ad22672debd1ae;p=libnemo.git Single-pixel rendering idea hurt performance, so scrap the setup for it and just render to the default framebuffer. --- diff --git a/src/lib/workers/pow.ts b/src/lib/workers/pow.ts index d3c34c1..fee4e81 100644 --- a/src/lib/workers/pow.ts +++ b/src/lib/workers/pow.ts @@ -225,8 +225,6 @@ void main() { static #fragmentShader: WebGLShader | null static #positionBuffer: WebGLBuffer | null static #uvBuffer: WebGLBuffer | null - static #frameBuffer: WebGLFramebuffer | null - static #renderBuffer: WebGLRenderbuffer | null static #query: WebGLQuery | null static #pixels: Uint8Array // Vertex Positions, 2 triangles @@ -285,22 +283,8 @@ void main() { this.#gl.vertexAttribPointer(1, 2, this.#gl.FLOAT, false, 0, 0) this.#gl.enableVertexAttribArray(1) - this.#frameBuffer = this.#gl.createFramebuffer() - this.#gl.bindFramebuffer(this.#gl.FRAMEBUFFER, this.#frameBuffer) - this.#renderBuffer = this.#gl.createRenderbuffer() - this.#gl.bindRenderbuffer(this.#gl.RENDERBUFFER, this.#renderBuffer) - this.#gl.renderbufferStorage(this.#gl.RENDERBUFFER, this.#gl.RGBA8, this.#gl.drawingBufferWidth, this.#gl.drawingBufferHeight) - this.#gl.framebufferRenderbuffer(this.#gl.FRAMEBUFFER, this.#gl.COLOR_ATTACHMENT0, this.#gl.RENDERBUFFER, this.#renderBuffer) - if (this.#gl.checkFramebufferStatus(this.#gl.FRAMEBUFFER) !== this.#gl.FRAMEBUFFER_COMPLETE) { - throw new Error('Framebuffer is not complete') - } - // this.#gl.viewport(0, 0, 1, 1) - // this.#pixels = new Uint8Array(4) this.#pixels = new Uint8Array(this.#gl.drawingBufferWidth * this.#gl.drawingBufferHeight * 4) this.#query = this.#gl.createQuery() - if (this.#query == null) { - throw new Error('Failed to create query') - } this.#work0Location = this.#gl.getUniformLocation(this.#program, 'u_work0') this.#work1Location = this.#gl.getUniformLocation(this.#program, 'u_work1')