public Texture3DAndViews(Device device, SlimDX.DXGI.Format format, ItemCount <Pixel> width, ItemCount <Pixel> height, ItemCount <Pixel> depth, DataBox[] data = null) { Width = width; Height = height; Depth = depth; var texDesc = new Texture3DDescription() { BindFlags = BindFlags.ShaderResource | BindFlags.UnorderedAccess, CpuAccessFlags = CpuAccessFlags.None, Depth = depth.Count, Format = format, Height = height.Count, Width = width.Count, MipLevels = 1, OptionFlags = ResourceOptionFlags.None, Usage = ResourceUsage.Default }; if (data != null) { _data = new Texture3D(device, texDesc, data); } else { _data = new Texture3D(device, texDesc); } SRV = new ShaderResourceView(device, _data); UAV = new UnorderedAccessView(device, _data); }
public Texture2DAndViews(Device device, SlimDX.DXGI.Format format, ItemCount <Pixel> width, ItemCount <Pixel> height, DataRectangle data = null) { _device = device; _format = format; Width = width; Height = height; var texDesc = new Texture2DDescription() { ArraySize = 1, BindFlags = BindFlags.ShaderResource | BindFlags.UnorderedAccess, CpuAccessFlags = CpuAccessFlags.None, Format = format, Height = height.Count, Width = width.Count, MipLevels = 1, OptionFlags = ResourceOptionFlags.None, SampleDescription = new SlimDX.DXGI.SampleDescription() { Count = 1, Quality = 0 }, Usage = ResourceUsage.Default }; if (data != null) { _data = new Texture2D(device, texDesc, data); } else { _data = new Texture2D(device, texDesc); } SRV = new ShaderResourceView(device, _data); UAV = new UnorderedAccessView(device, _data); }