MCPcopy Create free account
hub / github.com/gpujs/gpu.js / _processConstants

Method _processConstants

src/backend/cpu/kernel.js:261–284  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

259 }
260
261 _processConstants() {
262 if (!this.constants) return '';
263
264 const result = [];
265 for (let p in this.constants) {
266 const type = this.constantTypes[p];
267 switch (type) {
268 case 'HTMLCanvas':
269 case 'HTMLImage':
270 case 'HTMLVideo':
271 result.push(` const constants_${p} = this._mediaTo2DArray(this.constants.${p});\n`);
272 break;
273 case 'HTMLImageArray':
274 result.push(` const constants_${p} = this._imageTo3DArray(this.constants.${p});\n`);
275 break;
276 case 'Input':
277 result.push(` const constants_${p} = this.constants.${p}.value;\n`);
278 break;
279 default:
280 result.push(` const constants_${p} = this.constants.${p};\n`);
281 }
282 }
283 return result.join('');
284 }
285
286 _earlyThrows() {
287 if (this.graphical) return '';

Callers 1

getKernelStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected