Skip to content

Commit

Permalink
Use glUniform1i for boolean uniforms (mapbox#9349)
Browse files Browse the repository at this point in the history
We used glUniform1f for some of them, which caused rendering errors in at least Chrome 48. Changing these calls to the correct call glUniform1i fixes this issue.
  • Loading branch information
kkaefer authored and mike-unearth committed Mar 18, 2020
1 parent c34fc43 commit b032ef4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/render/program/symbol_program.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type SymbolIconUniformsType = {|
'u_matrix': UniformMatrix4f,
'u_label_plane_matrix': UniformMatrix4f,
'u_coord_matrix': UniformMatrix4f,
'u_is_text': Uniform1f,
'u_is_text': Uniform1i,
'u_pitch_with_map': Uniform1i,
'u_texsize': Uniform2f,
'u_texture': Uniform1i
Expand All @@ -45,13 +45,13 @@ export type SymbolSDFUniformsType = {|
'u_matrix': UniformMatrix4f,
'u_label_plane_matrix': UniformMatrix4f,
'u_coord_matrix': UniformMatrix4f,
'u_is_text': Uniform1f,
'u_is_text': Uniform1i,
'u_pitch_with_map': Uniform1i,
'u_texsize': Uniform2f,
'u_texture': Uniform1i,
'u_gamma_scale': Uniform1f,
'u_device_pixel_ratio': Uniform1f,
'u_is_halo': Uniform1f
'u_is_halo': Uniform1i
|};

export type symbolTextAndIconUniformsType = {|
Expand All @@ -67,15 +67,15 @@ export type symbolTextAndIconUniformsType = {|
'u_matrix': UniformMatrix4f,
'u_label_plane_matrix': UniformMatrix4f,
'u_coord_matrix': UniformMatrix4f,
'u_is_text': Uniform1f,
'u_is_text': Uniform1i,
'u_pitch_with_map': Uniform1i,
'u_texsize': Uniform2f,
'u_texsize_icon': Uniform2f,
'u_texture': Uniform1i,
'u_texture_icon': Uniform1i,
'u_gamma_scale': Uniform1f,
'u_device_pixel_ratio': Uniform1f,
'u_is_halo': Uniform1f
'u_is_halo': Uniform1i
|};

const symbolIconUniforms = (context: Context, locations: UniformLocations): SymbolIconUniformsType => ({
Expand All @@ -91,7 +91,7 @@ const symbolIconUniforms = (context: Context, locations: UniformLocations): Symb
'u_matrix': new UniformMatrix4f(context, locations.u_matrix),
'u_label_plane_matrix': new UniformMatrix4f(context, locations.u_label_plane_matrix),
'u_coord_matrix': new UniformMatrix4f(context, locations.u_coord_matrix),
'u_is_text': new Uniform1f(context, locations.u_is_text),
'u_is_text': new Uniform1i(context, locations.u_is_text),
'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),
'u_texsize': new Uniform2f(context, locations.u_texsize),
'u_texture': new Uniform1i(context, locations.u_texture)
Expand All @@ -110,13 +110,13 @@ const symbolSDFUniforms = (context: Context, locations: UniformLocations): Symbo
'u_matrix': new UniformMatrix4f(context, locations.u_matrix),
'u_label_plane_matrix': new UniformMatrix4f(context, locations.u_label_plane_matrix),
'u_coord_matrix': new UniformMatrix4f(context, locations.u_coord_matrix),
'u_is_text': new Uniform1f(context, locations.u_is_text),
'u_is_text': new Uniform1i(context, locations.u_is_text),
'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),
'u_texsize': new Uniform2f(context, locations.u_texsize),
'u_texture': new Uniform1i(context, locations.u_texture),
'u_gamma_scale': new Uniform1f(context, locations.u_gamma_scale),
'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),
'u_is_halo': new Uniform1f(context, locations.u_is_halo)
'u_is_halo': new Uniform1i(context, locations.u_is_halo)
});

const symbolTextAndIconUniforms = (context: Context, locations: UniformLocations): symbolTextAndIconUniformsType => ({
Expand All @@ -132,15 +132,15 @@ const symbolTextAndIconUniforms = (context: Context, locations: UniformLocations
'u_matrix': new UniformMatrix4f(context, locations.u_matrix),
'u_label_plane_matrix': new UniformMatrix4f(context, locations.u_label_plane_matrix),
'u_coord_matrix': new UniformMatrix4f(context, locations.u_coord_matrix),
'u_is_text': new Uniform1f(context, locations.u_is_text),
'u_is_text': new Uniform1i(context, locations.u_is_text),
'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),
'u_texsize': new Uniform2f(context, locations.u_texsize),
'u_texsize_icon': new Uniform2f(context, locations.u_texsize_icon),
'u_texture': new Uniform1i(context, locations.u_texture),
'u_texture_icon': new Uniform1i(context, locations.u_texture_icon),
'u_gamma_scale': new Uniform1f(context, locations.u_gamma_scale),
'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),
'u_is_halo': new Uniform1f(context, locations.u_is_halo)
'u_is_halo': new Uniform1i(context, locations.u_is_halo)
});

const symbolIconUniformValues = (
Expand Down

0 comments on commit b032ef4

Please sign in to comment.