• ue metal feature level


       if (Input.ShaderFormat == NAME_SF_METAL || Input.ShaderFormat == NAME_SF_METAL_TVOS)
        {
            UE_CLOG(VersionEnum < 2, LogShaders, Warning, TEXT("Metal shader version must be Metal v1.2 or higher for format %s!"), VersionEnum, *Input.ShaderFormat.ToString());
            VersionEnum = VersionEnum >= 2 ? VersionEnum : 2;
            AdditionalDefines.SetDefine(TEXT("METAL_PROFILE"), 1);
        }
        else if (Input.ShaderFormat == NAME_SF_METAL_MRT || Input.ShaderFormat == NAME_SF_METAL_MRT_TVOS)
        {
            UE_CLOG(VersionEnum < 2, LogShaders, Warning, TEXT("Metal shader version must be Metal v1.2 or higher for format %s!"), VersionEnum, *Input.ShaderFormat.ToString());
            AdditionalDefines.SetDefine(TEXT("METAL_MRT_PROFILE"), 1);
            VersionEnum = VersionEnum >= 2 ? VersionEnum : 2;
            MetalCompilerTarget = HCT_FeatureLevelSM5;
            Semantics = EMetalGPUSemanticsTBDRDesktop;
        }
        else if (Input.ShaderFormat == NAME_SF_METAL_MACES3_1)
        {
            UE_CLOG(VersionEnum < 3, LogShaders, Warning, TEXT("Metal shader version must be Metal v2.0 or higher for format %s!"), VersionEnum, *Input.ShaderFormat.ToString());
            AdditionalDefines.SetDefine(TEXT("METAL_PROFILE"), 1);
            VersionEnum = VersionEnum > 3 ? VersionEnum : 3;
            MetalCompilerTarget = HCT_FeatureLevelES3_1;
            Semantics = EMetalGPUSemanticsImmediateDesktop;
        }
        else if (Input.ShaderFormat == NAME_SF_METAL_SM5_NOTESS)
        {
            UE_CLOG(VersionEnum < 3, LogShaders, Warning, TEXT("Metal shader version must be Metal v2.0 or higher for format %s!"), VersionEnum, *Input.ShaderFormat.ToString());
            AdditionalDefines.SetDefine(TEXT("METAL_SM5_NOTESS_PROFILE"), 1);
            AdditionalDefines.SetDefine(TEXT("USING_VERTEX_SHADER_LAYER"), 1);
            VersionEnum = VersionEnum > 3 ? VersionEnum : 3;
            MetalCompilerTarget = HCT_FeatureLevelSM5;
            Semantics = EMetalGPUSemanticsImmediateDesktop;
        }
        else if (Input.ShaderFormat == NAME_SF_METAL_SM5)
        {
            UE_CLOG(VersionEnum < 3, LogShaders, Warning, TEXT("Metal shader version must be Metal v2.0 or higher for format %s!"), VersionEnum, *Input.ShaderFormat.ToString());
            AdditionalDefines.SetDefine(TEXT("METAL_SM5_PROFILE"), 1);
            AdditionalDefines.SetDefine(TEXT("USING_VERTEX_SHADER_LAYER"), 1);
            VersionEnum = VersionEnum > 3 ? VersionEnum : 3;
            MetalCompilerTarget = HCT_FeatureLevelSM5;
            Semantics = EMetalGPUSemanticsImmediateDesktop;
        }
        else if (Input.ShaderFormat == NAME_SF_METAL_MRT_MAC)
        {
            UE_CLOG(VersionEnum < 3, LogShaders, Warning, TEXT("Metal shader version must be Metal v2.0 or higher for format %s!"), VersionEnum, *Input.ShaderFormat.ToString());
            AdditionalDefines.SetDefine(TEXT("METAL_MRT_PROFILE"), 1);
            VersionEnum = VersionEnum > 3 ? VersionEnum : 3;
            MetalCompilerTarget = HCT_FeatureLevelSM5;
            Semantics = EMetalGPUSemanticsTBDRDesktop;
        }
    #if PS4_PROFILE
        #define FEATURE_LEVEL FEATURE_LEVEL_SM5
    
    #elif SM5_PROFILE
        // SM5 = full dx11 features (high end UE4 rendering)
        #define FEATURE_LEVEL FEATURE_LEVEL_SM5
    
    #elif SM4_PROFILE
        #define FEATURE_LEVEL FEATURE_LEVEL_SM4
    
    #elif SWITCH_PROFILE || SWITCH_PROFILE_FORWARD
        #undef ES3_1_PROFILE
    
        #if SWITCH_PROFILE
            #define FEATURE_LEVEL FEATURE_LEVEL_SM5
        #else
            #define FEATURE_LEVEL FEATURE_LEVEL_ES3_1
            // @todo switch: maybe all uses of this should check feature level not profile?
            #define ES3_1_PROFILE 1
        #endif
    
    #elif VULKAN_PROFILE
        #define FEATURE_LEVEL FEATURE_LEVEL_ES3_1
        // @todo: replace usage of ES3_1_PROFILE with FEATURE_LEVEL where appropriate
        #undef ES3_1_PROFILE
        #define ES3_1_PROFILE 1 
    
    #elif VULKAN_PROFILE_SM5
        #define FEATURE_LEVEL FEATURE_LEVEL_SM5
        #define STENCIL_COMPONENT_SWIZZLE .x
    
    #elif METAL_PROFILE
        #define FEATURE_LEVEL  FEATURE_LEVEL_ES3_1
        // @todo metal: remove this and make sure all uses handle METAL_PROFILE
        #undef ES3_1_PROFILE
        #define ES3_1_PROFILE 1
    #if MAX_SHADER_LANGUAGE_VERSION >= 3
        #define FCOLOR_COMPONENT_SWIZZLE .rgba
    #else
        #define FCOLOR_COMPONENT_SWIZZLE .bgra
    #endif
        #define FMANUALFETCH_COLOR_COMPONENT_SWIZZLE .bgra
        #define STENCIL_COMPONENT_SWIZZLE .x
    
    #elif METAL_MRT_PROFILE
        #define FEATURE_LEVEL FEATURE_LEVEL_SM5
    #if MAX_SHADER_LANGUAGE_VERSION >= 3
        #define FCOLOR_COMPONENT_SWIZZLE .rgba
    #else
        #define FCOLOR_COMPONENT_SWIZZLE .bgra
    #endif
        #define FMANUALFETCH_COLOR_COMPONENT_SWIZZLE .bgra
        #define STENCIL_COMPONENT_SWIZZLE .x
    
    #elif METAL_SM5_NOTESS_PROFILE
        #define FEATURE_LEVEL FEATURE_LEVEL_SM5
        #define FCOLOR_COMPONENT_SWIZZLE .rgba
        #define FMANUALFETCH_COLOR_COMPONENT_SWIZZLE .bgra
        #define STENCIL_COMPONENT_SWIZZLE .x
    
    #elif METAL_SM5_PROFILE
        #define FEATURE_LEVEL FEATURE_LEVEL_SM5
        #define FCOLOR_COMPONENT_SWIZZLE .rgba
        #define FMANUALFETCH_COLOR_COMPONENT_SWIZZLE .bgra
        #define STENCIL_COMPONENT_SWIZZLE .x
    
    #elif ES3_1_PROFILE
        #define FEATURE_LEVEL FEATURE_LEVEL_ES3_1
    
        #if COMPILER_GLSL_ES3_1
            #define FCOLOR_COMPONENT_SWIZZLE .bgra  
            #define FMANUALFETCH_COLOR_COMPONENT_SWIZZLE .bgra
        #else 
            #define FCOLOR_COMPONENT_SWIZZLE .rgba
            #define FMANUALFETCH_COLOR_COMPONENT_SWIZZLE .bgra
        #endif
    
        #if COMPILER_GLSL || COMPILER_GLSL_ES3_1
            // A8 textures when sampled have their component in R
            #define A8_SAMPLE_MASK .r
        #endif
    #elif VECTORVM_PROFILE
        #define FEATURE_LEVEL FEATURE_LEVEL_SM5
    #endif

    SM5---dx11

    metal_MRT_Profile  sm5 tbdrDesktop 这俩不确定

    metal_sm5_noTess_Profile   no tessellation

    metal_sm5_profile 就是ios desktop renderer 的sm5  

    metal_Profile es31

    shader这里 metal的有三种

     metal sm5 ---basepass desktop  mac上的desktop renderer

    metal ---metal低版本---mobilebasepass ---gl_LastFragDataR_4 SceneDepth放这里 Mobile deferred 也是这个 ps里用这个(METAL_PROFILE && !MAC) && PIXELSHADER

    metal MRT---basepass   Mobile deferred SceneTextureStruct_SceneDepthTexture. ---这个就是mobile desktop renderer on mobile (METAL_MRT_PROFILE&& !MAC) && PIXELSHADER

     不一样的shader编号

    不同quality同样编号

  • 相关阅读:
    attr与prop
    Django框架学习
    库的操作
    javascript 基础知识
    进程
    正则表达式
    模块( collections , time , random , os , sys)
    内置函数
    生成器
    迭代器
  • 原文地址:https://www.cnblogs.com/minggoddess/p/14466447.html
Copyright © 2020-2023  润新知