class collecting together the information for named constants.
예제 #1
0
 private void CreateNamedParameterMappingStructures(bool recreateIfExists)
 {
     if (recreateIfExists || this.constantDefs == null)
     {
         this.constantDefs = new GpuProgramParameters.GpuNamedConstants();
     }
 }
예제 #2
0
        public virtual GpuProgramParameters CreateParameters()
        {
            // Default implementation simply returns standard parameters.
            var ret = GpuProgramManager.Instance.CreateParameters();

            // optionally load manually supplied named constants
            if (!String.IsNullOrEmpty(this.manualNamedConstantsFile) && !this._loadedManualNamedConstants)
            {
                try
                {
                    var namedConstants = new GpuProgramParameters.GpuNamedConstants();
                    var stream         = ResourceGroupManager.Instance.OpenResource(this.manualNamedConstantsFile, Group, true, this);
                    namedConstants.Load(stream);
                    ManualNamedConstants = namedConstants;
                }
                catch (Exception ex)
                {
                    LogManager.Instance.Write("Unable to load manual named constants for GpuProgram {0} : {1}", Name,
                                              LogManager.BuildExceptionString(ex));
                }
                this._loadedManualNamedConstants = true;
            }

            // set up named parameters, if any
            if (this.constantDefs != null && this.constantDefs.Map.Count > 0)
            {
                ret.NamedConstants = this.constantDefs;
            }
            // link shared logical / physical map for low-level use
            ret.SetLogicalIndexes(this.floatLogicalToPhysical, this.intLogicalToPhysical);


            // Copy in default parameters if present
            if (this.defaultParams != null)
            {
                ret.CopyConstantsFrom(this.defaultParams);
            }

            return(ret);
        }
예제 #3
0
		private void CreateNamedParameterMappingStructures( bool recreateIfExists )
		{
			if ( recreateIfExists || this.constantDefs == null )
			{
				this.constantDefs = new GpuProgramParameters.GpuNamedConstants();
			}
		}
예제 #4
0
		public virtual GpuProgramParameters CreateParameters()
		{
			// Default implementation simply returns standard parameters.
			var ret = GpuProgramManager.Instance.CreateParameters();

			// optionally load manually supplied named constants
			if ( !String.IsNullOrEmpty( this.manualNamedConstantsFile ) && !this._loadedManualNamedConstants )
			{
				try
				{
					var namedConstants = new GpuProgramParameters.GpuNamedConstants();
					var stream = ResourceGroupManager.Instance.OpenResource( this.manualNamedConstantsFile, Group, true, this );
					namedConstants.Load( stream );
					ManualNamedConstants = namedConstants;
				}
				catch ( Exception ex )
				{
					LogManager.Instance.Write( "Unable to load manual named constants for GpuProgram {0} : {1}", Name,
					                           LogManager.BuildExceptionString( ex ) );
				}
				this._loadedManualNamedConstants = true;
			}

			// set up named parameters, if any
			if ( this.constantDefs != null && this.constantDefs.Map.Count > 0 )
			{
				ret.NamedConstants = this.constantDefs;
			}
			// link shared logical / physical map for low-level use
			ret.SetLogicalIndexes( this.floatLogicalToPhysical, this.intLogicalToPhysical );


			// Copy in default parameters if present
			if ( this.defaultParams != null )
			{
				ret.CopyConstantsFrom( this.defaultParams );
			}

			return ret;
		}