public static void SaveToFile(DxDevice device, RenderContext context, IDxTexture3D texture, string path) { eImageFormat format = eImageFormat.Dds; long retcode = NativeMethods.SaveTextureToFile(device.Device.NativePointer, context.Context.NativePointer, texture.Texture.NativePointer, path, (int)format); if (retcode < 0) { throw new Exception("Failed to Save Texture"); } }
public DxMipSliceRenderTarget(DxDevice device, IDxTexture3D texture, int mipindex, int w, int h, int d) { this.device = device; RenderTargetViewDescription rtd = new RenderTargetViewDescription() { Dimension = RenderTargetViewDimension.Texture3D, Format = texture.Format, Texture3D = new RenderTargetViewDescription.Texture3DResource() { MipSlice = mipindex } }; ShaderResourceViewDescription srvd = new ShaderResourceViewDescription() { Dimension = ShaderResourceViewDimension.Texture3D, Format = texture.Format, Texture3D = new ShaderResourceViewDescription.Texture3DResource() { MipLevels = 1, MostDetailedMip = mipindex } }; UnorderedAccessViewDescription uavd = new UnorderedAccessViewDescription() { Dimension = UnorderedAccessViewDimension.Texture3D, Format = texture.Format, Texture3D = new UnorderedAccessViewDescription.Texture3DResource() { FirstWSlice = 0, MipSlice = mipindex, WSize = d } }; this.RenderView = new RenderTargetView(device.Device, texture.Texture, rtd); this.ShaderView = new ShaderResourceView(device.Device, texture.Texture, srvd); this.UnorderedView = new UnorderedAccessView(device.Device, texture.Texture, uavd); this.Width = w; this.Height = h; this.Depth = d; }