Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2018-11-29 04:06:30 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2018-11-29 04:45:24 +0300
commit7fa6f72084b1364cddfbef4f06bbb244210d6967 (patch)
treeae4f682248bd5ba4f716ff60c6dbd67c5684b3d2 /intern/cycles/kernel/kernel_path.h
parentfb057153b05555606d801d1e942113d40ec15cec (diff)
Cycles: Add sample-based runtime profiler that measures time spent in various parts of the CPU kernel
This commit adds a sample-based profiler that runs during CPU rendering and collects statistics on time spent in different parts of the kernel (ray intersection, shader evaluation etc.) as well as time spent per material and object. The results are currently not exposed in the user interface or per Python yet, to see the stats on the console pass the "--cycles-print-stats" argument to Cycles (e.g. "./blender -- --cycles-print-stats"). Unfortunately, there is no clear way to extend this functionality to CUDA or OpenCL, so it is CPU-only for now. Reviewers: brecht, sergey, swerner Reviewed By: brecht, swerner Differential Revision: https://developer.blender.org/D3892
Diffstat (limited to 'intern/cycles/kernel/kernel_path.h')
-rw-r--r--intern/cycles/kernel/kernel_path.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index cb1f410b09f..a1fc6028293 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -57,6 +57,8 @@ ccl_device_forceinline bool kernel_path_scene_intersect(
Intersection *isect,
PathRadiance *L)
{
+ PROFILING_INIT(kg, PROFILING_SCENE_INTERSECT);
+
uint visibility = path_state_ray_visibility(kg, state);
if(path_state_ao_bounce(kg, state)) {
@@ -105,6 +107,8 @@ ccl_device_forceinline void kernel_path_lamp_emission(
ShaderData *emission_sd,
PathRadiance *L)
{
+ PROFILING_INIT(kg, PROFILING_INDIRECT_EMISSION);
+
#ifdef __LAMP_MIS__
if(kernel_data.integrator.use_lamp_mis && !(state->flag & PATH_RAY_CAMERA)) {
/* ray starting from previous non-transparent bounce */
@@ -172,6 +176,8 @@ ccl_device_forceinline VolumeIntegrateResult kernel_path_volume(
ShaderData *emission_sd,
PathRadiance *L)
{
+ PROFILING_INIT(kg, PROFILING_VOLUME);
+
/* Sanitize volume stack. */
if(!hit) {
kernel_volume_clean_stack(kg, state->volume_stack);
@@ -278,6 +284,8 @@ ccl_device_forceinline bool kernel_path_shader_apply(
PathRadiance *L,
ccl_global float *buffer)
{
+ PROFILING_INIT(kg, PROFILING_SHADER_APPLY);
+
#ifdef __SHADOW_TRICKS__
if((sd->object_flag & SD_OBJECT_SHADOW_CATCHER)) {
if(state->flag & PATH_RAY_TRANSPARENT_BACKGROUND) {
@@ -355,6 +363,8 @@ ccl_device_noinline void kernel_path_ao(KernelGlobals *kg,
float3 throughput,
float3 ao_alpha)
{
+ PROFILING_INIT(kg, PROFILING_AO);
+
/* todo: solve correlation */
float bsdf_u, bsdf_v;
@@ -568,6 +578,8 @@ ccl_device_forceinline void kernel_path_integrate(
ccl_global float *buffer,
ShaderData *emission_sd)
{
+ PROFILING_INIT(kg, PROFILING_PATH_INTEGRATE);
+
/* Shader data memory used for both volumes and surfaces, saves stack space. */
ShaderData sd;
@@ -719,6 +731,8 @@ ccl_device void kernel_path_trace(KernelGlobals *kg,
ccl_global float *buffer,
int sample, int x, int y, int offset, int stride)
{
+ PROFILING_INIT(kg, PROFILING_RAY_SETUP);
+
/* buffer offset */
int index = offset + x + y*stride;
int pass_stride = kernel_data.film.pass_stride;