示例#1
0
        public static ColorTarget CreateBackedColorTarget2D(
            GraphicsDevice device,
            uint width,
            uint height,
            Refresh.ColorFormat format,
            bool canBeSampled,
            Refresh.SampleCount sampleCount = Refresh.SampleCount.One,
            uint levelCount = 1
            )
        {
            var flags = Refresh.TextureUsageFlags.ColorTargetBit;

            if (canBeSampled)
            {
                flags |= Refresh.TextureUsageFlags.SamplerBit;
            }

            var texture = Texture.CreateTexture2D(
                device,
                width,
                height,
                format,
                flags,
                sampleCount,
                levelCount
                );

            var textureSlice = new TextureSlice(texture);

            return(new ColorTarget(device, sampleCount, ref textureSlice));
        }
示例#2
0
        public void SetData(ref TextureSlice textureSlice, IntPtr data, uint dataLengthInBytes)
        {
            var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();

            Refresh.Refresh_SetTextureData(
                Device.Handle,
                ref refreshTextureSlice,
                data,
                dataLengthInBytes
                );
        }
示例#3
0
        public void CopyTextureToBuffer(
            ref TextureSlice textureSlice,
            Buffer buffer
            )
        {
            var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();

            Refresh.Refresh_CopyTextureToBuffer(
                Device.Handle,
                Handle,
                ref refreshTextureSlice,
                buffer.Handle
                );
        }
示例#4
0
        public void QueuePresent(
            ref TextureSlice textureSlice,
            Refresh.Filter filter
            )
        {
            var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();

            Refresh.Refresh_QueuePresent(
                Device.Handle,
                Handle,
                ref refreshTextureSlice,
                IntPtr.Zero,
                filter
                );
        }
示例#5
0
        public void QueuePresent(
            ref TextureSlice textureSlice,
            ref Refresh.Rect destinationRectangle,
            Refresh.Filter filter
            )
        {
            var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();

            Refresh.Refresh_QueuePresent(
                Device.Handle,
                Handle,
                ref refreshTextureSlice,
                ref destinationRectangle,
                filter
                );
        }
示例#6
0
        public void CopyTextureToTexture(
            ref TextureSlice sourceTextureSlice,
            ref TextureSlice destinationTextureSlice,
            Refresh.Filter filter
            )
        {
            var sourceRefreshTextureSlice = sourceTextureSlice.ToRefreshTextureSlice();
            var destRefreshTextureSlice   = destinationTextureSlice.ToRefreshTextureSlice();

            Refresh.Refresh_CopyTextureToTexture(
                Device.Handle,
                Handle,
                ref sourceRefreshTextureSlice,
                ref destRefreshTextureSlice,
                filter
                );
        }
示例#7
0
        public ColorTarget(GraphicsDevice device, Refresh.SampleCount sampleCount, ref TextureSlice textureSlice) : base(device)
        {
            var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();

            Handle = Refresh.Refresh_CreateColorTarget(device.Handle, sampleCount, ref refreshTextureSlice);
        }