@@ -265,18 +265,18 @@ class GPU {
265265 *
266266 * @param {IReason[] } reasons
267267 * @param {IArguments } args
268- * @param {Kernel } kernel
268+ * @param {Kernel } _kernel
269269 * @returns {* }
270270 */
271- function onRequestSwitchKernel ( reasons , args , kernel ) {
272- if ( kernel . debug ) {
271+ function onRequestSwitchKernel ( reasons , args , _kernel ) {
272+ if ( _kernel . debug ) {
273273 console . warn ( 'Switching kernels' ) ;
274274 }
275275 let newOutput = null ;
276- if ( kernel . signature && ! switchableKernels [ kernel . signature ] ) {
277- switchableKernels [ kernel . signature ] = kernel ;
276+ if ( _kernel . signature && ! switchableKernels [ _kernel . signature ] ) {
277+ switchableKernels [ _kernel . signature ] = _kernel ;
278278 }
279- if ( kernel . dynamicOutput ) {
279+ if ( _kernel . dynamicOutput ) {
280280 for ( let i = reasons . length - 1 ; i >= 0 ; i -- ) {
281281 const reason = reasons [ i ] ;
282282 if ( reason . type === 'outputPrecisionMismatch' ) {
@@ -285,42 +285,42 @@ class GPU {
285285 }
286286 }
287287
288- const Constructor = kernel . constructor ;
289- const argumentTypes = Constructor . getArgumentTypes ( kernel , args ) ;
290- const signature = Constructor . getSignature ( kernel , argumentTypes ) ;
288+ const Constructor = _kernel . constructor ;
289+ const argumentTypes = Constructor . getArgumentTypes ( _kernel , args ) ;
290+ const signature = Constructor . getSignature ( _kernel , argumentTypes ) ;
291291 const existingKernel = switchableKernels [ signature ] ;
292292 if ( existingKernel ) {
293293 return existingKernel ;
294294 }
295295
296296 const newKernel = switchableKernels [ signature ] = new Constructor ( source , {
297297 argumentTypes,
298- constantTypes : kernel . constantTypes ,
299- graphical : kernel . graphical ,
300- loopMaxIterations : kernel . loopMaxIterations ,
301- constants : kernel . constants ,
302- dynamicOutput : kernel . dynamicOutput ,
303- dynamicArgument : kernel . dynamicArguments ,
304- context : kernel . context ,
305- canvas : kernel . canvas ,
306- output : newOutput || kernel . output ,
307- precision : kernel . precision ,
308- pipeline : kernel . pipeline ,
309- immutable : kernel . immutable ,
310- optimizeFloatMemory : kernel . optimizeFloatMemory ,
311- fixIntegerDivisionAccuracy : kernel . fixIntegerDivisionAccuracy ,
312- functions : kernel . functions ,
313- nativeFunctions : kernel . nativeFunctions ,
314- injectedNative : kernel . injectedNative ,
315- subKernels : kernel . subKernels ,
316- strictIntegers : kernel . strictIntegers ,
317- debug : kernel . debug ,
318- gpu : kernel . gpu ,
298+ constantTypes : _kernel . constantTypes ,
299+ graphical : _kernel . graphical ,
300+ loopMaxIterations : _kernel . loopMaxIterations ,
301+ constants : _kernel . constants ,
302+ dynamicOutput : _kernel . dynamicOutput ,
303+ dynamicArgument : _kernel . dynamicArguments ,
304+ context : _kernel . context ,
305+ canvas : _kernel . canvas ,
306+ output : newOutput || _kernel . output ,
307+ precision : _kernel . precision ,
308+ pipeline : _kernel . pipeline ,
309+ immutable : _kernel . immutable ,
310+ optimizeFloatMemory : _kernel . optimizeFloatMemory ,
311+ fixIntegerDivisionAccuracy : _kernel . fixIntegerDivisionAccuracy ,
312+ functions : _kernel . functions ,
313+ nativeFunctions : _kernel . nativeFunctions ,
314+ injectedNative : _kernel . injectedNative ,
315+ subKernels : _kernel . subKernels ,
316+ strictIntegers : _kernel . strictIntegers ,
317+ debug : _kernel . debug ,
318+ gpu : _kernel . gpu ,
319319 validate,
320- returnType : kernel . returnType ,
321- onIstanbulCoverageVariable : kernel . onIstanbulCoverageVariable ,
322- removeIstanbulCoverage : kernel . removeIstanbulCoverage ,
323- tactic : kernel . tactic ,
320+ returnType : _kernel . returnType ,
321+ onIstanbulCoverageVariable : _kernel . onIstanbulCoverageVariable ,
322+ removeIstanbulCoverage : _kernel . removeIstanbulCoverage ,
323+ tactic : _kernel . tactic ,
324324 onRequestFallback,
325325 onRequestSwitchKernel,
326326 } ) ;
@@ -342,19 +342,20 @@ class GPU {
342342 onRequestSwitchKernel
343343 } , settingsCopy ) ;
344344
345- const kernelRun = kernelRunShortcut ( new this . Kernel ( source , mergedSettings ) ) ;
345+ const kernel = new this . Kernel ( source , mergedSettings ) ;
346+ const kernelRun = kernelRunShortcut ( kernel ) ;
346347
347348 //if canvas didn't come from this, propagate from kernel
348349 if ( ! this . canvas ) {
349- this . canvas = kernelRun . canvas ;
350+ this . canvas = kernel . canvas ;
350351 }
351352
352353 //if context didn't come from this, propagate from kernel
353354 if ( ! this . context ) {
354- this . context = kernelRun . context ;
355+ this . context = kernel . context ;
355356 }
356357
357- this . kernels . push ( kernelRun ) ;
358+ this . kernels . push ( kernel ) ;
358359
359360 return kernelRun ;
360361 }
0 commit comments