@@ -75,6 +75,7 @@ export class GPGPUContext {
75
75
this . vertexBuffer = gpgpu_util . createVertexBuffer ( this . gl ) ;
76
76
this . indexBuffer = gpgpu_util . createIndexBuffer ( this . gl ) ;
77
77
this . framebuffer = webgl_util . createFramebuffer ( this . gl ) ;
78
+ webgl_util . bindFramebuffer ( this . gl , this . framebuffer ) ;
78
79
79
80
this . textureConfig =
80
81
gpgpu_util . getTextureConfig ( this . gl , this . textureHalfFloatExtension ) ;
@@ -99,7 +100,7 @@ export class GPGPUContext {
99
100
}
100
101
const gl = this . gl ;
101
102
webgl_util . callAndCheck ( gl , ( ) => gl . finish ( ) ) ;
102
- webgl_util . callAndCheck ( gl , ( ) => gl . bindFramebuffer ( gl . FRAMEBUFFER , null ) ) ;
103
+ webgl_util . bindFramebuffer ( gl , null ) ;
103
104
webgl_util . callAndCheck ( gl , ( ) => gl . deleteFramebuffer ( this . framebuffer ) ) ;
104
105
webgl_util . callAndCheck ( gl , ( ) => gl . bindBuffer ( gl . ARRAY_BUFFER , null ) ) ;
105
106
webgl_util . callAndCheck (
@@ -158,7 +159,6 @@ export class GPGPUContext {
158
159
public deleteMatrixTexture ( texture : WebGLTexture ) {
159
160
this . throwIfDisposed ( ) ;
160
161
if ( this . outputTexture === texture ) {
161
- webgl_util . unbindColorTextureFromFramebuffer ( this . gl , this . framebuffer ) ;
162
162
this . outputTexture = null ;
163
163
}
164
164
webgl_util . callAndCheck ( this . gl , ( ) => this . gl . deleteTexture ( texture ) ) ;
@@ -282,9 +282,6 @@ export class GPGPUContext {
282
282
webgl_util . callAndCheck ( gl , ( ) => gl . attachShader ( program , vertexShader ) ) ;
283
283
webgl_util . callAndCheck ( gl , ( ) => gl . attachShader ( program , fragmentShader ) ) ;
284
284
webgl_util . linkProgram ( gl , program ) ;
285
- if ( this . autoDebugValidate ) {
286
- webgl_util . validateProgram ( gl , program ) ;
287
- }
288
285
if ( ! this . vertexAttrsAreBound ) {
289
286
this . setProgram ( program ) ;
290
287
this . vertexAttrsAreBound = gpgpu_util . bindVertexProgramAttributeStreams (
@@ -306,9 +303,6 @@ export class GPGPUContext {
306
303
public setProgram ( program : WebGLProgram | null ) {
307
304
this . throwIfDisposed ( ) ;
308
305
this . program = program ;
309
- if ( ( this . program != null ) && this . autoDebugValidate ) {
310
- webgl_util . validateProgram ( this . gl , this . program ) ;
311
- }
312
306
webgl_util . callAndCheck ( this . gl , ( ) => this . gl . useProgram ( program ) ) ;
313
307
}
314
308
@@ -373,19 +367,13 @@ export class GPGPUContext {
373
367
throw new Error ( 'setOutputPackedMatrixWriteRegion not implemented.' ) ;
374
368
}
375
369
376
- public debugValidate ( ) {
377
- if ( this . program != null ) {
378
- webgl_util . validateProgram ( this . gl , this . program ) ;
379
- }
380
- webgl_util . validateFramebuffer ( this . gl ) ;
381
- }
382
-
383
370
public executeProgram ( ) {
384
371
this . throwIfDisposed ( ) ;
385
372
this . throwIfNoProgram ( ) ;
386
373
const gl = this . gl ;
387
374
if ( this . autoDebugValidate ) {
388
- this . debugValidate ( ) ;
375
+ webgl_util . validateProgram ( this . gl , this . program ) ;
376
+ webgl_util . validateFramebuffer ( this . gl ) ;
389
377
}
390
378
webgl_util . callAndCheck (
391
379
gl , ( ) => gl . drawElements ( gl . TRIANGLES , 6 , gl . UNSIGNED_SHORT , 0 ) ) ;
@@ -543,8 +531,7 @@ export class GPGPUContext {
543
531
544
532
private bindTextureToFrameBuffer ( texture : WebGLTexture ) {
545
533
this . throwIfDisposed ( ) ;
546
- webgl_util . bindColorTextureToFramebuffer (
547
- this . gl , texture , this . framebuffer ) ;
534
+ webgl_util . bindColorTextureToFramebuffer ( this . gl , texture ) ;
548
535
if ( this . autoDebugValidate ) {
549
536
webgl_util . validateFramebuffer ( this . gl ) ;
550
537
}
0 commit comments