Beispiel #1
0
        public Texture( D3D10.Device device, int width, int height, DXGI.Format format, D3D10.ResourceUsage usage, int miplevels )
        {
            D3D10.Texture2DDescription desc = new D3D10.Texture2DDescription();

            desc.Width  = width;
            desc.Height = height;

            D3D10.BindFlags bindflags = D3D10.BindFlags.ShaderResource;
            D3D10.ResourceOptionFlags optionflags = D3D10.ResourceOptionFlags.None;

            if( miplevels != 1 )
            {
                bindflags |= D3D10.BindFlags.RenderTarget;
                optionflags |= D3D10.ResourceOptionFlags.GenerateMipMaps;
            }

            desc.ArraySize = 1;
            desc.BindFlags = bindflags;
            desc.CpuAccessFlags = D3D10.CpuAccessFlags.None;
            desc.Format = format;
            desc.MipLevels = miplevels;
            desc.OptionFlags = optionflags;
            desc.SampleDescription = new SlimDX.DXGI.SampleDescription( 1, 0 );
            desc.Usage = usage;

            Create( device, desc );
        }
        public WriteTexture( D3D10.Device device, int width, int height, DXGI.Format format )
        {
            D3D10.Texture2DDescription desc = new D3D10.Texture2DDescription();

            desc.Width  = width;
            desc.Height = height;

            desc.ArraySize = 1;
            desc.BindFlags = D3D10.BindFlags.None;
            desc.CpuAccessFlags = D3D10.CpuAccessFlags.Write;
            desc.Format = format;
            desc.MipLevels = 1;
            desc.OptionFlags = D3D10.ResourceOptionFlags.None;
            desc.SampleDescription = new SlimDX.DXGI.SampleDescription( 1, 0 );
            desc.Usage = D3D10.ResourceUsage.Staging;

            Resource = new D3D10.Texture2D( device, desc );
        }
        public StagingTexturePool( D3D10.Device device, int width, int height, DXGI.Format format, int count, D3D10.CpuAccessFlags cpuaccess )
        {
            D3D10.Texture2DDescription desc = new D3D10.Texture2DDescription();

            desc.Width  = width;
            desc.Height = height;

            desc.ArraySize = 1;
            desc.BindFlags = D3D10.BindFlags.None;
            desc.CpuAccessFlags = cpuaccess;
            desc.Format = format;
            desc.MipLevels = 1;
            desc.OptionFlags = D3D10.ResourceOptionFlags.None;
            desc.SampleDescription = new SlimDX.DXGI.SampleDescription( 1, 0 );
            desc.Usage = D3D10.ResourceUsage.Staging;

            resources = new D3D10.Texture2D[count];
            for( int i = 0; i < count; ++i )
                resources[i] = new D3D10.Texture2D( device, desc );
        }
        public DepthBuffer( D3D10.Device device, int width, int height, DXGI.Format format )
        {
            this.device = device;

            D3D10.Texture2DDescription desc = new D3D10.Texture2DDescription();

            desc.Width  = width;
            desc.Height = height;

            desc.ArraySize = 1;
            desc.BindFlags = D3D10.BindFlags.DepthStencil;
            desc.CpuAccessFlags = D3D10.CpuAccessFlags.None;
            desc.Format = format;
            desc.MipLevels = 1;
            desc.OptionFlags = D3D10.ResourceOptionFlags.None;
            desc.SampleDescription = new SlimDX.DXGI.SampleDescription( 1, 0 );
            desc.Usage = D3D10.ResourceUsage.Default;

            Resource = new D3D10.Texture2D( device, desc );
            View = new D3D10.DepthStencilView( device, Resource );
        }