示例#1
0
 public static string[] DisplayStrings(this FloatPrecision fp)
 {
     return(new string[] {
         "fixed (11 bit)",
         "half (16 bit)",
         "float (32 bit)"
     });
 }
示例#2
0
 public static string ToCode(this FloatPrecision fp)
 {
     if (fp == FloatPrecision.Fixed)
     {
         return("fixed");
     }
     else if (fp == FloatPrecision.Half)
     {
         return("half");
     }
     else
     {
         return("float");
     }
 }
 public BurstCompileAttribute(FloatPrecision floatPrecision, FloatMode floatMode)
 {
     FloatMode      = floatMode;
     FloatPrecision = floatPrecision;
 }
示例#4
0
 public static TDescription WithBurst <TDescription>(this TDescription description, FloatMode floatMode = FloatMode.Default, FloatPrecision floatPrecision = FloatPrecision.Standard, bool synchronousCompilation = false) where TDescription : ILambdaJobDescription => description;
示例#5
0
 public ComputeJobOptimizationAttribute(FloatPrecision floatPrecision, FloatMode floatMode) : base(floatPrecision, floatMode)
 {
 }
        /// <summary>
        /// Configure the pass before execution
        /// </summary>
        /// <param name="baseDescriptor">Current target descriptor</param>
        /// <param name="colorAttachmentHandle">Color attachment to render into</param>
        /// <param name="depthAttachmentHandle">Depth attachment to render into</param>
        /// <param name="configuration">Specific render configuration</param>
        public bool Setup(
            RenderTextureDescriptor baseDescriptor,
            RenderTargetHandle colorAttachmentHandle,
            RenderTargetHandle depthAttachmentHandle,
            RendererConfiguration configuration,
            SampleCount samples,
            RenderingData renderingData)
        {
            if (!GetViewDepthMinMaxWithRenderQueue(renderingData.cameraData.camera, RenderQueueUtils.oit, out _ViewDepthMinMax))
            {
                return(false);
            }
            this._ColorAttachmentHandle = colorAttachmentHandle;
            this._DepthAttachmentHandle = depthAttachmentHandle;
            _RendererConfiguration      = configuration;

            if ((int)samples > 1)
            {
                baseDescriptor.bindMS      = false;
                baseDescriptor.msaaSamples = (int)samples;
            }

            baseDescriptor.depthBufferBits = 0;

            _Descriptor = baseDescriptor;

            _MomentsPrecision = renderingData.cameraData.momentsPrecision;

            if (_MomentsPrecision == FloatPrecision._Single)
            {
                baseDescriptor.colorFormat = RenderTextureFormat.ARGBFloat;
                _DescriptorFloat4          = baseDescriptor;

                baseDescriptor.colorFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGFloat)
                    ? RenderTextureFormat.RGFloat
                    : RenderTextureFormat.ARGBFloat;
                _DescriptorFloat2 = baseDescriptor;

                baseDescriptor.colorFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RFloat)
                    ? RenderTextureFormat.RFloat
                    : RenderTextureFormat.ARGBFloat;
                _DescriptorFloat = baseDescriptor;
            }
            else
            {
                baseDescriptor.colorFormat = RenderTextureFormat.ARGBHalf;
                _DescriptorFloat4          = baseDescriptor;

                baseDescriptor.colorFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf)
                    ? RenderTextureFormat.RGHalf
                    : RenderTextureFormat.ARGBHalf;
                _DescriptorFloat2 = baseDescriptor;

                baseDescriptor.colorFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RHalf)
                    ? RenderTextureFormat.RHalf
                    : RenderTextureFormat.ARGBHalf;
                _DescriptorFloat = baseDescriptor;
            }

            _B0Handle.Init("_B0");
            _B1Handle.Init("_B1");
            _B2Handle.Init("_B2");

            _MomentsCount = (MomentsCount)renderingData.cameraData.momentsCount;

            if (MomentsCount._4 != _MomentsCount)
            {
                _GMBinding = new RenderTargetBinding(
                    new RenderTargetIdentifier[]
                {
                    _B0Handle.Identifier(),
                    _B1Handle.Identifier(),
                    _B2Handle.Identifier(),
                },
                    new RenderBufferLoadAction[]
                {
                    RenderBufferLoadAction.DontCare,
                    RenderBufferLoadAction.DontCare,
                    RenderBufferLoadAction.DontCare,
                },
                    new RenderBufferStoreAction[]
                {
                    RenderBufferStoreAction.Store,
                    RenderBufferStoreAction.Store,
                    RenderBufferStoreAction.Store,
                },
                    _DepthAttachmentHandle.Identifier(),
                    RenderBufferLoadAction.Load,
                    RenderBufferStoreAction.DontCare);
            }
            else
            {
                _GMBinding = new RenderTargetBinding(
                    new RenderTargetIdentifier[]
                {
                    _B0Handle.Identifier(),
                    _B1Handle.Identifier(),
                },
                    new RenderBufferLoadAction[]
                {
                    RenderBufferLoadAction.DontCare,
                    RenderBufferLoadAction.DontCare,
                },
                    new RenderBufferStoreAction[]
                {
                    RenderBufferStoreAction.Store,
                    RenderBufferStoreAction.Store,
                },
                    _DepthAttachmentHandle.Identifier(),
                    RenderBufferLoadAction.Load,
                    RenderBufferStoreAction.DontCare);
            }

            _MOITHandle.Init("_MOIT");
            _GIALHandle.Init("_GIAL");
            _RMBinding = new RenderTargetBinding(
                new RenderTargetIdentifier[]
            {
                _MOITHandle.Identifier(),
                _GIALHandle.Identifier(),
            },
                new RenderBufferLoadAction[]
            {
                RenderBufferLoadAction.DontCare,
                RenderBufferLoadAction.DontCare,
            },
                new RenderBufferStoreAction[]
            {
                RenderBufferStoreAction.Store,
                RenderBufferStoreAction.Store,
            },
                _DepthAttachmentHandle.Identifier(),
                RenderBufferLoadAction.Load,
                RenderBufferStoreAction.DontCare
                );
            return(true);
        }
 public double FixedTest(double n) => FloatPrecision.Round(n);