Esempio n. 1
0
        /// <summary>
        /// Adds a previously-constructed batch to a new frame/container.
        /// Use this if you already created a batch in a previous frame and wish to use it again.
        /// </summary>
        public void Reuse(IBatchContainer newContainer, int?newLayer = null)
        {
            lock (State) {
                if (Released)
                {
                    throw new ObjectDisposedException("batch");
                }
                else if (State.IsCombined)
                {
                    throw new InvalidOperationException("Batch was combined into another batch");
                }

                if (newLayer.HasValue)
                {
                    Layer = newLayer.Value;
                }

                if (!State.IsInitialized)
                {
                    throw new Exception("Not initialized");
                }

                if (State.IsPrepareQueued)
                {
                    throw new Exception("Batch currently queued for prepare");
                }

                State.IsPrepared = State.IsIssued = false;
            }

            newContainer.Add(this);
        }
Esempio n. 2
0
        protected void Initialize(IBatchContainer container, int layer, Material material, bool addToContainer)
        {
            if (State.IsPrepareQueued)
            {
                throw new Exception("Batch currently queued for prepare");
            }

            if ((material != null) && (material.IsDisposed))
            {
                throw new ObjectDisposedException("material");
            }

            StackTrace = null;
            if (BatchesCombinedIntoThisOne != null)
            {
                BatchesCombinedIntoThisOne.Clear();
            }
            Released         = false;
            ReleaseAfterDraw = false;
            Layer            = layer;
            Material         = material;

            Index = Interlocked.Increment(ref _BatchCount);

            lock (State) {
                State.IsCombined    = false;
                State.IsInitialized = true;
                State.IsPrepared    = State.IsPrepareQueued = State.IsIssued = false;
            }

            if (addToContainer)
            {
                container.Add(this);
            }
        }
Esempio n. 3
0
        public static void Marker(IBatchContainer container, int layer, string name)
        {
            if (!EnableTracing)
            {
                return;
            }

            var batch = new MarkerBatch(layer, name);

            container.Add(batch);
        }
Esempio n. 4
0
        /// <summary>
        /// Adds a previously-constructed batch to a new frame/container.
        /// Use this if you already created a batch in a previous frame and wish to use it again.
        /// </summary>
        public void Reuse(IBatchContainer newContainer, int?newLayer = null)
        {
            if (Released)
            {
                throw new ObjectDisposedException("batch");
            }
            else if (IsCombined)
            {
                throw new InvalidOperationException("Batch was combined into another batch");
            }

            if (newLayer.HasValue)
            {
                Layer = newLayer.Value;
            }

            newContainer.Add(this);
        }
Esempio n. 5
0
        protected void Initialize(IBatchContainer container, int layer, Material material)
        {
            if ((material != null) && (material.IsDisposed))
            {
                throw new ObjectDisposedException("material");
            }

            StackTrace       = null;
            Released         = false;
            ReleaseAfterDraw = false;
            Layer            = layer;
            Material         = material;
            IsCombined       = false;

            Index = Interlocked.Increment(ref _BatchCount);

            container.Add(this);
        }
Esempio n. 6
0
        public static void Marker(IBatchContainer container, int layer, string name)
        {
            if (!EnableTracing)
                return;

            var batch = new MarkerBatch(layer, name);
            container.Add(batch);
        }