Ejemplo n.º 1
0
        public static SamplerState New(GraphicsDevice graphicsDevice, SamplerStateDescription samplerStateDescription)
        {
            // Store SamplerState in a cache (D3D seems to have quite bad concurrency when using CreateSampler while rendering)
            SamplerState samplerState;

            lock (graphicsDevice.CachedSamplerStates)
            {
                if (graphicsDevice.CachedSamplerStates.TryGetValue(samplerStateDescription, out samplerState))
                {
                    // TODO: Appropriate destroy
                    samplerState.AddReferenceInternal();
                }
                else
                {
                    samplerState = new SamplerState(graphicsDevice, samplerStateDescription);
                    graphicsDevice.CachedSamplerStates.Add(samplerStateDescription, samplerState);
                }
            }
            return(samplerState);
        }
Ejemplo n.º 2
0
 private SamplerState(GraphicsDevice graphicsDevice, SamplerStateDescription samplerStateDescription)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SamplerState"/> class.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="name">The name.</param>
        /// <param name="samplerStateDescription">The sampler state description.</param>
        private SamplerState(GraphicsDevice device, SamplerStateDescription samplerStateDescription) : base(device)
        {
            Description = samplerStateDescription;

            CreateNativeDeviceChild();
        }
Ejemplo n.º 4
0
 // For FakeSamplerState.
 protected SamplerState(SamplerStateDescription description)
 {
     Description = description;
 }
Ejemplo n.º 5
0
 public FakeSamplerState(SamplerStateDescription description) : base(description)
 {
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Create a new fake sampler state for serialization.
 /// </summary>
 /// <param name="description">The description of the sampler state</param>
 /// <returns>The fake sampler state</returns>
 public static SamplerState NewFake(SamplerStateDescription description)
 {
     return(new SamplerState(description));
 }
Ejemplo n.º 7
0
 // For FakeSamplerState.
 private SamplerState(SamplerStateDescription description)
 {
     Description = description;
 }