Compositor: Add GPU debug groups
This PR adds debug groups to improve using GPU tools like debuggers and profilers. It will try to use the node type as debug group name when available. Pull Request: https://projects.blender.org/blender/blender/pulls/138768
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "GPU_debug.hh"
|
||||
|
||||
#include "COM_algorithm_compute_preview.hh"
|
||||
#include "COM_context.hh"
|
||||
#include "COM_input_descriptor.hh"
|
||||
@@ -48,12 +50,18 @@ NodeOperation::NodeOperation(Context &context, DNode node) : Operation(context),
|
||||
|
||||
void NodeOperation::evaluate()
|
||||
{
|
||||
if (context().use_gpu()) {
|
||||
GPU_debug_group_begin(node().bnode()->typeinfo->idname.c_str());
|
||||
}
|
||||
const timeit::TimePoint before_time = timeit::Clock::now();
|
||||
Operation::evaluate();
|
||||
const timeit::TimePoint after_time = timeit::Clock::now();
|
||||
if (context().profiler()) {
|
||||
context().profiler()->set_node_evaluation_time(node_.instance_key(), after_time - before_time);
|
||||
}
|
||||
if (context().use_gpu()) {
|
||||
GPU_debug_group_end();
|
||||
}
|
||||
}
|
||||
|
||||
void NodeOperation::compute_preview()
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "DNA_customdata_types.h"
|
||||
|
||||
#include "GPU_context.hh"
|
||||
#include "GPU_debug.hh"
|
||||
#include "GPU_material.hh"
|
||||
#include "GPU_shader.hh"
|
||||
#include "GPU_texture.hh"
|
||||
@@ -54,6 +55,7 @@ ShaderOperation::~ShaderOperation()
|
||||
|
||||
void ShaderOperation::execute()
|
||||
{
|
||||
GPU_debug_group_begin("ShaderOperation");
|
||||
const Domain domain = compute_domain();
|
||||
for (StringRef identifier : output_sockets_to_output_identifiers_map_.values()) {
|
||||
Result &result = get_result(identifier);
|
||||
@@ -73,6 +75,7 @@ void ShaderOperation::execute()
|
||||
GPU_texture_image_unbind_all();
|
||||
GPU_uniformbuf_debug_unbind_all();
|
||||
GPU_shader_unbind();
|
||||
GPU_debug_group_end();
|
||||
}
|
||||
|
||||
void ShaderOperation::bind_material_resources(GPUShader *shader)
|
||||
|
||||
Reference in New Issue
Block a user