]> zoso.dev Git - libnemo.git/commitdiff
Single-pixel rendering idea hurt performance, so scrap the setup for it and just...
authorChris Duncan <chris@zoso.dev>
Wed, 18 Dec 2024 22:47:00 +0000 (14:47 -0800)
committerChris Duncan <chris@zoso.dev>
Wed, 18 Dec 2024 22:47:00 +0000 (14:47 -0800)
src/lib/workers/pow.ts

index d3c34c1e80ca887cd2272c7e369899f6ca1541f7..fee4e81d5b0a0d01d6fc0f72b41c7f2c95bda03a 100644 (file)
@@ -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')