public unsafe void Update(DX11RenderContext context) { FLogger.Log(LogType.Debug, "1"); if (!this.invalidate) { return; } FLogger.Log(LogType.Debug, "2"); FLogger.Log(LogType.Debug, "3"); if (this.marginalTexture[0].Contains(context)) { FLogger.Log(LogType.Debug, "dispose"); this.marginalTexture[0].Dispose(context); } var data = this.hdrDataIn[0]; if (this.hdrDataIn.IsConnected && data != null) { FLogger.Log(LogType.Debug, "yep"); SlimDX.DXGI.Format fmt = SlimDX.DXGI.Format.R32G32B32A32_Float; int pixelSize = 16; int stride = 128; FLogger.Log(LogType.Debug, "4"); FLogger.Log(LogType.Debug, data.Length.ToString()); byteSpread.SliceCount = stride * pixelSize * this.inHeight[0]; FLogger.Log(LogType.Debug, "5"); data.Read(byteSpread.Stream.Buffer, 0, stride * this.inHeight[0]); FLogger.Log(LogType.Debug, "6"); data.Position = 0; using (SlimDX.DataStream dataStream = new DataStream(byteSpread.Stream.Buffer, true, true)) { DX11Texture2D texture = DX11Texture2D.CreateImmutable(context, this.inWidth[0], this.inHeight[0], fmt, stride, dataStream); this.marginalTexture[0][context] = texture; } } this.invalidate = false; }
public unsafe void Update(DX11RenderContext context) { if (this.FTextureOutput.SliceCount == 0) { return; } if (this.FInvalidate) { int index = 0; var data = this.FInData[index]; if (this.FTextureOutput[0].Contains(context)) { this.FTextureOutput[0].Dispose(context); } if (this.FInData.IsConnected && data != null) { int width = this.FInWidth[index]; int height = this.FInHeight[index]; var fmt = this.FInFormat[index]; int pixelSize = DeviceFormatHelper.GetPixelSizeInBytes(fmt); int stride = this.FInStride[index]; stride = stride <= 0 ? pixelSize * width : stride; //Normally spread implementation, afaik , doesn't downsize the buffer byteSpread.SliceCount = stride * pixelSize; data.Position = this.FInDataLocation[0]; data.Read(byteSpread.Stream.Buffer, 0, stride * height); data.Position = 0; using (SlimDX.DataStream dataStream = new DataStream(byteSpread.Stream.Buffer, true, true)) { DX11Texture2D texture = DX11Texture2D.CreateImmutable(context, width, height, fmt, stride, dataStream); this.FTextureOutput[0][context] = texture; } } this.FInvalidate = false; } }