private void loadCloned(BasicShader baseShader) { ParentShader = baseShader; Effect = ParentShader.Effect.Clone(false); if (ParentShader.CurrentTechnique != null) { SetTechnique(ParentShader.CurrentTechnique.Description.Name); } }
public static BasicShader LoadAutoreload(IGraphicsManager graphics, FileInfo fi, Action <BasicShader> loadedDelegate, ShaderMacro[] macros) { var s = new BasicShader(graphics.Device); if (loadedDelegate != null) { s.loadedEvent += loadedDelegate; } s.shaderMacros = macros; s.loadAutoreload(fi); graphics.AddBasicShader(s); return(s); }
public BasicShader Clone() { if (IsClone) { throw new InvalidOperationException("Can't clone a cloned shader!"); } var clone = new BasicShader(device); clone.loadCloned(this); //Track clones clones.Add(clone); return(clone); }
public TestFilledGBuffer(DX11Game game, int width, int height) { this.game = game; GBuffer = new GBuffer(game.Device, width, height); var device = game.Device; var context = device.ImmediateContext; var diffuseTexture = Texture2D.FromFile(device, SlimDXDirectX11Test.Wallpaper001_png); diffuseTextureRv = new ShaderResourceView(device, diffuseTexture); shader = BasicShader.LoadAutoreload(game, new FileInfo(CompiledShaderCache.Current.RootShaderPath + "Deferred\\RenderGBuffer.fx")); shader.SetTechnique("Technique1"); box = new TestBox(device, shader.GetCurrentPass(0).Description.Signature); }