New program was added to the multiprogram; update items in the
        shader.
505046
def _new_program(self, p):
        
        for k, v in self._set_items.items():
            getattr(p, self._shader)[k] = v
933845
function(compName, shader) {
        this.program = this._drawLayer.getProgramWrapper(compName, shader);

        // Needs to know where in the big array we are!
        this.program.registerEntity(this);
        // Shader program means ready
        this.ready = true;
    }
434156
def build(self):
        
        for cls, data_list in self._items.items():
            # Some variables are not concatenated. They are specified
            # in `allow_list`.
            data = _accumulate(data_list, cls.allow_list)
            box_index = data.pop('box_index')
            visual = cls()
            self.add_visual(visual)
            visual.set_data(**data)
            # NOTE: visual.program.__contains__ is implemented in vispy master
            # so we can replace this with `if 'a_box_index' in visual.program`
            # after the next VisPy release.
            if 'a_box_index' in visual.program._code_variables:
                visual.program['a_box_index'] = box_index.astype(np.float32)
        # TODO: refactor this when there is the possibility to update existing
        # visuals without recreating the whole scene.
        if self.lasso:
            self.lasso.create_visual()
        self.update()
507348
function initShaders() {
  var fragmentShader = getShader(gl, fragmentShaderSource, false);
  var vertexShader = getShader(gl, vertexShaderSource, true);

  // Create the shader program

  shaderProgram = gl.createProgram();
  gl.attachShader(shaderProgram, vertexShader);
  gl.attachShader(shaderProgram, fragmentShader);
  gl.linkProgram(shaderProgram);

  // If creating the shader program failed, alert

  if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) {
    alert("Unable to initialize the shader program: " + gl.getProgramInfoLog(shader));
  }

  gl.useProgram(shaderProgram);

  vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition");
  gl.enableVertexAttribArray(vertexPositionAttribute);
}
157489
function LGraphTextureGradient() {
            this.addInput("A", "color");
            this.addInput("B", "color");
            this.addOutput("Texture", "Texture");

            this.properties = {
                angle: 0,
                scale: 1,
                A: [0, 0, 0],
                B: [1, 1, 1],
                texture_size: 32
            };
            if (!LGraphTextureGradient._shader) {
                LGraphTextureGradient._shader = new GL.Shader(
                    Shader.SCREEN_VERTEX_SHADER,
                    LGraphTextureGradient.pixel_shader
                );
            }

            this._uniforms = {
                u_angle: 0,
                u_colorA: vec3.create(),
                u_colorB: vec3.create()
            };
        }
