Ejemplo n.º 1
0
        /// <summary>
        /// Interns the specified state.
        /// </summary>
        /// <param name="state">The state.</param>
        /// <returns></returns>
        public static SamplerState Intern(SamplerState state)
        {
            // No checks for interned state.
            if (state.IsInterned)
            {
                return(state);
            }

            lock (syncRoot)
            {
                SamplerState internedPart = samplerStateHash.IsInterned(state);

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

                return(internedPart);
            }
        }