示例#1
0
        public void Update(ResourceLayout TexLayout, int W, int H)
        {
            if (Width != W || Height != H)
            {
                Tex?.Dispose();
                TexView?.Dispose();

                Width  = W;
                Height = H;

                TextureDescription Desc = new TextureDescription((uint)W, (uint)H, 1, 1, 1, PixelFormat.B8_G8_R8_A8_UNorm, TextureUsage.Sampled, TextureType.Texture2D);
                Tex     = Fact.CreateTexture(Desc);
                TexView = Fact.CreateTextureView(Tex);

                SamplerDescription SamplerDesc = new SamplerDescription(SamplerAddressMode.Clamp, SamplerAddressMode.Clamp, SamplerAddressMode.Clamp,
                                                                        SamplerFilter.MinPoint_MagPoint_MipPoint, null, 0, 0, 0, 0, SamplerBorderColor.OpaqueBlack);
                TexSampler = Fact.CreateSampler(SamplerDesc);
            }
        }