From fe1ecd5e791dd98bf96009b216c3d0960d99ea56 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 3 Jan 2020 18:48:23 +0100 Subject: [PATCH] pgraph: fix ShaderInput ordering for vector inputs with small floats Fixes #827 --- panda/src/pgraph/shaderInput.I | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/panda/src/pgraph/shaderInput.I b/panda/src/pgraph/shaderInput.I index b8e182421f..d0a0e79fbb 100644 --- a/panda/src/pgraph/shaderInput.I +++ b/panda/src/pgraph/shaderInput.I @@ -490,7 +490,19 @@ operator < (const ShaderInput &other) const { return false; case M_vector: - return _stored_vector < other._stored_vector; + if (_stored_vector[0] != other._stored_vector[0]) { + return (_stored_vector[0] < other._stored_vector[0]) ? -1 : 1; + } + if (_stored_vector[1] != other._stored_vector[1]) { + return (_stored_vector[1] < other._stored_vector[1]) ? -1 : 1; + } + if (_stored_vector[2] != other._stored_vector[2]) { + return (_stored_vector[2] < other._stored_vector[2]) ? -1 : 1; + } + if (_stored_vector[3] != other._stored_vector[3]) { + return (_stored_vector[3] < other._stored_vector[3]) ? -1 : 1; + } + return 0; case M_numeric: return _stored_ptr._ptr < other._stored_ptr._ptr;