/// <summary>
		/// 
		/// </summary>
		/// <param name="syntaxCode"></param>
		/// <param name="createFn"></param>
		/// <returns></returns>
		public bool RegisterProgramFactory( string syntaxCode, CreateGpuProgramDelegate createFn )
		{
			if ( !_programMap.ContainsKey( syntaxCode ) )
			{
				_programMap.Add( syntaxCode, createFn );
				return true;
			}
			return false;
		}
Beispiel #2
0
 /// <summary>
 /// </summary>
 /// <param name="syntaxCode"> </param>
 /// <param name="createFn"> </param>
 /// <returns> </returns>
 public bool RegisterProgramFactory(string syntaxCode, CreateGpuProgramDelegate createFn)
 {
     if (!this._programMap.ContainsKey(syntaxCode))
     {
         this._programMap.Add(syntaxCode, createFn);
         return(true);
     }
     return(false);
 }
        protected override Resource _create(string name, ulong handle, string group, bool isManual, IManualResourceLoader loader, GpuProgramType type, string syntaxCode)
        {
            CreateGpuProgramDelegate iter = null;

            if (this._programMap.ContainsKey(syntaxCode) == false)
            {
                //No factory, this is an unsupported syntax code, probably for another rendersystem
                //Create a basic one, it doens't matter what it is since it won't be used
                return(new GLES2GpuProgram(this, name, handle, group, isManual, loader));
            }
            else
            {
                iter = this._programMap[syntaxCode];
            }
            return(iter(this, name, handle, group, isManual, loader, type, syntaxCode));
        }
        protected override Resource _create(string name, ulong handle, string group, bool isManual, IManualResourceLoader loader, Collections.NameValuePairList createParams)
        {
            string paramSyntax = string.Empty;
            string paramType   = string.Empty;

            if (createParams == null || createParams.ContainsKey("syntax") == false || createParams.ContainsKey("type") == false)
            {
                throw new AxiomException("You must supply 'syntax' and 'type' parameters");
            }
            else
            {
                paramSyntax = createParams["syntax"];
                paramType   = createParams["type"];
            }
            CreateGpuProgramDelegate iter = null;

            if (this._programMap.ContainsKey(paramSyntax))
            {
                iter = this._programMap[paramSyntax];
            }
            else
            {
                // No factory, this is an unsupported syntax code, probably for another rendersystem
                // Create a basic one, it doesn't matter what it is since it won't be used
                return(new GLES2GpuProgram(this, name, handle, group, isManual, loader));
            }
            GpuProgramType gpt;

            if (paramType == "vertex_program")
            {
                gpt = GpuProgramType.Vertex;
            }
            else
            {
                gpt = GpuProgramType.Fragment;
            }

            return(iter(this, name, handle, group, isManual, loader, gpt, paramSyntax));
        }
Beispiel #5
0
        /// <summary>
        /// </summary>
        /// <param name="name"> </param>
        /// <param name="handle"> </param>
        /// <param name="group"> </param>
        /// <param name="isManual"> </param>
        /// <param name="loader"> </param>
        /// <param name="createParams"> </param>
        /// <returns> </returns>
        protected override Resource _create(string name, ulong handle, string group, bool isManual, IManualResourceLoader loader, Collections.NameValuePairList createParams)
        {
            if (createParams == null || !createParams.ContainsKey("syntax") || !createParams.ContainsKey("type"))
            {
                throw new NotImplementedException("You must supply 'syntax' and 'type' parameters");
            }

            GpuProgramType           gpt  = 0;
            CreateGpuProgramDelegate iter = this._programMap[createParams["syntax"]];

            if (iter == null)
            {
                return(null);
            }
            string syntaxcode = string.Empty;

            foreach (var pair in this._programMap)
            {
                if (pair.Value == iter)
                {
                    syntaxcode = pair.Key;
                    break;
                }
            }
            if (createParams["type"] == "vertex_program")
            {
                gpt = GpuProgramType.Vertex;
            }
            else if (createParams["type"] == "fragment_program")
            {
                gpt = GpuProgramType.Fragment;
            }
            else
            {
                throw new AxiomException("Unknown GpuProgramType : " + createParams["type"]);
            }
            return(iter(this, name, handle, group, isManual, loader, gpt, syntaxcode));
        }
		public bool RegisterProgramFactory( string syntaxCode, CreateGpuProgramDelegate createFN )
		{
			if ( this._programMap.ContainsKey( syntaxCode ) == false )
			{
				this._programMap.Add( syntaxCode, createFN );
				return true;
			}
			else
			{
				return false;
			}
		}