Fix LCD font AA modulation in RendererRD.

This commit is contained in:
bruvzg 2024-07-08 11:17:31 +03:00
parent 42e5b3ac2d
commit 4790e12f66
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
1 changed files with 6 additions and 6 deletions

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;