Exemplo n.º 1
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ, int sizeIndex,
                            bool linearSampling, float[] arguments, params IFilter[] inputFilters)
     : this(
         shader, threadGroupX, threadGroupY, threadGroupZ, s => s, sizeIndex, linearSampling, arguments,
         inputFilters)
 {
 }
Exemplo n.º 2
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ,
                            TransformFunc transform, int sizeIndex, params IFilter[] inputFilters)
     : this(
         shader, threadGroupX, threadGroupY, threadGroupZ, transform, sizeIndex, false, new float[0],
         inputFilters)
 {
 }
Exemplo n.º 3
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ,
                            TransformFunc transform, bool linearSampling, params IFilter[] inputFilters)
     : this(
         shader, threadGroupX, threadGroupY, threadGroupZ, transform, 0, linearSampling, new float[0],
         inputFilters)
 {
 }
Exemplo n.º 4
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ, int sizeIndex,
                            bool linearSampling, params IBaseFilter[] inputFilters)
     : this(
         shader, threadGroupX, threadGroupY, threadGroupZ, s => s, sizeIndex, linearSampling, new float[0],
         inputFilters)
 {
 }
Exemplo n.º 5
0
 public static ShaderFilterSettings <IShader11> Configure(this IShader11 shader, bool?linearSampling = null,
                                                          float[] arguments    = null, TransformFunc transform         = null, int?sizeIndex = null,
                                                          TextureFormat?format = null, bool[] perTextureLinearSampling = null)
 {
     return(new ShaderFilterSettings <IShader11>(shader).Configure(linearSampling, arguments, transform, sizeIndex,
                                                                   format, perTextureLinearSampling));
 }
Exemplo n.º 6
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ,
                            params IBaseTextureFilter[] inputFilters)
     : base(shader, inputFilters)
 {
     ThreadGroupX = threadGroupX;
     ThreadGroupY = threadGroupY;
     ThreadGroupZ = threadGroupZ;
 }
Exemplo n.º 7
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ,
                            TransformFunc transform, int sizeIndex, bool linearSampling, float[] arguments,
                            params IFilter[] inputFilters)
     : base(shader, transform, sizeIndex, linearSampling, arguments, inputFilters)
 {
     ThreadGroupX = threadGroupX;
     ThreadGroupY = threadGroupY;
     ThreadGroupZ = threadGroupZ;
 }
Exemplo n.º 8
0
 public void Compile(out IShader11 shader)
 {
     shader = Renderer.CompileShader11FromString(Shadercode, EntryPoint, Profile, MacroDefinitions);
 }
Exemplo n.º 9
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ,
                            TransformFunc transform, float[] arguments, params IFilter[] inputFilters)
     : this(shader, threadGroupX, threadGroupY, threadGroupZ, transform, 0, false, arguments, inputFilters)
 {
 }
Exemplo n.º 10
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ, int sizeIndex,
                            float[] arguments, params IFilter[] inputFilters)
     : this(shader, threadGroupX, threadGroupY, threadGroupZ, sizeIndex, false, arguments, inputFilters)
 {
 }
Exemplo n.º 11
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ,
                            params IFilter[] inputFilters)
     : this(shader, threadGroupX, threadGroupY, threadGroupZ, false, inputFilters)
 {
 }
Exemplo n.º 12
0
 protected override void Render(IShader11 shader)
 {
     Renderer.Compute(OutputTarget, shader, ThreadGroupX, ThreadGroupY, ThreadGroupZ);
 }
            public Nnedi3N256Filter(IShader11 shader, IFilter<IBaseTexture> inputFilter)
                : base(shader, inputFilter)
            {
                if (m_WeightsInitialized)
                    return;

                m_Weights1 = new Weights256(Weights256.Weights1);
                m_Weights2 = new Weights256(Weights256.Weights2);
                m_WeightsSum = new WeightsSum256(WeightsSum256.Weights);
                m_WeightsInitialized = true;
            }
            /*
            // This causes .NET JIT internal limitation error, so we have to explicitly declare a filter class for each NNEDi3 neuron count
            public class Nnedi3Filter<TWeights, TWeightsSum> : Shader11Filter
                where TWeights : struct
                where TWeightsSum : struct
            {
                private readonly TWeights m_Weights1;
                private readonly TWeights m_Weights2;
                private readonly TWeightsSum m_WeightsSum;
                private bool m_WeightsUploaded;

                public Nnedi3Filter(IShader11 shader, TWeights weights1, TWeights weights2, TWeightsSum weightsSum, IFilter<IBaseTexture> inputFilter)
                    : base(shader, inputFilter)
                {
                    m_Weights1 = weights1;
                    m_Weights2 = weights2;
                    m_WeightsSum = weightsSum;
                }

                protected override void LoadInputs(IList<IBaseTexture> inputs)
                {
                    base.LoadInputs(inputs);

                    if (!m_WeightsUploaded)
                    {
                        Shader.SetConstantBuffer(2, m_Weights1);
                        Shader.SetConstantBuffer(3, m_Weights2);
                        Shader.SetConstantBuffer(4, m_WeightsSum);
                        m_WeightsUploaded = true;
                    }
                }
            }
            */
            public static IFilter CreateFilter(IShader11 shader, IFilter input, NNedi3Neurons neurons)
            {
                switch (neurons)
                {
                    case NNedi3Neurons.Neurons16:
                        return new Nnedi3N16Filter(shader, input);
                    case NNedi3Neurons.Neurons32:
                        return new Nnedi3N32Filter(shader, input);
                    case NNedi3Neurons.Neurons64:
                        return new Nnedi3N64Filter(shader, input);
                    case NNedi3Neurons.Neurons128:
                        return new Nnedi3N128Filter(shader, input);
                    case NNedi3Neurons.Neurons256:
                        return new Nnedi3N256Filter(shader, input);
                    default:
                        throw new ArgumentOutOfRangeException("neurons");
                }
            }
Exemplo n.º 15
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ,
                            TransformFunc transform, bool linearSampling, float[] arguments, params IBaseFilter[] inputFilters)
     : this(
         shader, threadGroupX, threadGroupY, threadGroupZ, transform, 0, linearSampling, arguments, inputFilters)
 {
 }
Exemplo n.º 16
0
 public void Compile(out IShader11 shader)
 {
     shader = ShaderCache.CompileShader11(ShaderFilename, Profile, EntryPoint, MacroDefinitions);
 }
Exemplo n.º 17
0
 public void Compile(out IShader11 shader)
 {
     shader = Renderer.LoadShader11(BytecodeFilename);
 }
Exemplo n.º 18
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ,
                            bool linearSampling, params IFilter[] inputFilters)
     : this(shader, threadGroupX, threadGroupY, threadGroupZ, 0, linearSampling, inputFilters)
 {
 }
Exemplo n.º 19
0
 protected override void Render(IShader11 shader)
 {
     Renderer.Compute(Target.Texture, shader, ThreadGroupX, ThreadGroupY, ThreadGroupZ);
 }
Exemplo n.º 20
0
 public DirectComputeFilter(IShader11 shader, int threadGroupX, int threadGroupY, int threadGroupZ, int sizeIndex,
                            params IBaseFilter[] inputFilters)
     : this(shader, threadGroupX, threadGroupY, threadGroupZ, sizeIndex, false, inputFilters)
 {
 }