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

            lock (syncRoot)
            {
                DepthStencilState internedPart = depthStencilStateHash.IsInterned(state);

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

                return(internedPart);
            }
        }