1357497
function render(gl, width, height, dt, batch, shader) {
    time+=dt
    
    //switching textures is free, and doesn't update any buffers
    if (time > 1000) {
        batch.texture = batch.texture === tex2 ? tex : tex2
        time = 0
    }

    //draw our static vertex data
    batch.bind(shader)
    batch.draw()
    batch.unbind()
}
1314414
function createAttributeWrapper(gl, program, attributes, doLink) {
  var obj = {}
  for(var i=0, n=attributes.length; i<n; ++i) {
    var a = attributes[i]
    var name = a.name
    var type = a.type
    var location = gl.getAttribLocation(program, name)
    
    switch(type) {
      case 'bool':
      case 'int':
      case 'float':
        addVectorAttribute(gl, program, location, 1, obj, name, doLink)
      break
      
      default:
        if(type.indexOf('vec') >= 0) {
          var d = type.charCodeAt(type.length-1) - 48
          if(d < 2 || d > 4) {
            throw new Error('gl-shader: Invalid data type for attribute ' + name + ': ' + type)
          }
          addVectorAttribute(gl, program, location, d, obj, name, doLink)
        } else {
          throw new Error('gl-shader: Unknown data type for attribute ' + name + ': ' + type)
        }
      break
    }
  }
  return obj
}
999151
function freeGLResources(glResources) {
  const gl = glResources.gl;

  // Delete each program
  Object.keys(glResources.programs).forEach((programName) => {
    const program = glResources.programs[programName];
    const shaders = program.shaders;

    let count = shaders.length;

    // Delete shaders
    while (count) {
      count -= 1;
      gl.deleteShader(shaders[count]);
    }

    // Delete program
    gl.deleteProgram(program);
  });

  // Delete framebuffers
  Object.keys(glResources.framebuffers).forEach((fbName) => {
    gl.deleteFramebuffer(glResources.framebuffers[fbName]);
  });

  // Delete textures
  Object.keys(glResources.textures).forEach((textureName) => {
    gl.deleteTexture(glResources.textures[textureName]);
  });

  // Delete buffers
  Object.keys(glResources.buffers).forEach((bufferName) => {
    gl.deleteBuffer(glResources.buffers[bufferName]);
  });
}
192116
private void updateBitmapShader() {
        Drawable drawable = getDrawable();
        Bitmap bitmap = null;
        if ((null != drawable) && (drawable instanceof BitmapDrawable)) {
            bitmap = ((BitmapDrawable) drawable).getBitmap();
        }

        // Clear the shader & abort is the new bitmap is null
        if (null == bitmap) {
            mBitmapPaint.setShader(null);
            return;
        }

        int bitmapWidth = bitmap.getWidth();
        int bitmapHeight = bitmap.getHeight();
        float x = 0, y = 0;
        int diameter = mRadius * 2;
        // Offset takes the border width in to account when calculating the the scale
        int borderWidth = shouldDrawBorder() ? mBorderWidth : 0;
        int offset = (borderWidth > 0) ? (borderWidth * 2) : 0;
        // Consider shadow too
        offset += mShadowRadius * 1.5f;
        float scale = (float) (diameter - offset) / (float) Math.min(bitmapHeight, bitmapWidth);

        x = (mWidth - bitmapWidth * scale) * 0.5f;
        y = (mHeight - bitmapHeight * scale) * 0.5f;

        // Apply scale and translation to matrix
        Matrix matrix = new Matrix();
        matrix.setScale(scale, scale);
        matrix.postTranslate(Math.round(x), Math.round(y));

        // Create the BitmapShader and apply the Matrix
        BitmapShader shader = new BitmapShader(bitmap,
                Shader.TileMode.CLAMP,
                Shader.TileMode.CLAMP);
        shader.setLocalMatrix(matrix);
        mBitmapPaint.setShader(shader);
    }
297099
function updateRenderbuffer(ctx, renderbuffer, opts) {
  Object.assign(renderbuffer, opts)

  const gl = ctx.gl

  assert(
    renderbuffer.pixelFormat === ctx.PixelFormat.Depth16,
    'Only PixelFormat.Depth16 is supported for renderbuffers'
  )
  renderbuffer.format = gl.DEPTH_COMPONENT16

  gl.bindRenderbuffer(renderbuffer.target, renderbuffer.handle)
  gl.renderbufferStorage(
    renderbuffer.target,
    renderbuffer.format,
    renderbuffer.width,
    renderbuffer.height
  )
  gl.bindRenderbuffer(renderbuffer.target, null)
}
532271
function update (opt) {
    // remove old shaders
    disposeShaders()

    var quiet = opt.quiet
    var attributeBindings = opt.attributes

    var vertSrc = opt.vertex || defaultVertex
    var fragSrc = opt.fragment || defaultFragment

    // re-compile source
    vertexShader = compileShader(gl, gl.VERTEX_SHADER, vertSrc, quiet, name)
    fragmentShader = compileShader(gl, gl.FRAGMENT_SHADER, fragSrc, quiet, name)

    // re-link
    var shaders = [ vertexShader, fragmentShader ]
    linkShaders(gl, program, shaders, attributeBindings, quiet, name)

    // extract uniforms and attributes
    types = extract(gl, program)

    // allow user to inject some dummy uniforms
    if (opt.uniforms) {
      var inactiveUniforms = []
      opt.uniforms.forEach(function (uniform) {
        if (indexOfName(types.uniforms, uniform.name) === -1) {
          inactiveUniforms.push(uniform)
          types.uniforms.push({ name: uniform.name, type: uniform.type })
        }
      })

      // provide UX for inactive uniforms...? TBD
      if (!quiet && inactiveUniforms.length > 0) {
        var shaderName = name ? (' (' + name + ')') : ''
        console.warn('Inactive uniforms in shader' + shaderName + ': '
          + inactiveUniforms
            .map(function (x) { return x.name })
            .join(', '))
      }
    }

    // normalize sort order by name across Chrome / FF
    types.uniforms.sort(compareString)
    types.attributes.sort(compareString)

    // provide optimized getters/setters
    uniforms = reflect(types.uniforms, function (uniform, index) {
      return makeUniformProp(uniform, index)
    })

    // provide attribute locations and type
    // (GLSL ES does not support array/struct attributes)
    attributes = types.attributes.reduce(function (struct, attrib) {
      var name = attrib.name
      struct[name] = {
        size: dimension(attrib.type),
        type: attrib.type,
        location: gl.getAttribLocation(program, name)
      }
      return struct
    }, {})
  }
