示例#1
0
        public void Accept(ShaderGeneratorContext context)
        {
            if (Texture is null)
            {
                throw new InvalidOperationException();
            }

            ColorTexture = new Texture2D(ShaderResourceView.FromTexture2D(Texture, ConvertToLinear ? Texture.Format.ToSrgb() : Texture.Format));
            context.ShaderResourceViews.Add(ShaderResourceView.FromTexture2D(Texture, ConvertToLinear ? Texture.Format.ToSrgb() : Texture.Format));
        }
示例#2
0
        public void Accept(ShaderGeneratorContext context)
        {
            if (Texture is null)
            {
                throw new InvalidOperationException();
            }

            ScalarTexture = new Texture2D(ShaderResourceView.FromTexture2D(Texture, ConvertToLinear ? Texture.Format.ToSrgb() : Texture.Format));
            context.ShaderResourceViews.Add(ScalarTexture);

            colorChannelBuffer ??= GraphicsResource.CreateBuffer(context.GraphicsDevice, Channel, ResourceFlags.None, HeapType.Upload);
            context.ConstantBufferViews.Add(colorChannelBuffer.DefaultConstantBufferView);
        }