Ejemplo n.º 1
0
 internal void SetParameters(Axiom.Collections.NameValuePairList createParams)
 {
 }
Ejemplo n.º 2
0
		private void BindSubShaders( Program program, GpuProgram gpuProgram )
		{
			if ( program.DependencyCount > 0 )
			{
				// Get all attached shaders so we do not attach shaders twice.
				// maybe GLSLProgram should take care of that ( prevent add duplicate shaders )
				string attachedShaders = string.Empty; //TODO: gpuProgram.GetParameter("attach");
				string subSharedDef = string.Empty;

				for ( int i = 0; i < program.DependencyCount; i++ )
				{
					// Here we append _VS and _FS to the library shaders (so max each lib shader
					// is compiled twice once as vertex and once as fragment shader)

					string subShaderName = program.GetDependency( i );
					if ( program.Type == GpuProgramType.Vertex )
					{
						subShaderName += "_VS";
					}
					else
					{
						subShaderName += "_FS";
					}

					//Check if the library shader already compiled
					if ( !HighLevelGpuProgramManager.Instance.ResourceExists( subShaderName ) )
					{
						//Create the library shader
						HighLevelGpuProgram subGpuProgram =
							HighLevelGpuProgramManager.Instance.CreateProgram( subShaderName,
							                                                   ResourceGroupManager.
							                                                   	DefaultResourceGroupName,
							                                                   TargetLanguage, program.Type );

						//Set the source name
						string sourceName = program.GetDependency( i ) + "." + TargetLanguage;
						subGpuProgram.SourceFile = sourceName;

						//If we have compiler errors than stop processing
						if ( subGpuProgram.HasCompileError )
						{
							throw new AxiomException( "Could not compile shader library from the source file: " +
							                          sourceName );
						}

						this.libraryPrograms.Add( subShaderName );
					}

					//Check if the lib shader already attached to this shader
					if ( attachedShaders.Contains( subShaderName ) )
					{
						subSharedDef += subShaderName + " ";
					}
				}

				//Check if we have something to attach
				if ( subSharedDef.Length > 0 )
				{
					var nvpl = new Axiom.Collections.NameValuePairList();
					nvpl.Add( "attach", subSharedDef );
					gpuProgram.SetParameters( nvpl );
				}
			}
		}
Ejemplo n.º 3
0
        private void BindSubShaders(Program program, GpuProgram gpuProgram)
        {
            if (program.DependencyCount > 0)
            {
                // Get all attached shaders so we do not attach shaders twice.
                // maybe GLSLProgram should take care of that ( prevent add duplicate shaders )
                string attachedShaders = string.Empty; //TODO: gpuProgram.GetParameter("attach");
                string subSharedDef    = string.Empty;

                for (int i = 0; i < program.DependencyCount; i++)
                {
                    // Here we append _VS and _FS to the library shaders (so max each lib shader
                    // is compiled twice once as vertex and once as fragment shader)

                    string subShaderName = program.GetDependency(i);
                    if (program.Type == GpuProgramType.Vertex)
                    {
                        subShaderName += "_VS";
                    }
                    else
                    {
                        subShaderName += "_FS";
                    }

                    //Check if the library shader already compiled
                    if (!HighLevelGpuProgramManager.Instance.ResourceExists(subShaderName))
                    {
                        //Create the library shader
                        HighLevelGpuProgram subGpuProgram =
                            HighLevelGpuProgramManager.Instance.CreateProgram(subShaderName,
                                                                              ResourceGroupManager.
                                                                              DefaultResourceGroupName,
                                                                              TargetLanguage, program.Type);

                        //Set the source name
                        string sourceName = program.GetDependency(i) + "." + TargetLanguage;
                        subGpuProgram.SourceFile = sourceName;

                        //If we have compiler errors than stop processing
                        if (subGpuProgram.HasCompileError)
                        {
                            throw new AxiomException("Could not compile shader library from the source file: " +
                                                     sourceName);
                        }

                        this.libraryPrograms.Add(subShaderName);
                    }

                    //Check if the lib shader already attached to this shader
                    if (attachedShaders.Contains(subShaderName))
                    {
                        subSharedDef += subShaderName + " ";
                    }
                }

                //Check if we have something to attach
                if (subSharedDef.Length > 0)
                {
                    var nvpl = new Axiom.Collections.NameValuePairList();
                    nvpl.Add("attach", subSharedDef);
                    gpuProgram.SetParameters(nvpl);
                }
            }
        }
Ejemplo n.º 4
0
 protected override Resource _create(string name, ulong handle, string group, bool isManual, IManualResourceLoader loader, Axiom.Collections.NameValuePairList createParams)
 {
     return(new GLTexture(this, name, handle, group, isManual, loader, this._glSupport));
 }