Fix debanding for Mobile rendering method with HDR 2D.
This commit is contained in:
@@ -123,8 +123,11 @@ void ToneMapper::tonemapper(RID p_source_color, RID p_dst_framebuffer, const Ton
|
||||
tonemap.push_constant.flags |= p_settings.use_color_correction ? TONEMAP_FLAG_USE_COLOR_CORRECTION : 0;
|
||||
|
||||
tonemap.push_constant.flags |= p_settings.use_fxaa ? TONEMAP_FLAG_USE_FXAA : 0;
|
||||
// When convert_to_srgb is false: postpone debanding until convert_to_srgb is true (usually during blit).
|
||||
tonemap.push_constant.flags |= (p_settings.use_debanding && p_settings.convert_to_srgb) ? TONEMAP_FLAG_USE_DEBANDING : 0;
|
||||
if (p_settings.debanding_mode == TonemapSettings::DEBANDING_MODE_8_BIT) {
|
||||
tonemap.push_constant.flags |= TONEMAP_FLAG_USE_8_BIT_DEBANDING;
|
||||
} else if (p_settings.debanding_mode == TonemapSettings::DEBANDING_MODE_10_BIT) {
|
||||
tonemap.push_constant.flags |= TONEMAP_FLAG_USE_10_BIT_DEBANDING;
|
||||
}
|
||||
tonemap.push_constant.pixel_size[0] = 1.0 / p_settings.texture_size.x;
|
||||
tonemap.push_constant.pixel_size[1] = 1.0 / p_settings.texture_size.y;
|
||||
|
||||
@@ -208,8 +211,11 @@ void ToneMapper::tonemapper(RD::DrawListID p_subpass_draw_list, RID p_source_col
|
||||
tonemap.push_constant.auto_exposure_scale = p_settings.auto_exposure_scale;
|
||||
|
||||
tonemap.push_constant.flags |= p_settings.use_color_correction ? TONEMAP_FLAG_USE_COLOR_CORRECTION : 0;
|
||||
// When convert_to_srgb is false: postpone debanding until convert_to_srgb is true (usually during blit).
|
||||
tonemap.push_constant.flags |= (p_settings.use_debanding && p_settings.convert_to_srgb) ? TONEMAP_FLAG_USE_DEBANDING : 0;
|
||||
if (p_settings.debanding_mode == TonemapSettings::DEBANDING_MODE_8_BIT) {
|
||||
tonemap.push_constant.flags |= TONEMAP_FLAG_USE_8_BIT_DEBANDING;
|
||||
} else if (p_settings.debanding_mode == TonemapSettings::DEBANDING_MODE_10_BIT) {
|
||||
tonemap.push_constant.flags |= TONEMAP_FLAG_USE_10_BIT_DEBANDING;
|
||||
}
|
||||
tonemap.push_constant.luminance_multiplier = p_settings.luminance_multiplier;
|
||||
|
||||
tonemap.push_constant.flags |= p_settings.convert_to_srgb ? TONEMAP_FLAG_CONVERT_TO_SRGB : 0;
|
||||
|
||||
@@ -63,8 +63,9 @@ private:
|
||||
TONEMAP_FLAG_USE_AUTO_EXPOSURE = (1 << 2),
|
||||
TONEMAP_FLAG_USE_COLOR_CORRECTION = (1 << 3),
|
||||
TONEMAP_FLAG_USE_FXAA = (1 << 4),
|
||||
TONEMAP_FLAG_USE_DEBANDING = (1 << 5),
|
||||
TONEMAP_FLAG_CONVERT_TO_SRGB = (1 << 6),
|
||||
TONEMAP_FLAG_USE_8_BIT_DEBANDING = (1 << 5),
|
||||
TONEMAP_FLAG_USE_10_BIT_DEBANDING = (1 << 6),
|
||||
TONEMAP_FLAG_CONVERT_TO_SRGB = (1 << 7),
|
||||
};
|
||||
|
||||
struct TonemapPushConstant {
|
||||
@@ -141,7 +142,12 @@ public:
|
||||
RID color_correction_texture;
|
||||
|
||||
bool use_fxaa = false;
|
||||
bool use_debanding = false;
|
||||
enum DebandingMode {
|
||||
DEBANDING_MODE_DISABLED,
|
||||
DEBANDING_MODE_8_BIT,
|
||||
DEBANDING_MODE_10_BIT,
|
||||
};
|
||||
DebandingMode debanding_mode = DEBANDING_MODE_DISABLED;
|
||||
Vector2i texture_size;
|
||||
uint32_t view_count = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user