Browse Source

Fix LCD font AA modulation in RendererRD.

bruvzg 1 year ago
parent
commit
4790e12f66
1 changed files with 6 additions and 6 deletions
  1. 6 6
      servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp

+ 6 - 6
servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp

@@ -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;
 					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
 				//bind pipeline
 				if (rect->flags & CANVAS_RECT_LCD) {
 				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);
 					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_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 {
 				} else {
 					RID pipeline = pipeline_variants->variants[light_mode][PIPELINE_VARIANT_QUAD].get_render_pipeline(RD::INVALID_ID, p_framebuffer_format);
 					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);
 					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;
 					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[0] = modulated.r;
 				push_constant.modulation[1] = modulated.g;
 				push_constant.modulation[1] = modulated.g;
 				push_constant.modulation[2] = modulated.b;
 				push_constant.modulation[2] = modulated.b;