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); } } }
private void ApplyPSResource(int slot, AbstractShaderResourceBuffer buffer) { IntPtr view = buffer?.ViewPtr ?? IntPtr.Zero; DeviceContext.PSSetShaderResources(_device.ContextPtr, (uint)slot, 1, ref view); }