mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
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:
parent
25203e24c4
commit
4cd65e081d
3 changed files with 8 additions and 9 deletions
|
|
@ -324,7 +324,7 @@ void ToneMapper::tonemapper_subpass(RD::DrawListID p_subpass_draw_list, RID p_so
|
|||
tonemap_mobile.push_constant.white = p_settings.white;
|
||||
tonemap_mobile.push_constant.luminance_multiplier = p_settings.luminance_multiplier;
|
||||
|
||||
uint32_t spec_constant = 0;
|
||||
uint32_t spec_constant = TONEMAP_MOBILE_ADRENO_BUG;
|
||||
spec_constant |= p_settings.use_bcs ? TONEMAP_MOBILE_FLAG_USE_BCS : 0;
|
||||
//spec_constant |= p_settings.use_glow ? TONEMAP_MOBILE_FLAG_USE_GLOW : 0;
|
||||
//spec_constant |= p_settings.glow_map_strength > 0.01 ? TONEMAP_MOBILE_FLAG_USE_GLOW_MAP : 0;
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ private:
|
|||
TONEMAP_MOBILE_FLAG_GLOW_MODE_SOFTLIGHT = (1 << 15),
|
||||
TONEMAP_MOBILE_FLAG_GLOW_MODE_REPLACE = (1 << 16),
|
||||
TONEMAP_MOBILE_FLAG_GLOW_MODE_MIX = (1 << 17),
|
||||
TONEMAP_MOBILE_ADRENO_BUG = (1 << 18), // Needs to be last so we force the pipeline cache to specify specializations for all variants.
|
||||
};
|
||||
|
||||
struct TonemapPushConstant {
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue