private void BindBuffers(DX11RenderContext context) { QuadShaderDeviceData qd = quaddata[context]; QuadBuffers qb = quadBuffers[context]; if (qb.worldbuffer != null) { if (qb.worldbuffer.ElementCount != this.FInWorld.SliceCount) { qb.worldbuffer.Dispose(); qb.worldbuffer = null; } } if (qb.colorbuffer != null) { if (qb.colorbuffer.ElementCount != this.FInColor.SliceCount) { qb.colorbuffer.Dispose(); qb.colorbuffer = null; } } if (this.FInTexture.IsConnected) { if (qb.uvbuffer != null) { if (qb.uvbuffer.ElementCount != this.FInTexTransform.SliceCount) { qb.uvbuffer.Dispose(); qb.uvbuffer = null; } } if (qb.uvbuffer == null) { qb.uvbuffer = new DX11DynamicStructuredBuffer <Matrix>(context, this.FInTexTransform.SliceCount); } qd.quadshader.SetBySemantic("TEXTUREMATRIXCOUNT", qb.uvbuffer.ElementCount); qd.quadshader.SetBySemantic("TEXTUREMATRIXBUFFER", qb.uvbuffer.SRV); qb.uvbuffer.WriteData(this.FInTexTransform.Stream.Buffer, 0, this.FInTexTransform.SliceCount); } if (qb.worldbuffer == null) { qb.worldbuffer = new DX11DynamicStructuredBuffer <Matrix>(context, this.FInWorld.SliceCount); } if (qb.colorbuffer == null) { qb.colorbuffer = new DX11DynamicStructuredBuffer <Color4>(context, this.FInColor.SliceCount); } qb.worldbuffer.WriteData(this.FInWorld.Stream.Buffer, 0, this.FInWorld.SliceCount); qb.colorbuffer.WriteData(this.FInColor.Stream.Buffer, 0, this.FInColor.SliceCount); qd.quadshader.SetBySemantic("WORLDBUFFER", qb.worldbuffer.SRV); qd.quadshader.SetBySemantic("COLORBUFFER", qb.colorbuffer.SRV); qd.quadshader.SetBySemantic("WORLDCOUNT", qb.worldbuffer.ElementCount); qd.quadshader.SetBySemantic("COLORCOUNT", qb.colorbuffer.ElementCount); }
public void Update(IPluginIO pin, DX11RenderContext context) { lock ( syncRoot) { if (!quaddata.ContainsKey(context)) { quaddata[context] = new QuadShaderDeviceData(context); } if (!quadBuffers.ContainsKey(context)) { quadBuffers[context] = new QuadBuffers(); } } if (this.spmax > 0) { if (!this.FOutLayer[0].Contains(context)) { this.FOutLayer[0][context] = new DX11Layer(); this.FOutLayer[0][context].Render = this.Render; } } }
public void Update(IPluginIO pin, DX11RenderContext context) { lock( syncRoot) { if (!quaddata.ContainsKey(context)) { quaddata[context] = new QuadShaderDeviceData(context); } if (!quadBuffers.ContainsKey(context)) { quadBuffers[context] = new QuadBuffers(); } } if (this.spmax > 0) { if (!this.FOutLayer[0].Contains(context)) { this.FOutLayer[0][context] = new DX11Layer(); this.FOutLayer[0][context].Render = this.Render; } } }