|
|
@@ -1174,7 +1174,8 @@ extract_texture_data(Texture *tex, GraphicsStateGuardian *gsg) {
|
|
|
*/
|
|
|
void GraphicsEngine::
|
|
|
dispatch_compute(const LVecBase3i &work_groups, const ShaderAttrib *sattr, GraphicsStateGuardian *gsg) {
|
|
|
- nassertv(sattr->get_shader() != nullptr);
|
|
|
+ const Shader *shader = sattr->get_shader();
|
|
|
+ nassertv(shader != nullptr);
|
|
|
nassertv(gsg != nullptr);
|
|
|
|
|
|
ReMutexHolder holder(_lock);
|
|
|
@@ -1184,8 +1185,10 @@ dispatch_compute(const LVecBase3i &work_groups, const ShaderAttrib *sattr, Graph
|
|
|
string draw_name = gsg->get_threading_model().get_draw_name();
|
|
|
if (draw_name.empty()) {
|
|
|
// A single-threaded environment. No problem.
|
|
|
+ gsg->push_group_marker(std::string("Compute ") + shader->get_filename(Shader::ST_compute).get_basename());
|
|
|
gsg->set_state_and_transform(state, TransformState::make_identity());
|
|
|
gsg->dispatch_compute(work_groups[0], work_groups[1], work_groups[2]);
|
|
|
+ gsg->pop_group_marker();
|
|
|
|
|
|
} else {
|
|
|
// A multi-threaded environment. We have to wait until the draw thread
|
|
|
@@ -1434,7 +1437,9 @@ cull_and_draw_together(GraphicsEngine::Windows wlist,
|
|
|
if (win->is_any_clear_active()) {
|
|
|
GraphicsStateGuardian *gsg = win->get_gsg();
|
|
|
PStatGPUTimer timer(gsg, win->get_clear_window_pcollector(), current_thread);
|
|
|
+ gsg->push_group_marker("Clear");
|
|
|
win->clear(current_thread);
|
|
|
+ gsg->pop_group_marker();
|
|
|
}
|
|
|
|
|
|
int num_display_regions = win->get_num_active_display_regions();
|
|
|
@@ -1472,6 +1477,8 @@ cull_and_draw_together(GraphicsOutput *win, DisplayRegion *dr,
|
|
|
GraphicsStateGuardian *gsg = win->get_gsg();
|
|
|
nassertv(gsg != nullptr);
|
|
|
|
|
|
+ gsg->push_group_marker(dr->get_debug_name());
|
|
|
+
|
|
|
PT(SceneSetup) scene_setup;
|
|
|
|
|
|
{
|
|
|
@@ -1517,6 +1524,8 @@ cull_and_draw_together(GraphicsOutput *win, DisplayRegion *dr,
|
|
|
gsg->end_scene();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ gsg->pop_group_marker();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1658,7 +1667,9 @@ draw_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) {
|
|
|
PStatGPUTimer timer(gsg, win->get_draw_window_pcollector(), current_thread);
|
|
|
if (win->is_any_clear_active()) {
|
|
|
PStatGPUTimer timer(gsg, win->get_clear_window_pcollector(), current_thread);
|
|
|
+ win->get_gsg()->push_group_marker("Clear");
|
|
|
win->clear(current_thread);
|
|
|
+ win->get_gsg()->pop_group_marker();
|
|
|
}
|
|
|
|
|
|
if (display_cat.is_spam()) {
|
|
|
@@ -2008,6 +2019,8 @@ do_draw(GraphicsOutput *win, GraphicsStateGuardian *gsg, DisplayRegion *dr, Thre
|
|
|
// Statistics
|
|
|
PStatGPUTimer timer(gsg, dr->get_draw_region_pcollector(), current_thread);
|
|
|
|
|
|
+ gsg->push_group_marker(dr->get_debug_name());
|
|
|
+
|
|
|
PT(CullResult) cull_result;
|
|
|
PT(SceneSetup) scene_setup;
|
|
|
{
|
|
|
@@ -2043,11 +2056,7 @@ do_draw(GraphicsOutput *win, GraphicsStateGuardian *gsg, DisplayRegion *dr, Thre
|
|
|
// We don't trust the state the callback may have left us in.
|
|
|
gsg->clear_state_and_transform();
|
|
|
|
|
|
- // The callback has taken care of the drawing.
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (cull_result == nullptr || scene_setup == nullptr) {
|
|
|
+ } else if (cull_result == nullptr || scene_setup == nullptr) {
|
|
|
// Nothing to see here.
|
|
|
|
|
|
} else if (dr->is_stereo()) {
|
|
|
@@ -2068,6 +2077,8 @@ do_draw(GraphicsOutput *win, GraphicsStateGuardian *gsg, DisplayRegion *dr, Thre
|
|
|
gsg->end_scene();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ gsg->pop_group_marker();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -2677,8 +2688,14 @@ thread_main() {
|
|
|
|
|
|
case TS_do_compute:
|
|
|
nassertd(_gsg != nullptr && _state != nullptr) break;
|
|
|
- _gsg->set_state_and_transform(_state, TransformState::make_identity());
|
|
|
- _gsg->dispatch_compute(_work_groups[0], _work_groups[1], _work_groups[2]);
|
|
|
+ {
|
|
|
+ const ShaderAttrib *sattr;
|
|
|
+ _state->get_attrib(sattr);
|
|
|
+ _gsg->push_group_marker(std::string("Compute ") + sattr->get_shader()->get_filename(Shader::ST_compute).get_basename());
|
|
|
+ _gsg->set_state_and_transform(_state, TransformState::make_identity());
|
|
|
+ _gsg->dispatch_compute(_work_groups[0], _work_groups[1], _work_groups[2]);
|
|
|
+ _gsg->pop_group_marker();
|
|
|
+ }
|
|
|
break;
|
|
|
|
|
|
case TS_do_extract:
|