MCPcopy Index your code
hub / github.com/gpujs/gpu.js / pickRenderStrategy

Method pickRenderStrategy

src/backend/gl/kernel.js:368–649  ·  view source on GitHub ↗

* Picks a render strategy for the now finally parsed kernel * @param args * @return {null|KernelOutput}

(args)

Source from the content-addressed store, hash-verified

366 * @return {null|KernelOutput}
367 */
368 pickRenderStrategy(args) {
369 if (this.graphical) {
370 this.renderRawOutput = this.readPackedPixelsToUint8Array;
371 this.transferValues = (pixels) => pixels;
372 this.TextureConstructor = GLTextureGraphical;
373 return null;
374 }
375 if (this.precision === 'unsigned') {
376 this.renderRawOutput = this.readPackedPixelsToUint8Array;
377 this.transferValues = this.readPackedPixelsToFloat32Array;
378 if (this.pipeline) {
379 this.renderOutput = this.renderTexture;
380 if (this.subKernels !== null) {
381 this.renderKernels = this.renderKernelsToTextures;
382 }
383 switch (this.returnType) {
384 case 'LiteralInteger':
385 case 'Float':
386 case 'Number':
387 case 'Integer':
388 if (this.output[2] > 0) {
389 this.TextureConstructor = GLTextureUnsigned3D;
390 return null;
391 } else if (this.output[1] > 0) {
392 this.TextureConstructor = GLTextureUnsigned2D;
393 return null;
394 } else {
395 this.TextureConstructor = GLTextureUnsigned;
396 return null;
397 }
398 case 'Array(2)':
399 case 'Array(3)':
400 case 'Array(4)':
401 return this.requestFallback(args);
402 }
403 } else {
404 if (this.subKernels !== null) {
405 this.renderKernels = this.renderKernelsToArrays;
406 }
407 switch (this.returnType) {
408 case 'LiteralInteger':
409 case 'Float':
410 case 'Number':
411 case 'Integer':
412 this.renderOutput = this.renderValues;
413 if (this.output[2] > 0) {
414 this.TextureConstructor = GLTextureUnsigned3D;
415 this.formatValues = utils.erect3DPackedFloat;
416 return null;
417 } else if (this.output[1] > 0) {
418 this.TextureConstructor = GLTextureUnsigned2D;
419 this.formatValues = utils.erect2DPackedFloat;
420 return null;
421 } else {
422 this.TextureConstructor = GLTextureUnsigned;
423 this.formatValues = utils.erectPackedFloat;
424 return null;
425 }

Callers 1

buildMethod · 0.80

Calls 1

requestFallbackMethod · 0.80

Tested by

no test coverage detected