Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure symbol shader attrib bound at 0 is always valid and used #4688

Merged
merged 3 commits into from
May 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/render/painter.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,14 @@ class Painter {
assert(gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS), gl.getShaderInfoLog(vertexShader));
gl.attachShader(program, vertexShader);


// For the symbol program, manually ensure the attrib bound to position 0 is always used (either a_data or a_pos_offset would work here).
// This is needed to fix https://github.com/mapbox/mapbox-gl-js/issues/4607 — otherwise a_size can be bound first, causing rendering to fail.
// All remaining attribs will be bound dynamically below.
if (name === 'symbolSDF') {
gl.bindAttribLocation(program, 0, 'a_data');
}

gl.linkProgram(program);
assert(gl.getProgramParameter(program, gl.LINK_STATUS), gl.getProgramInfoLog(program));

Expand Down
2 changes: 2 additions & 0 deletions src/shaders/symbol_sdf.vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const float PI = 3.141592653589793;

// NOTE: the a_data attribute in this shader is manually bound (see https://github.com/mapbox/mapbox-gl-js/issues/4607).
// If removing or renaming a_data, revisit the manual binding in painter.js accordingly.
attribute vec4 a_pos_offset;
attribute vec4 a_data;

Expand Down