示例#1
0
 private bool CheckSurfaceFormat(SurfaceFormat surfaceFormat, int sampleCount)
 {
     DXGI.Format       format  = D3D10Helper.ToD3DSurfaceFormat(surfaceFormat);
     D3D.FormatSupport support = _graphicsDevice.CheckFormatSupport(format);
     if (sampleCount > 0)
     {
         bool correctSamples = CheckMultiSampleQuality(format, sampleCount);
         return(correctSamples && ((support & D3D.FormatSupport.RenderTarget) == D3D.FormatSupport.RenderTarget) &&
                ((support & D3D.FormatSupport.FormatMultisampleRenderTargetSupport) == D3D.FormatSupport.FormatMultisampleRenderTargetSupport));
     }
     return((support & D3D.FormatSupport.RenderTarget) == D3D.FormatSupport.RenderTarget);
 }
示例#2
0
 private bool CheckDepthFormat(DepthFormat depthFormat, int sampleCount)
 {
     if (depthFormat == DepthFormat.None)
     {
         return(true);
     }
     DXGI.Format       format  = D3D10Helper.ToD3DDepthFormat(depthFormat);
     D3D.FormatSupport support = _graphicsDevice.CheckFormatSupport(format);
     if (sampleCount > 0)
     {
         bool correctSamples = CheckMultiSampleQuality(format, sampleCount);
         return(correctSamples && ((support & D3D.FormatSupport.DepthStencil) == D3D.FormatSupport.DepthStencil) &&
                ((support & D3D.FormatSupport.FormatMultisampleRenderTargetSupport) == D3D.FormatSupport.FormatMultisampleRenderTargetSupport));
     }
     return((support & D3D.FormatSupport.DepthStencil) == D3D.FormatSupport.DepthStencil);
 }
示例#3
0
        /// <summary>
        /// Queries if the specified surface format is valid for texture resources.
        /// </summary>
        /// <param name="surfaceFormat">Surface format</param>
        /// <param name="texType">The texture type</param>
        /// <returns>True if valid, false otherwise</returns>
        public bool QueryTextureFormat(SurfaceFormat surfaceFormat, TextureDimensions texType)
        {
            DXGI.Format       format  = D3D10Helper.ToD3DSurfaceFormat(surfaceFormat);
            D3D.FormatSupport support = _graphicsDevice.CheckFormatSupport(format);
            switch (texType)
            {
            case TextureDimensions.One:
                return((support & D3D.FormatSupport.Texture1D) == D3D.FormatSupport.Texture1D);

            case TextureDimensions.Two:
                return((support & D3D.FormatSupport.Texture2D) == D3D.FormatSupport.Texture2D);

            case TextureDimensions.Three:
                return((support & D3D.FormatSupport.Texture3D) == D3D.FormatSupport.Texture3D);

            case TextureDimensions.Cube:
                return((support & D3D.FormatSupport.TextureCube) == D3D.FormatSupport.TextureCube);
            }
            return(false);
        }