EEVEE-Next: Add debug scopes
Allows selectively capturing section of the render process. More scopes can be added later.
This commit is contained in:
@@ -29,6 +29,10 @@
|
||||
|
||||
namespace blender::eevee {
|
||||
|
||||
void *Instance::debug_scope_render_sample = nullptr;
|
||||
void *Instance::debug_scope_irradiance_setup = nullptr;
|
||||
void *Instance::debug_scope_irradiance_sample = nullptr;
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Initialization
|
||||
*
|
||||
@@ -373,6 +377,8 @@ void Instance::render_sample()
|
||||
render_sync();
|
||||
}
|
||||
|
||||
DebugScope debug_scope(debug_scope_render_sample, "EEVEE.render_sample");
|
||||
|
||||
sampling.step();
|
||||
|
||||
capture_view.render_world();
|
||||
@@ -626,6 +632,8 @@ void Instance::light_bake_irradiance(
|
||||
render_sync();
|
||||
manager->end_sync();
|
||||
|
||||
DebugScope debug_scope(debug_scope_irradiance_setup, "EEVEE.irradiance_setup");
|
||||
|
||||
capture_view.render_world();
|
||||
|
||||
irradiance_cache.bake.surfels_create(probe);
|
||||
@@ -647,7 +655,8 @@ void Instance::light_bake_irradiance(
|
||||
sampling.init(probe);
|
||||
while (!sampling.finished()) {
|
||||
context_wrapper([&]() {
|
||||
GPU_debug_capture_begin();
|
||||
DebugScope debug_scope(debug_scope_irradiance_sample, "EEVEE.irradiance_sample");
|
||||
|
||||
/* Batch ray cast by pack of 16. Avoids too much overhead of the update function & context
|
||||
* switch. */
|
||||
/* TODO(fclem): Could make the number of iteration depend on the computation time. */
|
||||
@@ -675,7 +684,6 @@ void Instance::light_bake_irradiance(
|
||||
|
||||
float progress = sampling.sample_index() / float(sampling.sample_count());
|
||||
result_update(cache_frame, progress);
|
||||
GPU_debug_capture_end();
|
||||
});
|
||||
|
||||
if (stop()) {
|
||||
|
||||
@@ -67,6 +67,11 @@ class Instance {
|
||||
friend VelocityModule;
|
||||
friend MotionBlurModule;
|
||||
|
||||
/** Debug scopes. */
|
||||
static void *debug_scope_render_sample;
|
||||
static void *debug_scope_irradiance_setup;
|
||||
static void *debug_scope_irradiance_sample;
|
||||
|
||||
uint64_t depsgraph_last_update_ = 0;
|
||||
bool overlays_enabled_;
|
||||
|
||||
@@ -287,6 +292,24 @@ class Instance {
|
||||
void update_eval_members();
|
||||
|
||||
void set_time(float time);
|
||||
|
||||
struct DebugScope {
|
||||
void *scope;
|
||||
|
||||
DebugScope(void *&scope_p, const char *name)
|
||||
{
|
||||
if (scope_p == nullptr) {
|
||||
scope_p = GPU_debug_capture_scope_create(name);
|
||||
}
|
||||
scope = scope_p;
|
||||
GPU_debug_capture_scope_begin(scope);
|
||||
}
|
||||
|
||||
~DebugScope()
|
||||
{
|
||||
GPU_debug_capture_scope_end(scope);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace blender::eevee
|
||||
|
||||
Reference in New Issue
Block a user