internal void ReleasePrograms(Graphics.Pass pass, TargetRenderState renderState) { ProgramSet programSet = renderState.ProgramSet; pass.SetVertexProgram(string.Empty); pass.SetFragmentProgram(string.Empty); renderState.DestroyProgramSet(); foreach (var key in this.vertexShaderMap.Keys) { if (true) //TODO { DestroyGpuProgram(this.vertexShaderMap[key]); this.vertexShaderMap.Remove(key); break; } } foreach (var key in this.fragmentShaderMap.Keys) { if (true) { DestroyGpuProgram(this.fragmentShaderMap[key]); this.fragmentShaderMap.Remove(key); break; } } }
internal void AcquirePrograms(Graphics.Pass pass, TargetRenderState renderState) { //Create the CPU programs if (!renderState.CreateCpuPrograms()) { throw new Core.AxiomException("Could not apply render state "); } ProgramSet programSet = renderState.ProgramSet; //Create the GPU programs if (!CreateGpuPrograms(programSet)) { throw new Core.AxiomException("Could not create gpu program from render state "); } //bind the created gpu programs to the target pass pass.SetVertexProgram(programSet.GpuVertexProgram.Name); pass.SetFragmentProgram(programSet.GpuFragmentProgram.Name); //Bind uniform parameters to pass parameters BindUniformParameters(programSet.CpuVertexProgram, pass.VertexProgramParameters); BindUniformParameters(programSet.CpuFragmentProgram, pass.FragmentProgramParameters); }