Skip to content

Commit

Permalink
Remove setUniforms everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren Budorick committed Jan 19, 2018
1 parent d166d46 commit 6fbed2f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
34 changes: 0 additions & 34 deletions src/data/program_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type Context from '../gl/context';
import type {TypedStyleLayer} from '../style/style_layer/typed_style_layer';
import type {StructArray, StructArrayMember} from '../util/struct_array';
import type VertexBuffer from '../gl/vertex_buffer';
import type Program from '../render/program';
import type {Feature, SourceExpression, CompositeExpression} from '../style-spec/expression';
import type {PossiblyEvaluated} from '../style/properties';
import type {UniformValues} from '../render/uniform_binding';
Expand Down Expand Up @@ -63,11 +62,6 @@ interface Binder<T> {

defines(): Array<string>;

setUniforms(context: Context,
program: Program,
globals: GlobalProperties,
currentValue: PossiblyEvaluatedPropertyValue<T>): void;

getUniforms(globals: GlobalProperties,
currentValue: PossiblyEvaluatedPropertyValue<T>): number | Array<number>;
}
Expand Down Expand Up @@ -95,19 +89,6 @@ class ConstantBinder<T> implements Binder<T> {
upload() {}
destroy() {}

setUniforms(context: Context,
program: Program,
globals: GlobalProperties,
currentValue: PossiblyEvaluatedPropertyValue<T>) {
const value: any = currentValue.constantOr(this.value);
const gl = context.gl;
if (this.type === 'color') {
gl.uniform4f(program.uniforms[`u_${this.name}`], value.r, value.g, value.b, value.a);
} else {
gl.uniform1f(program.uniforms[`u_${this.name}`], value);
}
}

getUniforms(globals: GlobalProperties,
currentValue: PossiblyEvaluatedPropertyValue<T>): number | Array<number> {
const value: any = currentValue.constantOr(this.value);
Expand Down Expand Up @@ -180,10 +161,6 @@ class SourceExpressionBinder<T> implements Binder<T> {
}
}

setUniforms(context: Context, program: Program) {
context.gl.uniform1f(program.uniforms[`a_${this.name}_t`], 0);
}

getUniforms(): number {
return 0;
}
Expand Down Expand Up @@ -268,10 +245,6 @@ class CompositeExpressionBinder<T> implements Binder<T> {
}
}

setUniforms(context: Context, program: Program, globals: GlobalProperties) {
context.gl.uniform1f(program.uniforms[`a_${this.name}_t`], this.interpolationFactor(globals.zoom));
}

getUniforms(globals: GlobalProperties): number {
return this.interpolationFactor(globals.zoom);
}
Expand Down Expand Up @@ -356,13 +329,6 @@ class ProgramConfiguration {
return result;
}

setUniforms<Properties: Object>(context: Context, program: Program, properties: PossiblyEvaluated<Properties>, globals: GlobalProperties) {
for (const property in this.binders) {
const binder = this.binders[property];
binder.setUniforms(context, program, globals, properties.get(property));
}
}

getPaintVertexBuffers(): Array<VertexBuffer> {
return this._buffers;
}
Expand Down
6 changes: 0 additions & 6 deletions src/render/draw_heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function drawHeatmap(painter: Painter, sourceCache: SourceCache, layer: HeatmapS

context.clear({ color: Color.transparent });

let first = true;
for (let i = 0; i < coords.length; i++) {
const coord = coords[i];

Expand All @@ -48,14 +47,9 @@ function drawHeatmap(painter: Painter, sourceCache: SourceCache, layer: HeatmapS
const bucket: ?HeatmapBucket = (tile.getBucket(layer): any);
if (!bucket) continue;

const prevProgram = painter.context.program.get();
const programConfiguration = bucket.programConfigurations.get(layer.id);
const program = painter.useProgram('heatmap', programConfiguration);
const {zoom} = painter.transform;
if (first || program.program !== prevProgram) {
programConfiguration.setUniforms(painter.context, program, layer.paint, {zoom});
first = false;
}

program.draw(
context,
Expand Down
2 changes: 0 additions & 2 deletions src/render/draw_symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ function drawLayerSymbols(painter, sourceCache, layer, coords, isText, translate

if (!program) {
program = painter.useProgram(isSDF ? 'symbolSDF' : 'symbolIcon', programConfiguration);
programConfiguration.setUniforms(painter.context, program, layer.paint, {zoom: painter.transform.zoom});

size = symbolSize.evaluateSizeForZoom(sizeData, tr.zoom, symbolLayoutProperties.properties[isText ? 'text-size' : 'icon-size']);
}

Expand Down

0 comments on commit 6fbed2f

Please sign in to comment.