private void SetSampler(CommonShaderStage stage, ShaderStageCache cache, int slot, SamplerState sampler) { if (cache.Samplers[slot] != sampler) { stage.SetSampler(slot, sampler); cache.Samplers[slot] = sampler; } }
private void SetConstantBuffer(CommonShaderStage stage, ShaderStageCache cache, int slot, Buffer buffer) { if (cache.Buffers[slot] != buffer) { stage.SetConstantBuffer(slot, buffer); cache.Buffers[slot] = buffer; } }
private void SetTexture(CommonShaderStage stage, ShaderStageCache cache, int slot, ShaderResourceView view) { if (cache.Views[slot] != view) { // um Ressourcen Hazards zu vermeiden (Read und Write gleichzeitig) werden die RTs schon beim Setzen von Texturen neu gesetzt ApplyRenderTargets(); stage.SetShaderResource(slot, view); cache.Views[slot] = view; } }
public RenderContext(GraphicsDevice graphicsDevice, DeviceContext context) : base(graphicsDevice, new StackTrace(1)) { if (context == null) { throw new ArgumentNullException("context"); } this.Context = context; vertexCache = new ShaderStageCache(null); pixelCache = new ShaderStageCache(null); UpdateContext = new RenderUpdateContext(graphicsDevice, this); }