From 49625beac257e868a30a3d7b41665f7d1419b2c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Tue, 12 Mar 2024 14:42:01 +0100 Subject: [PATCH] Ensure specialization constants come sorted from reflection --- servers/rendering/rendering_device_commons.h | 2 ++ servers/rendering/rendering_device_driver.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/servers/rendering/rendering_device_commons.h b/servers/rendering/rendering_device_commons.h index 591752bc0ea..28d641c879a 100644 --- a/servers/rendering/rendering_device_commons.h +++ b/servers/rendering/rendering_device_commons.h @@ -912,6 +912,8 @@ public: struct ShaderSpecializationConstant : public PipelineSpecializationConstant { BitField stages; + + bool operator<(const ShaderSpecializationConstant &p_other) const { return constant_id < p_other.constant_id; } }; struct ShaderDescription { diff --git a/servers/rendering/rendering_device_driver.cpp b/servers/rendering/rendering_device_driver.cpp index 9e05a6a133c..be74467340a 100644 --- a/servers/rendering/rendering_device_driver.cpp +++ b/servers/rendering/rendering_device_driver.cpp @@ -265,6 +265,8 @@ Error RenderingDeviceDriver::_reflect_spirv(VectorView p_s r_reflection.specialization_constants.push_back(sconst); } } + + r_reflection.specialization_constants.sort(); } }