Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonRenderTargetView"/> class.
        /// </summary>
        /// <param name="resource">The resource to bind to the view.</param>
        /// <param name="format">The format of the view.</param>
        protected GorgonRenderTargetView(GorgonResource resource, BufferFormat format)
            : base(resource, format)
        {
            switch (resource.ResourceType)
            {
            case ResourceType.Buffer:
                _bufferTarget = (GorgonRenderTargetBuffer)resource;
                break;

            case ResourceType.Texture1D:
                _1DTarget = (GorgonRenderTarget1D)resource;
                break;

            case ResourceType.Texture2D:
                _2DTarget = (GorgonRenderTarget2D)resource;
                if (_2DTarget.IsSwapChain)
                {
                    _swapChain = (GorgonSwapChain)_2DTarget;
                }
                break;

            case ResourceType.Texture3D:
                _3DTarget = (GorgonRenderTarget3D)resource;
                break;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Function to retrieve the render target view for a render target.
 /// </summary>
 /// <param name="target">Render target to evaluate.</param>
 /// <returns>The render target view for the swap chain.</returns>
 public static GorgonRenderTargetTextureView ToRenderTargetView(GorgonRenderTarget3D target)
 {
     return(target == null ? null : target._defaultRenderTargetView);
 }