Ensure that all spec constants are given a value in the mobile post process shader so that re-spirv can pick up on them and optimize them out of the final shader

This is needed to workaround a bug on Adreno devices when using input attachments and spec constants in the same shader
This commit is contained in:
clayjohn 2025-12-02 11:18:00 -08:00
parent 25203e24c4
commit 4cd65e081d
3 changed files with 8 additions and 9 deletions

View file

@ -46,14 +46,12 @@ RID PipelineCacheRD::_generate_version(RD::VertexFormatID p_vertex_format_id, RD
uint32_t bool_index = 0;
uint32_t bool_specializations = p_bool_specializations;
while (bool_specializations) {
if (bool_specializations & (1 << bool_index)) {
RD::PipelineSpecializationConstant sc;
sc.bool_value = true;
sc.constant_id = bool_index;
sc.type = RD::PIPELINE_SPECIALIZATION_CONSTANT_TYPE_BOOL;
specialization_constants.push_back(sc);
bool_specializations &= ~(1 << bool_index);
}
RD::PipelineSpecializationConstant sc;
sc.bool_value = bool(bool_specializations & (1 << bool_index));
sc.constant_id = bool_index;
sc.type = RD::PIPELINE_SPECIALIZATION_CONSTANT_TYPE_BOOL;
specialization_constants.push_back(sc);
bool_specializations &= ~(1 << bool_index);
bool_index++;
}