public static InnerResourceView Create(Resource resource, DepthStencilViewDescription description)
            {
                switch (description.Dimension)
                {
                case DepthStencilViewDimension.Texture1D:
                    return(new Texture1DView((Texture1D)resource, description.Texture1D));

                case DepthStencilViewDimension.Texture1DArray:
                    return(new Texture1DArrayView((Texture1D)resource, description.Texture1DArray));

                case DepthStencilViewDimension.Texture2D:
                    return(new Texture2DView((Texture2D)resource, description.Texture2D));

                case DepthStencilViewDimension.Texture2DArray:
                    return(new Texture2DArrayView((Texture2D)resource, description.Texture2DArray));

                case DepthStencilViewDimension.Texture2DMultisampled:
                    throw new NotImplementedException();

                case DepthStencilViewDimension.Texture2DMultisampledArray:
                    throw new NotImplementedException();

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
Exemplo n.º 2
0
		internal DepthStencilView(Device device, Resource resource, DepthStencilViewDescription? description)
			: base(device, resource)
		{
			switch (resource.ResourceType)
			{
				case ResourceType.Buffer:
					throw new ArgumentException("Invalid resource type for depth stencil view: " + resource.ResourceType);
			}

			_description = description.GetValueOrDefault(DepthStencilViewDescription.CreateDefault(resource));
			_innerView = InnerResourceView.Create(resource, _description);
		}
Exemplo n.º 3
0
        internal DepthStencilView(Device device, Resource resource, DepthStencilViewDescription?description)
            : base(device, resource)
        {
            switch (resource.ResourceType)
            {
            case ResourceType.Buffer:
                throw new ArgumentException("Invalid resource type for depth stencil view: " + resource.ResourceType);
            }

            _description = description.GetValueOrDefault(DepthStencilViewDescription.CreateDefault(resource));
            _innerView   = InnerResourceView.Create(resource, _description);
        }
		internal static DepthStencilViewDescription CreateDefault(Resource resource)
		{
			var result = new DepthStencilViewDescription();
			switch (resource.ResourceType)
			{
				case ResourceType.Texture1D:
					result.Dimension = DepthStencilViewDimension.Texture1D;
					break;
				case ResourceType.Texture2D:
					result.Dimension = DepthStencilViewDimension.Texture2D;
					break;
				default:
					throw new ArgumentOutOfRangeException();
			}
			return result;
		}
        internal static DepthStencilViewDescription CreateDefault(Resource resource)
        {
            var result = new DepthStencilViewDescription();

            switch (resource.ResourceType)
            {
            case ResourceType.Texture1D:
                result.Dimension = DepthStencilViewDimension.Texture1D;
                break;

            case ResourceType.Texture2D:
                result.Dimension = DepthStencilViewDimension.Texture2D;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(result);
        }
			public static InnerResourceView Create(Resource resource, DepthStencilViewDescription description)
			{
				switch (description.Dimension)
				{
					case DepthStencilViewDimension.Texture1D:
						return new Texture1DView((Texture1D) resource, description.Texture1D);
					case DepthStencilViewDimension.Texture1DArray:
						return new Texture1DArrayView((Texture1D) resource, description.Texture1DArray);
					case DepthStencilViewDimension.Texture2D:
						return new Texture2DView((Texture2D) resource, description.Texture2D);
					case DepthStencilViewDimension.Texture2DArray:
						return new Texture2DArrayView((Texture2D) resource, description.Texture2DArray);
					case DepthStencilViewDimension.Texture2DMultisampled:
						throw new NotImplementedException();
					case DepthStencilViewDimension.Texture2DMultisampledArray:
						throw new NotImplementedException();
					default:
						throw new ArgumentOutOfRangeException();
				}
			}
			public Texture1DView(Texture1D resource, DepthStencilViewDescription.Texture1DResource description)
			{
				_subresource = resource.GetSubresource(0, description.MipSlice);
			}
			public Texture2DArrayView(Texture2D resource, DepthStencilViewDescription.Texture2DArrayResource description)
			{
				_subresources = new Texture2D.Texture2DSubresource[description.ArraySize];
				for (int i = description.FirstArraySlice; i < description.FirstArraySlice + description.ArraySize; i++)
					_subresources[i] = resource.GetSubresource(i, description.MipSlice);
			}