Conversation
(cherry picked from commit 1045a8e)
| // Test for Descriptor changes | ||
| var descriptor = GetDescriptor(camera); | ||
| if(!descriptor.Equals(m_PreviousDescriptor)) | ||
| if(!DescriptorEquality(descriptor, m_PreviousDescriptor)) |
There was a problem hiding this comment.
This relied on default value type equality comparison which generates about 80 bytes per call
| m_identifier ??= $"Mirror {gameObject.GetInstanceID()}"; | ||
| // Profiling command | ||
| CommandBuffer cmd = CommandBufferPool.Get($"Mirror {gameObject.GetInstanceID()}"); | ||
| using (new ProfilingSample(cmd, $"Mirror {gameObject.GetInstanceID()}")) | ||
| CommandBuffer cmd = CommandBufferPool.Get(m_identifier); | ||
| using (new ProfilingSample(cmd, m_identifier)) |
There was a problem hiding this comment.
Identifier is a constant, string interpolation is never cached so might as well do it manually.
Something you might want to take a look at is the fact that pooled commandbuffers cannot be reused when profiling, perhaps related to this issue on the unity tracker - so right now the profiler will spit errors.
Deep profile works as expected though, not sure what's up with that.
We could always omit the command from the sample ?
| SetShaderUniforms(context, m_RenderTexture, cmd); | ||
| } | ||
| ExecuteCommand(context, cmd); | ||
| CommandBufferPool.Release(cmd); |
There was a problem hiding this comment.
Official logic from unity does release pooled commands, now I'm not very familiar with this so feel free to investigate further if you think that's not right
| void SetShaderUniforms(ScriptableRenderContext context, RenderTexture renderTexture, CommandBuffer cmd) | ||
| { | ||
| var block = new MaterialPropertyBlock(); | ||
| var block = renderers.Count == 0 ? null : new MaterialPropertyBlock(); |
There was a problem hiding this comment.
Blocks are not required when no renderers are there to feed them to, 'kind of ugly but I didn't want to significantly change your logic. Feel free to change into something less hacky.
No description provided.