Skip to content

Commit

Permalink
warnings when mixing ops.gl and webgpu ops
Browse files Browse the repository at this point in the history
  • Loading branch information
pandrr committed Jan 28, 2025
1 parent 6dd78c4 commit 87466a9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
29 changes: 23 additions & 6 deletions src/ui/core_extend_op.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
*/

import { portType } from "./core_constants.js";
import defaultOps from "./defaultops.js";
import gluiconfig from "./glpatch/gluiconfig.js";
import { gui } from "./gui.js";
import text from "./text.js";

CABLES.OpUnLinkTempReLinkP1 = null;
CABLES.OpUnLinkTempReLinkP2 = null;

/**
* @extends {CABLES.Op}
*/
export default function extendCoreOp()
{
CABLES.Op.prototype.initUi = function ()
Expand Down Expand Up @@ -373,18 +377,31 @@ export default function extendCoreOp()
}
}

let isWebGpu = this.objName.indexOf(defaultOps.prefixes.webgpu) == 0;

this.setUiError("wrongstride", null);
this.setUiError("webglgpu", null);
for (let i = 0; i < this.portsIn.length; i++)
{
if (this.portsIn[i].type == portType.array && this.portsIn[i].links.length && this.portsIn[i].links[0])
if (this.portsIn[i].links.length && this.portsIn[i].links[0])
{
const otherPort = this.portsIn[i].links[0].getOtherPort(this.portsIn[i]);
if (
otherPort.uiAttribs.stride != undefined &&
this.portsIn[i].uiAttribs.stride != undefined &&
otherPort.uiAttribs.stride != this.portsIn[i].uiAttribs.stride)

if (isWebGpu && otherPort.op.objName.indexOf(defaultOps.prefixes.webgl) == 0)
{
this.setUiError("wrongstride", "Port \"" + this.portsIn[i].name + "\" : Incompatible Array" + otherPort.uiAttribs.stride + " to Array" + this.portsIn[i].uiAttribs.stride, 1);
this.setUiError("webglgpu", "mixing webgl/webgpu ops: " + otherPort.op.objName, 1);
}

if (this.portsIn[i].type == portType.array)
{

if (
otherPort.uiAttribs.stride != undefined &&
this.portsIn[i].uiAttribs.stride != undefined &&
otherPort.uiAttribs.stride != this.portsIn[i].uiAttribs.stride)
{
this.setUiError("wrongstride", "Port \"" + this.portsIn[i].name + "\" : Incompatible Array" + otherPort.uiAttribs.stride + " to Array" + this.portsIn[i].uiAttribs.stride, 1);
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/ui/defaultops.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ const defaultOps = {
"patchOp": "Ops.Patch.P",
"userOp": "Ops.User.",
"teamOp": "Ops.Team.",
"extensionOp": "Ops.Extension."
"extensionOp": "Ops.Extension.",
"webgpu": "Ops.Team.WebGpu",
"webgl": "Ops.Gl.",
},
"converterOps":
[
Expand Down
3 changes: 0 additions & 3 deletions src/ui/namespaceutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,3 @@ namespace.isTeamNamespace = (opname) =>
const parts = opname.split(".");
return parts.length < 5;
};



0 comments on commit 87466a9

Please sign in to comment.