public void Apply(CommonShaderStage stage) { standardSamplers.Apply(stage); stage.SetConstantBuffer(ShaderSlots.EnvironmentParameters, constantBufferManager.Buffer); stage.SetShaderResource(ShaderSlots.DiffuseEnvironmentCube, diffuseEnvironmentCube); stage.SetShaderResource(ShaderSlots.GlossyEnvironmentCube, glossyEnvironmentCube); }
private void SetConstantBuffer(CommonShaderStage stage, ShaderStageCache cache, int slot, Buffer buffer) { if (cache.Buffers[slot] != buffer) { stage.SetConstantBuffer(slot, buffer); cache.Buffers[slot] = buffer; } }
/// <summary> /// Sets and gets sampler state to given shader stage. /// </summary> /// <param name="index"></param> /// <returns></returns> public ConstantBuffer this[int index] { set { buffers[index] = value; stage.SetConstantBuffer(index, (value == null) ? null : value.buffer); } get { return(buffers[index]); } }
protected void Update() { DataStream dataStream; _deviceContext.MapSubresource(_buffer, MapMode.WriteDiscard, MapFlags.None, out dataStream); dataStream.Write(_data); _deviceContext.UnmapSubresource(_buffer, _subresource); _commonShaderStage.SetConstantBuffer(_slot, _buffer); }
internal void SetConstantBuffer(int slot, Buffer constantBuffer) { if (constantBuffer == m_constantBuffers[slot]) { return; } m_constantBuffers[slot] = constantBuffer; m_shaderStage.SetConstantBuffer(slot, constantBuffer); m_statistics.SetConstantBuffers++; }
internal void SetConstantBuffer(int slot, IConstantBuffer constantBuffer) { Buffer buffer = null; if (constantBuffer != null) { buffer = constantBuffer.Buffer; } if (constantBuffer == m_constantBuffers[slot]) { return; } m_constantBuffers[slot] = constantBuffer; m_shaderStage.SetConstantBuffer(slot, buffer); m_statistics.SetConstantBuffers++; }
public static void SetConstantBufferToNextSlot(this CommonShaderStage shader, SharpDX.Direct3D11.Buffer constantBuffer, ConstantBufferSlotsCache cache) { var slot = cache.GetNext(); shader.SetConstantBuffer(slot, constantBuffer); }
public static void SetConstantBuffer(this CommonShaderStage shader, int slot, SharpDX.Direct3D11.Buffer constantBuffer, ConstantBufferSlotsCache cache) { cache.SetOccupied(slot); shader.SetConstantBuffer(slot, constantBuffer); }
public void RegisterConstantBuffer(CommonShaderStage stage, int slot, SharpDX.Direct3D11.Buffer buff) { stage.SetConstantBuffer(slot, buff); resourseHash.RegisterResourseSlot(stage.GetHashCode(), slot); }