public void SetConstant(ShaderType usage, int slot, AbstractConstantBuffer pipelineConstant) { if (usage.HasFlag(ShaderType.Vertex)) { _vsConstants[slot] = pipelineConstant; if (_isBound) { ApplyVSConstantBuffer(slot, pipelineConstant); } } if (usage.HasFlag(ShaderType.Geometry)) { _gsConstants[slot] = pipelineConstant; if (_isBound) { ApplyGSConstantBuffer(slot, pipelineConstant); } } if (usage.HasFlag(ShaderType.Pixel)) { _psConstants[slot] = pipelineConstant; if (_isBound) { ApplyPSConstantBuffer(slot, pipelineConstant); } } }
private void ApplyPSConstantBuffer(int slot, AbstractConstantBuffer pipelineConstant) { var buffer = pipelineConstant?.BufferPtr ?? IntPtr.Zero; DeviceContext.PSSetConstantBuffers(_device.ContextPtr, (uint)slot, 1, ref buffer); }