protected void GetDefaultDrawSettings(ref RenderingData renderingData, Material material, out DrawingSettings drawingSettings, out FilteringSettings filteringSettings, out RenderStateBlock renderStateBlock)
        {
            base.GetDefaultDrawSettings(renderingData.cameraData.camera, material, out drawingSettings, out filteringSettings);
            drawingSettings.enableDynamicBatching = renderingData.supportsDynamicBatching;
            drawingSettings.perObjectData         = perObjectData;

            renderStateBlock = new RenderStateBlock();
            if (useStencilTest)
            {
                int stencilMask = StencilMaskAllocator.GetTemporaryBit();
                if (stencilMask != 0)
                {
                    renderStateBlock.mask             = RenderStateMask.Stencil;
                    renderStateBlock.stencilReference = stencilMask;
                    renderStateBlock.stencilState     = new StencilState(true, (byte)stencilMask, (byte)stencilMask, CompareFunction.Equal, StencilOp.Zero, StencilOp.Keep, StencilOp.Keep);
                }
            }
        }
        protected void WriteFrustumStencil(ScriptableRenderContext context)
        {
            int stencilMask = StencilMaskAllocator.GetTemporaryBit();

            if (stencilMask == 0)
            {
                return;
            }
            if (m_stencilProperties == null)
            {
                m_stencilProperties = new MaterialPropertyBlock();
            }
            m_stencilProperties.SetFloat(s_shaderPropIdStencilRef, stencilMask);
            m_stencilProperties.SetFloat(s_shaderPropIdStencilMask, stencilMask);
            if (m_stencilPassCommands == null)
            {
                m_stencilPassCommands = new CommandBuffer();
            }
            m_stencilPassCommands.Clear();
            m_stencilPassCommands.DrawMesh(m_meshFrustum, transform.localToWorldMatrix, stencilPassMaterial, 0, 0, m_stencilProperties);
            m_stencilPassCommands.DrawMesh(m_meshFrustum, transform.localToWorldMatrix, stencilPassMaterial, 0, 1, m_stencilProperties);
            context.ExecuteCommandBuffer(m_stencilPassCommands);
        }