示例#1
0
 public Image(string name, string mimeType, ImageUsage usage, Memory <byte> bytes)
 {
     Name     = name;
     MimeType = mimeType;
     Bytes    = bytes;
     Usage    = usage;
 }
示例#2
0
 public Image(string name, string mimeType, ImageUsage usage, ArraySegment <byte> bytes)
 {
     Name     = name;
     MimeType = mimeType;
     Bytes    = bytes;
     Usage    = usage;
 }
        public StreamableImage(string name, ulong buf_sz, uint dims, uint w, uint h, uint d, uint layers, uint levels, ImageViewType viewType, ImageFormat format, ImageUsage usage) : base(name)
        {
            this.Size       = buf_sz;
            this.Streamable = true;
            LocalImage      = new Image(Name + "_upload_img")
            {
                Cubemappable  = false,
                Width         = w,
                Height        = h,
                Depth         = d,
                Dimensions    = dims,
                InitialLayout = ImageLayout.Undefined,
                Layers        = layers,
                Levels        = levels,
                MemoryUsage   = MemoryUsage.GpuOnly,
                Usage         = usage | ImageUsage.TransferDst,
                Format        = format,
            };
            LocalImage.Build(0);

            LocalImageView = new ImageView(Name)
            {
                BaseLayer  = 0,
                BaseLevel  = 0,
                Format     = format,
                LayerCount = layers,
                LevelCount = levels,
                ViewType   = viewType,
            };
            LocalImageView.Build(LocalImage);

            HostBuffer = new GpuBuffer(name + "_host")
            {
                Mapped      = true,
                Size        = buf_sz,
                MemoryUsage = MemoryUsage.CpuToGpu,
                Usage       = BufferUsage.TransferSrc
            };
            HostBuffer.Build(0);
        }