868627
def update_gl_state(self, *args, **kwargs):
        
        for v in self._subvisuals:
            v.update_gl_state(*args, **kwargs)
1165689
function() {
		var gl = this.gl,
		      program = this.program;


		// initialize pixel textures
		this.bgTexture = createTexture( 0, "bgTexture" );
		this.spriteTexture = createTexture( 1, "spriteTexture" );
		this.prioTexture = createTexture( 2, "prioTexture" );

		// initialize palette texture
		this.paletteTexture = createTexture( 3, "paletteTexture" );
		gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 64, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, palette );

		function createTexture( index, name ) {
			var texture = gl.createTexture();
			gl.bindTexture(gl.TEXTURE_2D, texture);

			gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
			gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
			gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
			gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

			gl.uniform1i(gl.getUniformLocation(program, name), index);

			return texture;
		}
	}
784061
public static void apply(Program program, TreeGP manager)
   {
      int iMaxProgramDepth = manager.getMaxProgramDepth();
      TGPMutationStrategy method = manager.getMutationStrategy();
      RandEngine randEngine = manager.getRandEngine();
      
      if (method == TGPMutationStrategy.MUTATION_SUBTREE || method == TGPMutationStrategy.MUTATION_SUBTREE_KINNEAR)
      {
         TreeNode node = program.anyNode(randEngine)._1();
         int depth = program.calcDepth();

         TreeNode root = program.getRoot();

         if (method == TGPMutationStrategy.MUTATION_SUBTREE)
         {
            int node_depth = root.depth2Node(node);
            node.getChildren().clear();

            node.setPrimitive(program.anyPrimitive(randEngine));

            if (!node.getPrimitive().isTerminal())
            {
               int max_depth = iMaxProgramDepth - node_depth;
               TreeGenerator.createWithDepth(program, node, max_depth, TGPInitializationStrategy.INITIALIZATION_METHOD_GROW, randEngine);
            }
         }
         else
         {
            int subtree_depth = root.depth2Node(node);
            int current_depth = depth - subtree_depth;
            int max_depth = (int)(depth * 1.15) - current_depth;

            node.getChildren().clear();
            node.setPrimitive(program.anyPrimitive(randEngine));

            if (!node.getPrimitive().isTerminal())
            {
               TreeGenerator.createWithDepth(program, node, max_depth, TGPInitializationStrategy.INITIALIZATION_METHOD_GROW, randEngine);
            }
         }
      }
      else if (method == TGPMutationStrategy.MUTATION_HOIST)
      {
         TreeNode node = program.anyNode(randEngine)._1();

         if (node != program.getRoot())
         {
            program.setRoot(node);
         }
      }
      else if (method == TGPMutationStrategy.MUTATION_SHRINK)
      {
         TreeNode node = program.anyNode(randEngine)._1();
         node.getChildren().clear();
         node.setPrimitive(program.anyTerminal(randEngine));
      }

      program.calcDepth();
      program.calcLength();
   }
1287564
function() {
		var gl = this.gl;

		var program = gl.createProgram();
		gl.attachShader( program, this.vertexShader );
		gl.attachShader( program, this.fragmentShader );
		gl.linkProgram( program );	
		gl.useProgram( program );

		this.program = program;
	}
882099
def new_resources(self, program):
        
        resources = config_utils.get_resources(program, self._config)
        if resources.get("jvm_opts"):
            self._jvm_opts = resources.get("jvm_opts")
163768
function(src, type) {
        var gl = this.context;
        var shader = gl.createShader(type);
        gl.shaderSource(shader, src);
        gl.compileShader(shader);
        if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
            throw gl.getShaderInfoLog(shader);
        }
        return shader;
    }