New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gpu-ez

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gpu-ez - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

32

gpu-ez.js

@@ -15,3 +15,3 @@ const GpuEz = {};

GpuEz.returnTypeDims = Object.assign({}, ...Object.entries(GpuEz.returnTypes).map(([k, v]) => ({[v]: k})));
GpuEz.returnTypeDims = Object.assign({}, ...Object.entries(GpuEz.returnTypes).map(([k, v]) => ({[v]: +k})));

@@ -26,2 +26,7 @@ GpuEz.preKernelFuncs = {

GpuEz.getArgType = function getArgType(vec, dim) {
if (!dim) return vec > 1 ? `Array(${vec})` : 'Float';
return vec > 1 ? `Array${dim}D(${vec})` : 'Array'
}
GpuEz.getPreKernel = function getPreKernel(put, dim, type) {

@@ -43,3 +48,3 @@ const pre = GpuEz.preKernels;

pipeline: !!put, immutable: true, dynamicOutput: true, dynamicArguments: true,
returnType: type, argumentTypes: {arr: vec > 1 ? `Array${nDim}D(${vec})` : 'Array'}
returnType: type, argumentTypes: {arr: GpuEz.getArgType(vec, nDim)}
};

@@ -96,3 +101,4 @@

const argNames = argEnts.map(arg => arg[1]);
const argVecs = argEnts.map(arg => arg[2]);
const argVecs = argEnts.map(arg => arg[2] | 0);
const argDims = argEnts.map(arg => arg[3] | 0);
const argMacro = argEnts.map(GpuEz.argEntsMacro).join('');

@@ -102,2 +108,10 @@

const argumentTypes = {};
for (let i = 0; i < argEnts.length; i++) {
const vec = argVecs[i];
const nDim = argDims[i];
argumentTypes[argNames[i]] = GpuEz.getArgType(vec, nDim);
}
const kernelSettings = [

@@ -119,2 +133,3 @@ Function(

returnType: GpuEz.returnTypes[vec] || GpuEz.returnTypes[1],
argumentTypes,
debug: !!debug

@@ -132,8 +147,4 @@ }

for (let i = 0; i < args.length; i++) if (args[i] instanceof Array || args[i] instanceof Float32Array) {
temps.push(
args[i] = GpuEz.arrayToTex(
args[i],
GpuEz.returnTypes[argVecs[i]] || GpuEz.returnTypes[1]
)
);
temps.push(args[i] = GpuEz.arrayToTex(args[i],
GpuEz.returnTypes[argVecs[i]] || GpuEz.returnTypes[1]));
}

@@ -144,3 +155,3 @@ const [${argNames}] = args;

const res = kernel(...args);
for (const tex of temps) tex.delete();
for (const tex of temps) if (tex.delete) tex.delete();
return res;

@@ -203,2 +214,3 @@ })`);

const dim = GpuEz.getArrayDim(arr, vec);
if (!dim.length) return arr;

@@ -205,0 +217,0 @@ const kernel = GpuEz.getPreKernel(true, dim.length, vecType);

{
"name": "gpu-ez",
"version": "0.2.2",
"version": "0.2.3",
"description": "Easy GLSL parallel computing on GPU.JS",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc