CopyConstantsFrom() public méthode

Copies the values of all constants (including auto constants) from another GpuProgramParameters object.
public CopyConstantsFrom ( GpuProgramParameters source ) : void
source GpuProgramParameters Set of params to use as the source.
Résultat void
        /// <summary>
        ///    Creates a new parameters object compatible with this program definition.
        /// </summary>
        /// <remarks>
        ///    Unlike low-level assembly programs, parameters objects are specific to the
        ///    program and therefore must be created from it rather than by the
        ///    HighLevelGpuProgramManager. This method creates a new instance of a parameters
        ///    object containing the definition of the parameters this program understands.
        /// </remarks>
        /// <returns>A new set of program parameters.</returns>
        public override GpuProgramParameters CreateParameters()
        {
            // create and load named parameters
            GpuProgramParameters newParams = GpuProgramManager.Instance.CreateParameters();

            // Only populate named parameters if we can support this program
            if (IsSupported)
            {
                LoadHighLevel();

                // Errors during load may have prevented compile
                if (IsSupported)
                {
                    PopulateParameterNames(newParams);
                }
            }

            // copy in default parameters if present
            if (defaultParams != null)
            {
                newParams.CopyConstantsFrom(defaultParams);
            }

            return(newParams);
        }
Exemple #2
0
        /// <summary>
        ///    Creates a new parameters object compatible with this program definition.
        /// </summary>
        /// <remarks>
        ///    It is recommended that you use this method of creating parameters objects
        ///    rather than going direct to GpuProgramManager, because this method will
        ///    populate any implementation-specific extras (like named parameters) where
        ///    they are appropriate.
        /// </remarks>
        /// <returns></returns>
        public virtual GpuProgramParameters CreateParameters()
        {
            GpuProgramParameters newParams = GpuProgramManager.Instance.CreateParameters();

            // copy the default parameters if they exist
            if (defaultParams != null)
            {
                newParams.CopyConstantsFrom(defaultParams);
            }

            return(newParams);
        }