Beispiel #1
0
        public int NumberOfSamples(ResizeSamplerType type)
        {
            switch (type)
            {
            case ResizeSamplerType.NearestNeighbour:
                return(1);

            case ResizeSamplerType.Average2x2:
                return(4);

            case ResizeSamplerType.Average4x4:
                return(16);
            }
            return(0);
        }
Beispiel #2
0
        public DownSampleArrayComponent[] ReturnWeightsAndOffsets(ResizeSamplerType type)
        {
            switch (type)
            {
            case ResizeSamplerType.NearestNeighbour:
                return(_nearestNeighbour);

            case ResizeSamplerType.Average2x2:
                return(_average2x2);

            case ResizeSamplerType.Average4x4:
                return(_average4x4);
            }
            return(null);
        }
Beispiel #3
0
        public void Render(CommandList cl, GpuSurface source, GpuSurface target, ResizeSamplerType downSampleType)
        {
            if (_sampleType == null || _sampleType != downSampleType)
            {
                _sampleType = downSampleType;
                LoadWeightsAndOffsets(cl);
            }

            UpdateSamplerUniformBuffer(cl, source);

            cl.SetFramebuffer(target.Framebuffer);
            cl.SetVertexBuffer(0, _ndcQuadVertexBuffer.Buffer);
            cl.SetPipeline(_pipeline);
            cl.SetGraphicsResourceSet(0, source.ResourceSet_TexMirror);
            cl.SetGraphicsResourceSet(1, _samplerFactorsUniformBlockResourceSet);
            cl.SetGraphicsResourceSet(2, _weightsAndOffsetsResourceSet);
            cl.Draw(6);
        }