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); } } }
public void SetResource(ShaderType usage, int slot, AbstractShaderResourceBuffer buffer) { if (usage.HasFlag(ShaderType.Vertex)) { _vsBuffers[slot] = buffer; if (_isBound) { var view = buffer?.ViewPtr ?? IntPtr.Zero; DeviceContext.VSSetShaderResources(_device.ContextPtr, (uint)slot, 1, ref view); } } if (usage.HasFlag(ShaderType.Geometry)) { _gsBuffers[slot] = buffer; if (_isBound) { var view = buffer?.ViewPtr ?? IntPtr.Zero; DeviceContext.GSSetShaderResources(_device.ContextPtr, (uint)slot, 1, ref view); } } if (usage.HasFlag(ShaderType.Pixel)) { _resources.Remove(slot); _psBuffers[slot] = buffer; if (_isBound) { var view = buffer?.ViewPtr ?? IntPtr.Zero; DeviceContext.PSSetShaderResources(_device.ContextPtr, (uint)slot, 1, ref view); } } }