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

Method getBitRatio

src/backend/kernel.js:779–801  ·  view source on GitHub ↗

* bit storage ratio of source to target 'buffer', i.e. if 8bit array -> 32bit tex = 4 * @param value * @returns {number}

(value)

Source from the content-addressed store, hash-verified

777 * @returns {number}
778 */
779 getBitRatio(value) {
780 if (this.precision === 'single') {
781 // 8 and 16 are up-converted to float32
782 return 4;
783 } else if (Array.isArray(value[0])) {
784 return this.getBitRatio(value[0]);
785 } else if (value.constructor === Input) {
786 return this.getBitRatio(value.value);
787 }
788 switch (value.constructor) {
789 case Uint8ClampedArray:
790 case Uint8Array:
791 case Int8Array:
792 return 1;
793 case Uint16Array:
794 case Int16Array:
795 return 2;
796 case Float32Array:
797 case Int32Array:
798 default:
799 return 4;
800 }
801 }
802
803 /**
804 * @param {Boolean} [flip]

Callers 2

setupArgumentsMethod · 0.95
setupConstantsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected