Browse Source

Ensure specialization constants come sorted from reflection

Pedro J. Estébanez 1 năm trước cách đây
mục cha
commit
49625beac2

+ 2 - 0
servers/rendering/rendering_device_commons.h

@@ -912,6 +912,8 @@ public:
 
 	struct ShaderSpecializationConstant : public PipelineSpecializationConstant {
 		BitField<ShaderStage> stages;
+
+		bool operator<(const ShaderSpecializationConstant &p_other) const { return constant_id < p_other.constant_id; }
 	};
 
 	struct ShaderDescription {

+ 2 - 0
servers/rendering/rendering_device_driver.cpp

@@ -265,6 +265,8 @@ Error RenderingDeviceDriver::_reflect_spirv(VectorView<ShaderStageSPIRVData> p_s
 							r_reflection.specialization_constants.push_back(sconst);
 						}
 					}
+
+					r_reflection.specialization_constants.sort();
 				}
 			}