void OnDisable()
 {
     if (_DecalCulling != null)
     {
         _DecalCulling.Dispose();
         _DecalCulling.onStateChanged -= OnDecalCullingChanged;
         _DecalCulling = null;
     }
     if (_ClusterPrepass != null)
     {
         _ClusterPrepass.Release();
         _ClusterPrepass = null;
     }
     if (_DecalsRenderer != null)
     {
         _DecalsRenderer.Release();
         _DecalsRenderer = null;
     }
     _BufferCache.Release();
 }
        void OnEnable()
        {
            _SupportsComputeShaders = SystemInfo.supportsComputeShaders;
            _Camera = GetComponent <Camera>();

            _DecalSphereCache = new BoundingSphere[_MAX_ADDITIVE_DECAL_COUNT];
            //_VisibleDecalIndex = new int[_MAX_ADDITIVE_DECAL_COUNT];
            _DecalCulling = new CullingGroup();
            _DecalCulling.targetCamera = _Camera;
            _DecalCulling.SetBoundingSpheres(_DecalSphereCache);
            _DecalCulling.SetBoundingSphereCount(0);
            _DecalCulling.onStateChanged += OnDecalCullingChanged;
            _VisibleDecalIndexCahce.Clear();

            _ClusterPrepass = new ClusterPrepass {
                rendererFeatures = this
            };
            _ClusterPrepass.Initialize();
            _DecalsRenderer = new DecalsRendererPass {
                rendererFeatures = this
            };
            _DecalsRenderer.Initialize();
        }