private void SetSampler(CommonShaderStage stage, ShaderStageCache cache, int slot, SamplerState sampler) { if (cache.Samplers[slot] != sampler) { stage.SetSampler(slot, sampler); cache.Samplers[slot] = sampler; } }
/// <summary> /// Sets and gets sampler state to given shader stage. /// </summary> /// <param name="index"></param> /// <returns></returns> public SamplerState this[int index] { set { states[index] = value; stage.SetSampler(index, (value == null) ? null : value.Apply(device)); } get { return(states[index]); } }
internal void SetSampler(int slot, ISamplerState sampler) { SamplerState dxObject = null; if (sampler != null) { ISamplerStateInternal samplerInternal = (ISamplerStateInternal)sampler; dxObject = samplerInternal.Resource; } if (dxObject == m_samplers[slot]) { return; } m_samplers[slot] = dxObject; m_shaderStage.SetSampler(slot, dxObject); m_statistics.SetSamplers++; }