public void Evaluate(int SpreadMax) { if (this.FInput.PluginIO.IsConnected && this.FInEnabled[0]) { if (this.RenderRequest != null) { this.RenderRequest(this, this.FHost); } if (this.AssignedContext == null) { this.FOutput.SliceCount = 0; return; } IDX11RWStructureBuffer b = this.FInput[0][this.AssignedContext]; if (b != null) { if (Marshal.SizeOf(typeof(T)) != b.Stride) { this.FOutput.SliceCount = 0; this.FHost.Log(TLogType.Error, "Buffer has an invalid stride"); return; } if (this.staging != null && this.staging.ElementCount != b.ElementCount) { this.staging.Dispose(); this.staging = null; } if (this.staging == null) { staging = new DX11StagingStructuredBuffer(this.AssignedContext.Device, b.ElementCount, 16); } this.AssignedContext.CurrentDeviceContext.CopyResource(b.Buffer, staging.Buffer); this.FOutput.SliceCount = b.ElementCount; DataStream ds = staging.MapForRead(this.AssignedContext.CurrentDeviceContext); this.WriteData(ds, b.ElementCount); this.FOutput.Flush(true); staging.UnMap(this.AssignedContext.CurrentDeviceContext); } else { this.FOutput.SliceCount = 0; } } else { this.FOutput.SliceCount = 0; } }
public void Evaluate(int SpreadMax) { if (this.doRead.SliceCount == 0) { return; } if (this.FInput.IsConnected && this.doRead[0]) { this.FInput.Sync(); if (this.RenderRequest != null) { this.RenderRequest(this, this.FHost); } IDX11RWStructureBuffer b = this.FInput[0][this.AssignedContext]; if (b != null) { if (!this.copyBuffer.Contains(this.AssignedContext)) { this.copyBuffer[this.AssignedContext] = new DX11StagingRawBuffer(this.AssignedContext.Device, 16); } this.AssignedContext.CurrentDeviceContext.CopyStructureCount(b.UAV, this.copyBuffer[this.AssignedContext].Buffer, 0); DataStream ds = this.copyBuffer[this.AssignedContext].MapForRead(this.AssignedContext.CurrentDeviceContext); this.output.SliceCount = 1; this.output[0] = ds.Read <int>(); this.copyBuffer[this.AssignedContext].UnMap(this.AssignedContext.CurrentDeviceContext); } else { this.output.SliceCount = 0; } } else { this.output.SliceCount = 0; } }
public void Unlock(IDX11RWStructureBuffer target) { this.sbufferpool.UnLock(target); }
public void Unlock(IDX11RWStructureBuffer target) { this.sbufferpool.UnLock(target); }