Skip to content

Commit

Permalink
Cover edge case of missing image for pattern fill
Browse files Browse the repository at this point in the history
Signed-off-by: Iván Sánchez Ortega <[email protected]>
  • Loading branch information
IvanSanchez committed Apr 11, 2023
1 parent baa3d99 commit 65d16e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/render/draw_fill_extrusion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ function drawExtrusionTiles(
const programConfiguration = bucket.programConfigurations.get(layer.id);
const program = painter.useProgram(image ? 'fillExtrusionPattern' : 'fillExtrusion', programConfiguration);

if (image) {
// Extrusion will use a texture if there's a pattern image and an
// atlas. It's possible to have an image but no atlas, in the case of
// missing (mis-named) pattern images
if (image && tile.imageAtlasTexture) {
painter.context.activeTexture.set(gl.TEXTURE0);
tile.imageAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);
programConfiguration.updatePaintBuffers(crossfade);
Expand Down
2 changes: 1 addition & 1 deletion src/render/program/pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function patternUniformValues(crossfade: CrossfadeParameters, painter: Painter,

return {
'u_image': 0,
'u_texsize': tile.imageAtlasTexture.size,
'u_texsize': tile.imageAtlasTexture ? tile.imageAtlasTexture.size : [0, 0],
'u_scale': [tileRatio, crossfade.fromScale, crossfade.toScale],
'u_fade': crossfade.t,
// split the pixel coord into two pairs of 16 bit numbers. The glsl spec only guarantees 16 bits of precision.
Expand Down

0 comments on commit 65d16e5

Please sign in to comment.