コード例 #1
0
ファイル: TextureArraySetSlice.cs プロジェクト: nissidis/ccl
        public void Apply(DX11Texture2D texture, int w, int h, int d, SlimDX.DXGI.Format format, int slice)
        {
            format = format == SlimDX.DXGI.Format.Unknown ? texture.Format : format;

            if (this.rtarr != null)
            {
                if (this.rtarr.ElemCnt != d || this.rtarr.Width != w || this.rtarr.Height != h
                    || this.rtarr.Format != format)
                {
                    this.rtarr.Dispose(); this.rtarr = null;
                }
            }

            if (this.rtarr == null)
            {
                this.rtarr = new DX11RenderTextureArray(this.context, w, h, d, format);
            }

            this.shader.SelectTechnique("Render");
            this.quad.Bind(this.layout);

            int idx = VMath.Zmod(slice, d);

            //Push specific slice as render target
            this.context.RenderTargetStack.Push(this.rtarr.SliceRTV[idx]);

            //Call simple shader (could use full screen triangle instead)
            this.shader.SetBySemantic("TEXTURE", texture.SRV);
            this.shader.ApplyPass(0);
            this.quad.Draw();
            this.context.RenderTargetStack.Pop();
        }
コード例 #2
0
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            Device device = context.Device;

            if (this.spmax == 0) { return; }

            if (this.updateddevices.Contains(context)) { return; }

            if (!this.FOutTexture[0].Contains(context))
            {
                var result = new DX11RenderTextureArray(context, (int)this.FInSize[0].X, (int)this.FInSize[0].Y, this.FInElementCount[0], DeviceFormatHelper.GetFormat(this.FInFormat[0]),true, this.FInMips[0] ? 0 : 1);
                this.FOutTexture[0][context] = result;
                this.FOutDepthTexture[0][context] = new DX11DepthTextureArray(context, (int)this.FInSize[0].X, (int)this.FInSize[0].Y, this.FInElementCount[0], Format.R32_Float, true);
                for (int i = 0; i < this.FInElementCount[0]; i++)
                {
                    DX11Texture2D slice = DX11Texture2D.FromTextureAndSRV(context, result.Resource, result.SliceRTV[i].SRV);
                    this.FOutSliceTextures[i][context] = slice;
                }
            }

            this.updateddevices.Add(context);
        }
コード例 #3
0
ファイル: TextureArraySetSlice.cs プロジェクト: nissidis/ccl
 public void Reset(DX11Texture2D texture, int w, int h, int d, SlimDX.DXGI.Format format)
 {
     format = format == SlimDX.DXGI.Format.Unknown ? texture.Format : format;
     this.rtarr.Dispose();
     this.rtarr = new DX11RenderTextureArray(this.context, w, h, d, format);
 }