mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Sanitize tangents when creating mesh surfaces to avoid triggering the compressed mesh path in the shader
This commit is contained in:
parent
b1371806ad
commit
e3d31837eb
4 changed files with 32 additions and 0 deletions
|
@ -612,6 +612,12 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint64_t p_format, uint
|
|||
(uint16_t)CLAMP(res.y * 65535, 0, 65535),
|
||||
};
|
||||
|
||||
if (vector[0] == 0 && vector[1] == 65535) {
|
||||
// (1, 1) and (0, 1) decode to the same value, but (0, 1) messes with our compression detection.
|
||||
// So we sanitize here.
|
||||
vector[0] = 65535;
|
||||
}
|
||||
|
||||
memcpy(&vw[p_offsets[ai] + i * p_normal_stride], vector, 4);
|
||||
}
|
||||
} else { // PACKED_FLOAT64_ARRAY
|
||||
|
@ -627,6 +633,12 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint64_t p_format, uint
|
|||
(uint16_t)CLAMP(res.y * 65535, 0, 65535),
|
||||
};
|
||||
|
||||
if (vector[0] == 0 && vector[1] == 65535) {
|
||||
// (1, 1) and (0, 1) decode to the same value, but (0, 1) messes with our compression detection.
|
||||
// So we sanitize here.
|
||||
vector[0] = 65535;
|
||||
}
|
||||
|
||||
memcpy(&vw[p_offsets[ai] + i * p_normal_stride], vector, 4);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue