@@ -529,6 +529,7 @@ class WebGLKernel extends GLKernel {
529529 this . framebuffer = gl . createFramebuffer ( ) ;
530530 this . framebuffer . width = texSize [ 0 ] ;
531531 this . framebuffer . height = texSize [ 1 ] ;
532+ this . rawValueFramebuffers = { } ;
532533
533534 const vertices = new Float32Array ( [ - 1 , - 1 ,
534535 1 , - 1 , - 1 , 1 ,
@@ -1131,6 +1132,19 @@ float integerCorrectionModulo(float number, float divisor) {
11311132 return result . join ( '' ) ;
11321133 }
11331134
1135+ getRawValueFramebuffer ( width , height ) {
1136+ if ( ! this . rawValueFramebuffers [ width ] ) {
1137+ this . rawValueFramebuffers [ width ] = { } ;
1138+ }
1139+ if ( ! this . rawValueFramebuffers [ width ] [ height ] ) {
1140+ const framebuffer = this . context . createFramebuffer ( ) ;
1141+ framebuffer . width = width ;
1142+ framebuffer . height = height ;
1143+ this . rawValueFramebuffers [ width ] [ height ] = framebuffer ;
1144+ }
1145+ return this . rawValueFramebuffers [ width ] [ height ] ;
1146+ }
1147+
11341148 getKernelResultDeclaration ( ) {
11351149 switch ( this . returnType ) {
11361150 case 'Array(2)' :
@@ -1491,6 +1505,13 @@ float integerCorrectionModulo(float number, float divisor) {
14911505 if ( this . framebuffer ) {
14921506 this . context . deleteFramebuffer ( this . framebuffer ) ;
14931507 }
1508+ for ( const width in this . rawValueFramebuffers ) {
1509+ for ( const height in this . rawValueFramebuffers [ width ] ) {
1510+ this . context . deleteFramebuffer ( this . rawValueFramebuffers [ width ] [ height ] ) ;
1511+ delete this . rawValueFramebuffers [ width ] [ height ] ;
1512+ }
1513+ delete this . rawValueFramebuffers [ width ] ;
1514+ }
14941515 if ( this . vertShader ) {
14951516 this . context . deleteShader ( this . vertShader ) ;
14961517 }
@@ -1576,4 +1597,4 @@ float integerCorrectionModulo(float number, float divisor) {
15761597
15771598module . exports = {
15781599 WebGLKernel
1579- } ;
1600+ } ;
0 commit comments