コード例 #1
0
        static List <KernelInfo> GetKernelDisplayInfo(ComputeShader cs)
        {
            var kernelInfo    = new List <KernelInfo>();
            var platformCount = ShaderUtil.GetComputeShaderPlatformCount(cs);

            for (var i = 0; i < platformCount; ++i)
            {
                var platform    = ShaderUtil.GetComputeShaderPlatformType(cs, i);
                var kernelCount = ShaderUtil.GetComputeShaderPlatformKernelCount(cs, i);
                for (var j = 0; j < kernelCount; ++j)
                {
                    var kernelName = ShaderUtil.GetComputeShaderPlatformKernelName(cs, i, j);
                    var found      = false;
                    foreach (var ki in kernelInfo)
                    {
                        if (ki.name == kernelName)
                        {
                            ki.platforms += ' ';
                            ki.platforms += platform.ToString();
                            found         = true;
                        }
                    }
                    if (!found)
                    {
                        var ki = new KernelInfo();
                        ki.name      = kernelName;
                        ki.platforms = platform.ToString();
                        kernelInfo.Add(ki);
                    }
                }
            }
            return(kernelInfo);
        }
コード例 #2
0
        private static List <ComputeShaderInspector.KernelInfo> GetKernelDisplayInfo(ComputeShader cs)
        {
            List <ComputeShaderInspector.KernelInfo> list = new List <ComputeShaderInspector.KernelInfo>();
            int computeShaderPlatformCount = ShaderUtil.GetComputeShaderPlatformCount(cs);

            for (int i = 0; i < computeShaderPlatformCount; i++)
            {
                GraphicsDeviceType computeShaderPlatformType = ShaderUtil.GetComputeShaderPlatformType(cs, i);
                int computeShaderPlatformKernelCount         = ShaderUtil.GetComputeShaderPlatformKernelCount(cs, i);
                for (int j = 0; j < computeShaderPlatformKernelCount; j++)
                {
                    string computeShaderPlatformKernelName = ShaderUtil.GetComputeShaderPlatformKernelName(cs, i, j);
                    bool   flag = false;
                    foreach (ComputeShaderInspector.KernelInfo current in list)
                    {
                        if (current.name == computeShaderPlatformKernelName)
                        {
                            ComputeShaderInspector.KernelInfo expr_6C = current;
                            expr_6C.platforms += ' ';
                            ComputeShaderInspector.KernelInfo expr_85 = current;
                            expr_85.platforms += computeShaderPlatformType.ToString();
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        list.Add(new ComputeShaderInspector.KernelInfo
                        {
                            name      = computeShaderPlatformKernelName,
                            platforms = computeShaderPlatformType.ToString()
                        });
                    }
                }
            }
            return(list);
        }