public void AttachShader(ShaderViewModel shaderViewModel) { Debug.Assert( !shadersByStage.ContainsKey(shaderViewModel.Stage), "A shader for the " + shaderViewModel.Stage.ToString() + " stage is already attached to this program view model"); Program.AttachShader(shaderViewModel.Shader); shadersByStage.Add(shaderViewModel.Stage, shaderViewModel); AttachedShaders.Add(shaderViewModel); }
private static void attachShaderToProgram(ProgramViewModel program, ShaderViewModel shader) { var currentAttachedShader = program.GetShaderForStage(shader.Stage); if (currentAttachedShader.IsSome) { program.DetachShader(currentAttachedShader.Value); } program.AttachShader(shader); }
public void CloseShaderTab(ShaderViewModel shader) { OpenShaders.Remove(shader); }
public void AddShader(Shader shader) { GlContextManager.ShaderCompiler.AddShader(shader); var shaderViewModel = new ShaderViewModel(shader); shaderViewModelsByShader.Add(shader, shaderViewModel); Shaders.Add(shaderViewModel); }
public void DetachShader(ShaderViewModel shaderViewModel) { shaderViewModel.DetachFromProgram(Program); bool removed = shadersByStage.Remove(shaderViewModel.Stage); Debug.Assert( removed, "No shader is attached to the " + shaderViewModel.Stage + " stage of this program view model"); AttachedShaders.Remove(shaderViewModel); }