Skip to content

Commit

Permalink
rebase conclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren Budorick committed Jun 14, 2018
1 parent c7e8cee commit 147deca
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 21 deletions.
18 changes: 9 additions & 9 deletions src/data/program_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ConstantBinder<T> implements Binder<T> {
uniform.set(currentValue.constantOr(this.value));
}

getBinding(context: Context, location: WebGLUniformLocation): $Subtype<Uniform<*>> {
getBinding(context: Context, location: WebGLUniformLocation): $Subtype<Uniform<any>> {
return (this.type === 'color') ?
new UniformColor(context, location) :
new Uniform1f(context, location);
Expand Down Expand Up @@ -345,7 +345,7 @@ class CompositeExpressionBinder<T> implements Binder<T> {
*
* @private
*/
class ProgramConfiguration {
export default class ProgramConfiguration {
binders: Array<Binder<any>>;
cacheKey: string;
layoutAttributes: Array<StructArrayMember>;
Expand Down Expand Up @@ -400,9 +400,9 @@ class ProgramConfiguration {
return self;
}

populatePaintArrays(length: number, feature: Feature) {
populatePaintArrays(newLength: number, feature: Feature, index: number) {
for (let i = 0; i < this.binderLen; i++) {
this.binders[i].populatePaintArray(length, feature);
this.binders[i].populatePaintArray(newLength, feature);
}
if (feature.id) {
const featureId = String(feature.id);
Expand All @@ -427,12 +427,12 @@ class ProgramConfiguration {
for (const pos of posArray) {
const feature = vtLayer.feature(pos.index);

for (const property in this.binders) {
const binder = this.binders[property];
for (let i = 0; i < this.binderLen; i++) {
const binder = this.binders[i];
if (binder instanceof ConstantBinder) continue;
if ((binder: any).expression.isStateDependent === true) {
//AHM: Remove after https://github.com/mapbox/mapbox-gl-js/issues/6255
const value = layer.paint.get(property);
const value = layer.paint.get(binder.property);
(binder: any).expression = value.value;
binder.updatePaintArray(pos.start, pos.end, feature, featureState);
dirty = true;
Expand Down Expand Up @@ -464,10 +464,10 @@ class ProgramConfiguration {
return result;
}

setUniforms<Properties: Object>(context: Context, uniformBindings: UniformBindings, properties: PossiblyEvaluated<Properties>, globals: GlobalProperties, i: number) {
setUniforms<Properties: Object>(context: Context, uniformBindings: UniformBindings, properties: PossiblyEvaluated<Properties>, globals: GlobalProperties) {
// Uniform state bindings are owned by the Program, but we set them
// from within the ProgramConfiguraton's binder members.
for (; i < this.binderLen; i++) {
for (let i = 0; i < this.binderLen; i++) {
this.binders[i].setUniforms(context, uniformBindings[this.binders[i].uniformName], globals, properties.get(this.binders[i].property));
}
}
Expand Down
1 change: 0 additions & 1 deletion src/render/draw_fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function drawFill(painter: Painter, sourceCache: SourceCache, layer: FillStyleLa
return;
}

const context = painter.context;
const colorMode = painter.colorModeForRenderPass();

const pass = (!layer.paint.get('fill-pattern') &&
Expand Down
1 change: 1 addition & 0 deletions src/render/draw_line.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import DepthMode from '../gl/depth_mode';
import Texture from './texture';
import {
lineUniformValues,
lineGradientUniformValues,
linePatternUniformValues,
lineSDFUniformValues
} from './program/line_program';
Expand Down
5 changes: 1 addition & 4 deletions src/render/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ class Program<Us: UniformBindings> {
}

if (configuration) {
// For whatever reason, initializing `setUniforms`'s
// loop iterator here creates consistently better performance:
const i = 0;
configuration.setUniforms(context, this.binderUniforms, currentProperties, {zoom: (zoom: any)}, i);
configuration.setUniforms(context, this.binderUniforms, currentProperties, {zoom: (zoom: any)});
}

const primitiveSize = {
Expand Down
5 changes: 1 addition & 4 deletions src/render/program/fill_extrusion_program.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import {
UniformMatrix4fv
} from '../uniform_binding';

import glMatrix from '@mapbox/gl-matrix';
const mat3 = glMatrix.mat3;
const vec3 = glMatrix.vec3;
const mat4 = glMatrix.mat4;
import { mat3, vec3, mat4 } from 'gl-matrix';
import { extend } from '../../util/util';

import type Context from '../../gl/context';
Expand Down
2 changes: 1 addition & 1 deletion src/render/program/heatmap_program.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import { mat4 } from '@mapbox/gl-matrix';
import { mat4 } from 'gl-matrix';

import {
Uniform1i,
Expand Down
2 changes: 1 addition & 1 deletion src/render/program/hillshade_program.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import { mat4 } from '@mapbox/gl-matrix';
import { mat4 } from 'gl-matrix';

import {
Uniform1i,
Expand Down
2 changes: 1 addition & 1 deletion src/render/program/line_program.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const lineGradientUniformValues = (
return extend(lineUniformValues(painter, tile, layer), {
'u_image': 0
});
}
};

const linePatternUniformValues = (
painter: Painter,
Expand Down

0 comments on commit 147deca

Please sign in to comment.