You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Merge pull request #79169 from reduz/debug-canvas-item-redraw
Debug CanvasItem redraw
This commit is contained in:
@@ -957,7 +957,48 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend
|
||||
|
||||
c = c->next;
|
||||
}
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (debug_redraw && p_item->debug_redraw_time > 0.0) {
|
||||
Color dc = debug_redraw_color;
|
||||
dc.a *= p_item->debug_redraw_time / debug_redraw_time;
|
||||
|
||||
RID pipeline = pipeline_variants->variants[PIPELINE_LIGHT_MODE_DISABLED][PIPELINE_VARIANT_QUAD].get_render_pipeline(RD::INVALID_ID, p_framebuffer_format);
|
||||
RD::get_singleton()->draw_list_bind_render_pipeline(p_draw_list, pipeline);
|
||||
|
||||
//bind textures
|
||||
|
||||
_bind_canvas_texture(p_draw_list, RID(), current_filter, current_repeat, last_texture, push_constant, texpixel_size);
|
||||
|
||||
Rect2 src_rect;
|
||||
Rect2 dst_rect;
|
||||
|
||||
dst_rect = Rect2(Vector2(), p_item->rect.size);
|
||||
src_rect = Rect2(0, 0, 1, 1);
|
||||
|
||||
push_constant.modulation[0] = dc.r;
|
||||
push_constant.modulation[1] = dc.g;
|
||||
push_constant.modulation[2] = dc.b;
|
||||
push_constant.modulation[3] = dc.a;
|
||||
|
||||
push_constant.src_rect[0] = src_rect.position.x;
|
||||
push_constant.src_rect[1] = src_rect.position.y;
|
||||
push_constant.src_rect[2] = src_rect.size.width;
|
||||
push_constant.src_rect[3] = src_rect.size.height;
|
||||
|
||||
push_constant.dst_rect[0] = dst_rect.position.x;
|
||||
push_constant.dst_rect[1] = dst_rect.position.y;
|
||||
push_constant.dst_rect[2] = dst_rect.size.width;
|
||||
push_constant.dst_rect[3] = dst_rect.size.height;
|
||||
|
||||
RD::get_singleton()->draw_list_set_push_constant(p_draw_list, &push_constant, sizeof(PushConstant));
|
||||
RD::get_singleton()->draw_list_bind_index_array(p_draw_list, shader.quad_index_array);
|
||||
RD::get_singleton()->draw_list_draw(p_draw_list, true);
|
||||
|
||||
p_item->debug_redraw_time -= RSG::rasterizer->get_frame_delta_time();
|
||||
|
||||
RenderingServerDefault::redraw_request();
|
||||
}
|
||||
#endif
|
||||
if (current_clip && reclip) {
|
||||
//will make it re-enable clipping if needed afterwards
|
||||
current_clip = nullptr;
|
||||
@@ -2742,6 +2783,12 @@ void RendererCanvasRenderRD::set_shadow_texture_size(int p_size) {
|
||||
}
|
||||
}
|
||||
|
||||
void RendererCanvasRenderRD::set_debug_redraw(bool p_enabled, double p_time, const Color &p_color) {
|
||||
debug_redraw = p_enabled;
|
||||
debug_redraw_time = p_time;
|
||||
debug_redraw_color = p_color;
|
||||
}
|
||||
|
||||
RendererCanvasRenderRD::~RendererCanvasRenderRD() {
|
||||
RendererRD::MaterialStorage *material_storage = RendererRD::MaterialStorage::get_singleton();
|
||||
//canvas state
|
||||
|
||||
Reference in New Issue
Block a user