(strandsContext, uniformName, typeInfo, defaultValueFn)
| 56 | } |
| 57 | |
| 58 | function getOrCreateUniformNode(strandsContext, uniformName, typeInfo, defaultValueFn) { |
| 59 | const cache = _getBuiltinGlobalsCache(strandsContext); |
| 60 | |
| 61 | const cached = cache.nodes.get(uniformName); |
| 62 | if (cached) return cached; |
| 63 | |
| 64 | if (!cache.uniformsAdded.has(uniformName)) { |
| 65 | cache.uniformsAdded.add(uniformName); |
| 66 | strandsContext.uniforms.push({ |
| 67 | name: uniformName, |
| 68 | typeInfo, |
| 69 | defaultValue: defaultValueFn, |
| 70 | }); |
| 71 | } |
| 72 | |
| 73 | const { id, dimension } = build.variableNode(strandsContext, typeInfo, uniformName); |
| 74 | const node = createStrandsNode(id, dimension, strandsContext); |
| 75 | cache.nodes.set(uniformName, node); |
| 76 | return node; |
| 77 | } |
| 78 | |
| 79 | function getBuiltinGlobalNode(strandsContext, name) { |
| 80 | const spec = BUILTIN_GLOBAL_SPECS[name]; |
no test coverage detected