Exemple #1
0
        /// <summary>
        /// Interns the specified state.
        /// </summary>
        /// <param name="state">The state.</param>
        /// <returns>Interned state; this state is shared and cannot be disposed.</returns>
        public static BlendState Intern(BlendState state)
        {
            // No checks for interned state.
            if (state.IsInterned)
            {
                return(state);
            }

            lock (syncRoot)
            {
                BlendState internedPart = blendStateHash.IsInterned(state);

                if (internedPart == null)
                {
                    state.Intern();
                    blendStateHash.Add(state);
                    return(state);
                }

                return(internedPart);
            }
        }