Merge pull request #94064 from bruvzg/lcd_aa_modulate

Fix LCD font AA modulation in RendererRD.
This commit is contained in:
Rémi Verschelde 2024-07-17 11:43:03 +02:00
commit 0268ceaa5c
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -509,11 +509,16 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend
current_repeat = RenderingServer::CanvasItemTextureRepeat::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED;
}
Color modulated = rect->modulate * base_color;
if (use_linear_colors) {
modulated = modulated.srgb_to_linear();
}
//bind pipeline
if (rect->flags & CANVAS_RECT_LCD) {
RID pipeline = pipeline_variants->variants[light_mode][PIPELINE_VARIANT_QUAD_LCD_BLEND].get_render_pipeline(RD::INVALID_ID, p_framebuffer_format);
RD::get_singleton()->draw_list_bind_render_pipeline(p_draw_list, pipeline);
RD::get_singleton()->draw_list_set_blend_constants(p_draw_list, rect->modulate);
RD::get_singleton()->draw_list_set_blend_constants(p_draw_list, modulated);
} else {
RID pipeline = pipeline_variants->variants[light_mode][PIPELINE_VARIANT_QUAD].get_render_pipeline(RD::INVALID_ID, p_framebuffer_format);
RD::get_singleton()->draw_list_bind_render_pipeline(p_draw_list, pipeline);
@ -582,11 +587,6 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend
push_constant.flags |= FLAGS_USE_LCD;
}
Color modulated = rect->modulate * base_color;
if (use_linear_colors) {
modulated = modulated.srgb_to_linear();
}
push_constant.modulation[0] = modulated.r;
push_constant.modulation[1] = modulated.g;
push_constant.modulation[2] = modulated.b;