Skip to content

Commit 17c2c74

Browse files
committed
hopefully fix wrong segment rendering on some hardware
1 parent 2c0dd57 commit 17c2c74

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

frontend/javascripts/oxalis/shaders/filtering.glsl.ts

+7
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ export const getMaybeFilteredColorOrFallback: ShaderModule = {
140140
) {
141141
vec4[2] color = getColorForCoords64(layerIndex, d_texture_width, packingDegree, worldPositionUVW, supportsPrecomputedBucketAddress);
142142
143+
// Segment ids are always handled as two vec4s (8 byte). On some hardware, floating point
144+
// accuracies can lead to bytes that are stored incorrectly (e.g., as 0.99999 instead of 1).
145+
// As a workaround, we round here. A proper (future) fix would probably be to not use floats
146+
// when accessing textures in the first place.
147+
color[0] = round(color[0]);
148+
color[1] = round(color[1]);
149+
143150
if (color[1].a < 0.0) {
144151
// Render gray for not-yet-existing data
145152
color[1] = fallbackColor;

0 commit comments

Comments
 (0)