From 0aac14a53850aeccbfb08fd6ff582331ed6e8c76 Mon Sep 17 00:00:00 2001 From: Dario Date: Wed, 14 Feb 2024 11:32:31 -0300 Subject: [PATCH] Add validation to render graph for draw and compute lists. --- servers/rendering/rendering_device_graph.cpp | 12 ++++++++++++ servers/rendering/rendering_device_graph.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/servers/rendering/rendering_device_graph.cpp b/servers/rendering/rendering_device_graph.cpp index 83fb2d19182..3e4890e866c 100644 --- a/servers/rendering/rendering_device_graph.cpp +++ b/servers/rendering/rendering_device_graph.cpp @@ -1430,7 +1430,13 @@ void RenderingDeviceGraph::add_compute_list_usage(ResourceTracker *p_tracker, Re compute_instruction_list.command_trackers.push_back(p_tracker); compute_instruction_list.command_tracker_usages.push_back(p_usage); p_tracker->compute_list_index = compute_instruction_list.index; + p_tracker->compute_list_usage = p_usage; } +#ifdef DEV_ENABLED + else if (p_tracker->compute_list_usage != p_usage) { + ERR_FAIL_MSG(vformat("Tracker can't have more than one type of usage in the same compute list. Compute list usage is %d and the requested usage is %d.", p_tracker->compute_list_usage, p_usage)); + } +#endif } void RenderingDeviceGraph::add_compute_list_usages(VectorView p_trackers, VectorView p_usages) { @@ -1614,7 +1620,13 @@ void RenderingDeviceGraph::add_draw_list_usage(ResourceTracker *p_tracker, Resou draw_instruction_list.command_trackers.push_back(p_tracker); draw_instruction_list.command_tracker_usages.push_back(p_usage); p_tracker->draw_list_index = draw_instruction_list.index; + p_tracker->draw_list_usage = p_usage; } +#ifdef DEV_ENABLED + else if (p_tracker->draw_list_usage != p_usage) { + ERR_FAIL_MSG(vformat("Tracker can't have more than one type of usage in the same draw list. Draw list usage is %d and the requested usage is %d.", p_tracker->draw_list_usage, p_usage)); + } +#endif } void RenderingDeviceGraph::add_draw_list_usages(VectorView p_trackers, VectorView p_usages) { diff --git a/servers/rendering/rendering_device_graph.h b/servers/rendering/rendering_device_graph.h index 995fdb27d1b..9bb109ea0e2 100644 --- a/servers/rendering/rendering_device_graph.h +++ b/servers/rendering/rendering_device_graph.h @@ -155,7 +155,9 @@ public: int32_t read_slice_command_list_index = -1; int32_t write_command_or_list_index = -1; int32_t draw_list_index = -1; + ResourceUsage draw_list_usage = RESOURCE_USAGE_NONE; int32_t compute_list_index = -1; + ResourceUsage compute_list_usage = RESOURCE_USAGE_NONE; ResourceUsage usage = RESOURCE_USAGE_NONE; BitField usage_access; RDD::BufferID buffer_driver_id;