Esempio n. 1
0
            public bool CanCombine(Batch lhs, Batch rhs)
            {
                if ((lhs == null) || (rhs == null))
                {
                    return(false);
                }

                BitmapBatch bblhs = lhs as BitmapBatch, bbrhs = rhs as BitmapBatch;

                if ((bblhs == null) || (bbrhs == null))
                {
                    return(false);
                }

                if (bblhs.IsReusable || bbrhs.IsReusable)
                {
                    return(false);
                }

                if (bblhs.Material.MaterialID != bbrhs.Material.MaterialID)
                {
                    return(false);
                }

                if (bblhs.Layer != bbrhs.Layer)
                {
                    return(false);
                }

                if (bblhs.UseZBuffer != bbrhs.UseZBuffer)
                {
                    return(false);
                }

                if (bblhs.SamplerState != bbrhs.SamplerState)
                {
                    return(false);
                }

                if (bblhs.SamplerState2 != bbrhs.SamplerState2)
                {
                    return(false);
                }

                if (!bblhs.ReleaseAfterDraw)
                {
                    return(false);
                }

                if (!bbrhs.ReleaseAfterDraw)
                {
                    return(false);
                }

                return(true);
            }
Esempio n. 2
0
            public bool CanCombine(Batch lhs, Batch rhs)
            {
                // Combining large batches could be counter-productive
                const int combineThreshold = 2048;

                if ((lhs == null) || (rhs == null))
                {
                    return(false);
                }

                BitmapBatch bblhs = lhs as BitmapBatch, bbrhs = rhs as BitmapBatch;

                if ((bblhs == null) || (bbrhs == null))
                {
                    return(false);
                }

                if (bblhs.IsReusable || bbrhs.IsReusable)
                {
                    return(false);
                }

                if (bblhs.Material.MaterialID != bbrhs.Material.MaterialID)
                {
                    return(false);
                }

                if (bblhs.Layer != bbrhs.Layer)
                {
                    return(false);
                }

                if (bblhs.UseZBuffer != bbrhs.UseZBuffer)
                {
                    return(false);
                }

                if (bblhs.ZBufferOnlySorting != bbrhs.ZBufferOnlySorting)
                {
                    return(false);
                }

                if (bblhs.TwoPassDraw != bbrhs.TwoPassDraw)
                {
                    return(false);
                }

                if (bblhs.DepthPrePassOnly != bbrhs.DepthPrePassOnly)
                {
                    return(false);
                }

                if (bblhs.SamplerState != bbrhs.SamplerState)
                {
                    return(false);
                }

                if (bblhs.SamplerState2 != bbrhs.SamplerState2)
                {
                    return(false);
                }

                if (!bblhs.ReleaseAfterDraw)
                {
                    return(false);
                }

                if (!bbrhs.ReleaseAfterDraw)
                {
                    return(false);
                }

                if ((bblhs.Count > combineThreshold) || (bbrhs.Count > combineThreshold))
                {
                    return(false);
                }

                if (!bblhs.MaterialParameters.Equals(bbrhs.MaterialParameters))
                {
                    return(false);
                }

                return(true);
            }