public FeralTic.DX11.Resources.DX11ResourceTexture2D SetSRV(FeralTic.DX11.Resources.DX11ResourceTexture2D texture, FeralTic.DX11.DX11RenderContext context) { if (texture == null) { texture = new FeralTic.DX11.Resources.DX11ResourceTexture2D(context); } if (texture.Meta != this.filename && (WaitForFrame || this.Loaded)) { sw.Restart(); var handle = RefCounter.Use(); if (!this.Loaded) { try { LoadTask.Wait(); } catch (AggregateException) // .Wait can surface the exception { handle.Dispose(); LogExceptions(LoadTask, "while waiting"); } } if (this.Loaded) { texture.SetBySRV(decoder.SRV, handle); SwapTime = sw.Elapsed.TotalMilliseconds; } } return(texture); }
public void CopyResource(FeralTic.DX11.Resources.DX11ResourceTexture2D texture) { SlimDX.Direct3D11.DeviceContext ctx = texture.Context.CurrentDeviceContext; SlimDX.DataBox db = ctx.MapSubresource(texture.WritableResource, 0, SlimDX.Direct3D11.MapMode.WriteDiscard, SlimDX.Direct3D11.MapFlags.None); bmpImage.CopyPixels(Int32Rect.Empty, db.Data.DataPointer, stride * bmpImage.PixelHeight, stride); ctx.UnmapSubresource(texture.WritableResource, 0); }
public void CopyResource(FeralTic.DX11.Resources.DX11ResourceTexture2D texture) { SlimDX.Direct3D11.DeviceContext ctx = texture.Context.CurrentDeviceContext; SlimDX.DataBox db = ctx.MapSubresource(texture.WritableResource, 0, SlimDX.Direct3D11.MapMode.WriteDiscard, SlimDX.Direct3D11.MapFlags.None); unsafe { Memory.Copy(db.Data.DataPointer, bitmapData.Scan0, (uint)(bitmapData.Stride * bitmapData.Height)); } ctx.UnmapSubresource(texture.WritableResource, 0); }
public FeralTic.DX11.Resources.DX11ResourceTexture2D CopyResource(FeralTic.DX11.Resources.DX11ResourceTexture2D texture) { sw.Restart(); try { decoder.CopyResource(texture); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("CopyResource: {0}", e); } CopyTime = sw.Elapsed.TotalMilliseconds; return(texture); }
public void CopyResource(FeralTic.DX11.Resources.DX11ResourceTexture2D texture) { texture.Context.CurrentDeviceContext.CopyResource(tex, texture.WritableResource); }