public ParameterKey <SamplerState> GetSamplerKey(SamplerStateDescription samplerStateDesc) { ParameterKey <SamplerState> key; if (!declaredSamplerStates.TryGetValue(samplerStateDesc, out key)) { key = MaterialKeys.Sampler.ComposeWith("i" + declaredSamplerStates.Count.ToString(CultureInfo.InvariantCulture)); declaredSamplerStates.Add(samplerStateDesc, key); } var samplerState = SamplerState.NewFake(samplerStateDesc); Parameters.Set(key, samplerState); return(key); }
public ObjectParameterKey <SamplerState> GetSamplerKey(SamplerStateDescription samplerStateDesc, GraphicsDevice graphicsDevice) { ObjectParameterKey <SamplerState> key; if (!declaredSamplerStates.TryGetValue(samplerStateDesc, out key)) { key = MaterialKeys.Sampler.ComposeWith("i" + declaredSamplerStates.Count.ToString(CultureInfo.InvariantCulture)); declaredSamplerStates.Add(samplerStateDesc, key); } var samplerState = graphicsDevice != null?SamplerState.New(graphicsDevice, samplerStateDesc) : SamplerState.NewFake(samplerStateDesc); Parameters.Set(key, samplerState); return(key); }