-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: shader compilation error on Firefox with Nvidia driver #10069
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,7 +146,9 @@ flat out vec2 values; | |
| flat out vec3 values; | ||
| #endif | ||
|
|
||
| const float NAN = intBitsToFloat(-1); | ||
| // Sentinel value to indicate an empty bin instead of NaN, | ||
| // which can cause issues with compilation in some drivers | ||
| const float EMPTY_BIN = -3e38; | ||
|
|
||
| void main() { | ||
| int row = gl_VertexID / SAMPLER_WIDTH; | ||
|
|
@@ -158,7 +160,7 @@ void main() { | |
| aggregatorTransform.isMean | ||
| ); | ||
| if (weights.a == 0.0) { | ||
| value3 = vec3(NAN); | ||
| value3 = vec3(EMPTY_BIN); | ||
| } | ||
|
|
||
| #if NUM_DIMS == 1 | ||
|
|
@@ -201,6 +203,9 @@ flat in vec3 values; | |
|
|
||
| out vec4 fragColor; | ||
|
|
||
| // Same sentinel as vertex shader | ||
| const float EMPTY_BIN = -3e38; | ||
|
|
||
| void main() { | ||
| vec3 value3; | ||
| #if NUM_CHANNELS == 3 | ||
|
|
@@ -210,7 +215,8 @@ void main() { | |
| #else | ||
| value3.x = values; | ||
| #endif | ||
| if (isnan(value3.x)) discard; | ||
| // Skip empty bins, with epsilon to account for potential floating point precision issues | ||
| if (value3.x <= EMPTY_BIN + 1e-5) discard; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Epsilon
|
||
| // This shader renders into a 2x1 texture with blending=max | ||
| // The left pixel yields the max value of each channel | ||
| // The right pixel yields the min value of each channel | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sentinel value passes
Number.isFinitecheck, corrupting scale computationsMedium Severity
The sentinel value
EMPTY_BIN = -3e38is a finite number, soNumber.isFinite(-3e38)returnstrue. The scale utility functions inscale-utils.tsrely onNumber.isFinite()to filter out empty bin values —applyScaleQuantileuses.filter(Number.isFinite)andapplyScaleOrdinalchecksNumber.isFinite(x). Previously,NaNwas correctly excluded by these filters. Now,-3e38values from empty bins pass through and contaminate percentile threshold calculations and ordinal category mappings, skewing results whenquantileorordinalscale types are used.Additional Locations (1)
modules/aggregation-layers/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts#L162-L163