Skip to content
Closed
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
4 changes: 2 additions & 2 deletions src/gl/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class Context {
extTextureFilterAnisotropic: any;
extTextureFilterAnisotropicMax: any;
extTextureHalfFloat: any;
extRenderToTextureHalfFloat: any;
extStandardDerivatives: any;
extDebugRendererInfo: any;
extTimerQuery: any;
Expand Down Expand Up @@ -141,7 +140,8 @@ class Context {

if (!isWebGL2) this.extTextureHalfFloat = gl.getExtension('OES_texture_half_float');
if (isWebGL2 || (this.extTextureHalfFloat && gl.getExtension('OES_texture_half_float_linear'))) {
this.extRenderToTextureHalfFloat = gl.getExtension('EXT_color_buffer_half_float');
gl.getExtension('EXT_color_buffer_half_float');
gl.getExtension('EXT_color_buffer_float');
}
this.extStandardDerivatives = isWebGL2 || gl.getExtension('OES_standard_derivatives');

Expand Down
5 changes: 3 additions & 2 deletions src/render/draw_heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ function bindTextureToFramebuffer(context: Context, painter: Painter, texture: ?
// Use the higher precision half-float texture where available (producing much smoother looking heatmaps);
// Otherwise, fall back to a low precision texture
/* $FlowFixMe[prop-missing] WebGL2 */
const type = context.extRenderToTextureHalfFloat ? (context.isWebGL2 ? gl.HALF_FLOAT : context.extTextureHalfFloat.HALF_FLOAT_OES) : gl.UNSIGNED_BYTE;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heatmaps work with this fix now with WebGL2, but I'm unsure about removing the gl.getExtension('EXT_color_buffer_half_float') check here. /cc @astojilj

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this might break some Android GPUs that don't support EXT_color_buffer_half_float. So we're still blocked by Firefox not supporting EXT_color_buffer_half_float in WebGL 2.0 contexts.

const type = context.isWebGL2 ? gl.HALF_FLOAT : context.extTextureHalfFloat.HALF_FLOAT_OES;
/* $FlowFixMe[prop-missing] WebGL2 */
gl.texImage2D(gl.TEXTURE_2D, 0, (context.isWebGL2 && context.extRenderToTextureHalfFloat) ? gl.RGBA16F : gl.RGBA, width, height, 0, gl.RGBA, type, null);
const format = context.isWebGL2 ? gl.RGBA16F : gl.RGBA;
gl.texImage2D(gl.TEXTURE_2D, 0, format, width, height, 0, gl.RGBA, type, null);
fbo.colorAttachment.set(texture);
}

Expand Down
3 changes: 1 addition & 2 deletions test/integration/render-tests/fog/2d/heatmap/style.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"metadata": {
"test": {
"height": 256,
"width": 256,
"allowed": 0.00265
"width": 256
}
},
"center": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 64,
"width": 256,
"allowed": 0.0073,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 64,
"width": 256,
"allowed": 0.0073,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 128,
"width": 256,
"allowed": 0.00593,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 128,
"width": 256,
"allowed": 0.00263,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 128,
"width": 256,
"allowed": 0.0027,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 32,
"width": 128,
"allowed": 0.0044,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 128,
"width": 256,
"allowed": 0.00593,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 128,
"width": 256,
"allowed": 0.01429,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 128,
"width": 256,
"allowed": 0.01164,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 128,
"width": 256,
"allowed": 0.02394,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 128,
"width": 256,
"allowed": 0.00593,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 128,
"width": 256,
"allowed": 0.00627,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"test": {
"height": 128,
"width": 256,
"allowed": 0.0027,
"description": "Contains two expected images (for ubyte-based rendering and half-float-based); one of them should pass depending on platform."
}
},
Expand Down