private void InitTexture(DX11RenderContext context, int index, Texture2DDescription description) { this.FTextureOutput[index].Dispose(context); this.FTextureOutput[index] = new DX11Resource <DX11Texture2D>(); description.ArraySize = 1; this.FTextureOutput[index][context] = DX11Texture2D.FromDescription(context, description); }
private void MainLoop_OnPresent(object sender, EventArgs e) { //Rendering is finished, so should be ok to grab texture now if (this.FTextureInput.PluginIO.IsConnected && this.FTextureInput.SliceCount > 0) { //Little temp hack, grab context from global, since for now we have one context anyway DX11RenderContext context = DX11GlobalDevice.DeviceManager.RenderContexts[0]; if (this.FTextureInput[0].Contains(context)) { DX11Texture2D texture = this.FTextureInput[0][context]; if (texture is DX11DepthStencil) { this.logger.Log(LogType.Warning, "FrameDelay for depth texture is not supported"); return; } if (this.lasttexture != null) { if (this.lasttexture.Description != texture.Description) { this.DisposeTexture(); } } if (this.lasttexture == null) { this.lasttexture = DX11Texture2D.FromDescription(context, texture.Description); } context.CurrentDeviceContext.CopyResource(texture.Resource, this.lasttexture.Resource); if (this.FInFlush[0]) { context.CurrentDeviceContext.Flush(); } } else { this.DisposeTexture(); } } else { this.DisposeTexture(); } }
public void Present() { DX11RenderContext context = this.RenderContext; //Rendering is finished, so should be ok to grab texture now if (this.FTextureInput.IsConnected && this.FTextureInput.SliceCount > 0 && this.FTextureInput[0].Contains(context)) { DX11Texture2D texture = this.FTextureInput[0][context]; if (texture != null) { if (texture is DX11DepthStencil) { this.logger.Log(LogType.Warning, "FrameDelay for depth texture is not supported"); return; } if (this.lasttexture != null) { if (this.lasttexture.Description != texture.Description) { this.DisposeTexture(); } } if (this.lasttexture == null) { this.lasttexture = DX11Texture2D.FromDescription(context, texture.Description); } context.CurrentDeviceContext.CopyResource(texture.Resource, this.lasttexture.Resource); if (this.FInFlush[0]) { context.CurrentDeviceContext.Flush(); } } } else { this.DisposeTexture(); } }