   getUniformLocations: (descriptor) ->
     {gl} = descriptor.context
     program = @getGLProgram descriptor.context
+    id = descriptor.context.id
     for name, variable of @variables.uniforms
-      variable.location = gl.getUniformLocation program, variable.name
-      if variable.location is null
+      variable.location or= {}
+      variable.location[id] = gl.getUniformLocation program, variable.name
+      if variable.location[id] is null
         # remove variables that were not used in the shader, to prevent
         # uselessly iterating through them later
         delete @variables.uniforms[name]

      descriptor = @_contexts[context.id] =
        valid: false
        context: context
      maxAttrs = @getShaderContext(descriptor, 'vertex').maxVertexAttribs
      context._enabledAttributes or= new Uint8Array maxAttrs
    descriptor

        @setAttribute context, attribute, value
      else
        # console.log 'not using', name
        id = context.id
        if @isAttributeEnabled context, attribute.location[id]
          if attribute.location[id] is 0 and @_dislikedAttributes.indexOf(name) is -1
            # console.log 'disliking', name
            # make a note that this attribute was disabled; finish iterating
            # in case other attributes follow suit; then rebind and retry
            @_dislikedAttributes.push name
            mustRebind = true
          # console.log 'disabling', name
          @disableAttribute context, attribute.location[id], attribute.name
      attribute.value = value
    if mustRebind
      descriptor = @getDescriptor context
