Looooong / Unity-SRP-VXGI

Voxel-based Global Illumination using Unity Scriptable Render Pipeline
MIT License
766 stars 62 forks source link

Refactor profile sampling #40

Closed Looooong closed 4 years ago

Looooong commented 4 years ago

I find out the weird behaviour of profiler sampling using CommandBuffer (Unity 2018):

CommandBuffer command = new CommandBuffer { name = "Command Name" };
ScriptableRenderContext context;

// Works
command.BeginSample("Something");
command.EndSample("Something");
context.ExecuteCommandBuffer(command);

// Fails
command.BeginSample("Something");
context.ExecuteCommandBuffer(command);
command.Clear();
command.EndSample("Something");
context.ExecuteCommandBuffer(command);

// Works
command.BeginSample(command.name);
context.ExecuteCommandBuffer(command);
command.Clear();
command.EndSample(command.name);
context.ExecuteCommandBuffer(command);