Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add draw and dispatch count to timestamp validation. #91530

Merged
merged 1 commit into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions servers/rendering/rendering_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3858,6 +3858,8 @@ void RenderingDevice::draw_list_draw(DrawListID p_list, bool p_use_indices, uint

draw_graph.add_draw_list_draw(to_draw, p_instances);
}

dl->state.draw_count++;
}

void RenderingDevice::draw_list_enable_scissor(DrawListID p_list, const Rect2 &p_rect) {
Expand Down Expand Up @@ -4201,6 +4203,7 @@ void RenderingDevice::compute_list_dispatch(ComputeListID p_list, uint32_t p_x_g
}

draw_graph.add_compute_list_dispatch(p_x_groups, p_y_groups, p_z_groups);
cl->state.dispatch_count++;
}

void RenderingDevice::compute_list_dispatch_threads(ComputeListID p_list, uint32_t p_x_threads, uint32_t p_y_threads, uint32_t p_z_threads) {
Expand Down Expand Up @@ -4294,6 +4297,7 @@ void RenderingDevice::compute_list_dispatch_indirect(ComputeListID p_list, RID p
}

draw_graph.add_compute_list_dispatch_indirect(buffer->driver_id, p_offset);
cl->state.dispatch_count++;

if (buffer->draw_tracker != nullptr) {
draw_graph.add_compute_list_usage(buffer->draw_tracker, RDG::RESOURCE_USAGE_INDIRECT_BUFFER_READ);
Expand Down Expand Up @@ -5206,8 +5210,8 @@ void RenderingDevice::_free_rids(T &p_owner, const char *p_type) {
}

void RenderingDevice::capture_timestamp(const String &p_name) {
ERR_FAIL_COND_MSG(draw_list != nullptr, "Capturing timestamps during draw list creation is not allowed. Offending timestamp was: " + p_name);
ERR_FAIL_COND_MSG(compute_list != nullptr, "Capturing timestamps during compute list creation is not allowed. Offending timestamp was: " + p_name);
ERR_FAIL_COND_MSG(draw_list != nullptr && draw_list->state.draw_count > 0, "Capturing timestamps during draw list creation is not allowed. Offending timestamp was: " + p_name);
ERR_FAIL_COND_MSG(compute_list != nullptr && compute_list->state.dispatch_count > 0, "Capturing timestamps during compute list creation is not allowed. Offending timestamp was: " + p_name);
ERR_FAIL_COND(frames[frame].timestamp_count >= max_timestamp_query_elements);

draw_graph.add_capture_timestamp(frames[frame].timestamp_pool, frames[frame].timestamp_count);
Expand Down
2 changes: 2 additions & 0 deletions servers/rendering/rendering_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ class RenderingDevice : public RenderingDeviceCommons {
uint32_t pipeline_shader_layout_hash = 0;
RID vertex_array;
RID index_array;
uint32_t draw_count = 0;
} state;

#ifdef DEBUG_ENABLED
Expand Down Expand Up @@ -1147,6 +1148,7 @@ class RenderingDevice : public RenderingDeviceCommons {
uint32_t local_group_size[3] = { 0, 0, 0 };
uint8_t push_constant_data[MAX_PUSH_CONSTANT_SIZE] = {};
uint32_t push_constant_size = 0;
uint32_t dispatch_count = 0;
} state;

#ifdef DEBUG_ENABLED
Expand Down
Loading