protected AsyncBuildReportJob(ShaderAnalysisReport args)
 {
     target         = args.targetPlatform;
     filter         = args.filter ?? new ShaderProgramFilter();
     features       = args.features;
     logCommandLine = args.logCommandLines;
 }
 /// <summary>Create an instance to process the <paramref name="material"/>.</summary>
 /// <param name="target">Build target to use.</param>
 /// <param name="material">Material to process.</param>
 /// <exception cref="ArgumentNullException">when <paramref name="material"/> is null.</exception>
 protected BuildReportJobAsync(ShaderAnalysisReport <Material> args)
     : base(args.common)
 {
     if (args.asset != null && args.asset.Equals(null))
     {
         throw new ArgumentNullException(nameof(args.asset));
     }
     material = args.asset;
     m_Name   = $"Build Material Report ({material})";
 }
 /// <summary>Create an instance to process the <paramref name="compute"/>.</summary>
 /// <param name="target">Build target to use.</param>
 /// <param name="compute">Compute shader to process.</param>
 /// <exception cref="ArgumentNullException">when <paramref name="compute"/> is null.</exception>
 protected BuildReportJobAsync(ShaderAnalysisReport <ComputeShader> args)
     : base(args.common)
 {
     if (args.asset != null && args.asset.Equals(null))
     {
         throw new ArgumentNullException(nameof(args.asset));
     }
     compute = args.asset;
     m_Name  = $"Build Compute Shader Report ({compute})";
 }
Exemple #4
0
        /// <summary>
        /// Generate a performance report for <paramref name="args"/>.asset for the platform <paramref name="args"/>.targetPlatform.
        /// </summary>
        /// <returns>An async job that builds the report.</returns>
        /// <exception cref="ArgumentNullException">for <paramref name="args"/>.asset</exception>
        /// <exception cref="InvalidOperationException">if <see cref="PlatformJob.BuildShaderPerfReport"/> is not supported for <paramref name="targetPlatform"/></exception>
        public static IAsyncJob GenerateBuildReportAsync <TAsset>(ShaderAnalysisReport <TAsset> args)
        {
            if (args.asset == null || args.asset.Equals(null))
            {
                throw new ArgumentNullException(nameof(args.asset));
            }

            if (typeof(TAsset) == typeof(Shader))
            {
                if (!DoesPlatformSupport(args.common.targetPlatform, PlatformJob.BuildShaderPerfReport))
                {
                    throw new InvalidOperationException(
                              $"Job {PlatformJob.BuildShaderPerfReport} is not supported for {args.common.targetPlatform}."
                              );
                }
            }
            else if (typeof(TAsset) == typeof(ComputeShader))
            {
                if (!DoesPlatformSupport(args.common.targetPlatform, PlatformJob.BuildComputeShaderPerfReport))
                {
                    throw new InvalidOperationException(
                              $"Job {PlatformJob.BuildComputeShaderPerfReport} is not supported for {args.common.targetPlatform}."
                              );
                }
            }
            else if (typeof(TAsset) == typeof(Material))
            {
                if (!DoesPlatformSupport(args.common.targetPlatform, PlatformJob.BuildMaterialPerfReport))
                {
                    throw new InvalidOperationException(
                              $"Job {PlatformJob.BuildMaterialPerfReport} is not supported for {args.common.targetPlatform}."
                              );
                }
            }
            else
            {
                throw new ArgumentOutOfRangeException(nameof(TAsset));
            }


            return(s_Instance.BuildReportAsync(args));
        }
Exemple #5
0
        /// <summary>
        /// Generate a performance report for <paramref name="compute"/> for the platform <paramref name="targetPlatform"/>.
        /// </summary>
        /// <returns>An async job that builds the report.</returns>
        /// <exception cref="ArgumentNullException">for <paramref name="compute"/></exception>
        /// <exception cref="InvalidOperationException">if <see cref="PlatformJob.BuildComputeShaderPerfReport"/> is not supported for <paramref name="targetPlatform"/></exception>
        public static IAsyncJob GenerateBuildReportAsyncGeneric(ShaderAnalysisReport <Object> args)
        {
            if (args.asset == null || args.asset.Equals(null))
            {
                throw new ArgumentNullException(nameof(args.asset));
            }

            switch (args.asset)
            {
            case ComputeShader _:
                return(GenerateBuildReportAsync(args.Into <ComputeShader>()));

            case Shader _:
                return(GenerateBuildReportAsync(args.Into <Shader>()));

            case Material _:
                return(GenerateBuildReportAsync(args.Into <Material>()));

            default: throw new ArgumentException($"Invalid asset: {args.asset}");
            }
        }