Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const contextChildren = dataContextChildren.map(traverseTree);
// Traverse children and compute children renderData.
// We build a framebuffer mapping (from child index to fbo index)
const children = dataChildren.map(traverseTree);
// Sync shader
let shader;
if (s in shaders) {
shader = shaders[s]; // re-use existing gl-shader instance
} else if (s in prevShaders) {
shader = shaders[s] = prevShaders[s]; // re-use old gl-shader instance
} else {
// Retrieve/Compiles/Prepare the shader
const shaderObj = Shaders.get(s);
invariant(shaderObj, "Shader #%s does not exists", s);
shader = createShader(gl, vertShader, shaderObj.frag);
shader.name = shaderObj.name;
shader.attributes._p.pointer();
shaders[s] = shader;
}
// extract uniforms and textures
let uniforms = {}; // will contains all uniforms values (including texture units)
let textures = {}; // a texture is an object with a bind() function
let units = 0; // Starting from 0, we will affect texture units to texture uniforms
for (const uniformName in dataUniforms) {
const value = dataUniforms[uniformName];
const type = shader.types.uniforms[uniformName];
invariant(