Edit

kc3-lang/angle/src/compiler/translator/glslang_wrapper.h

Branch :

  • Show log

    Commit

  • Author : Shahbaz Youssefi
    Date : 2021-03-31 11:11:26
    Hash : 0973dd68
    Message : Add a gl-d3d-only target for the translator Chrome's validating command decoder links statically with the ANGLE translator. This change adds a target that builds the translator with only gl and d3d support for this purpose. This will prevent chrome from linking against glslang because of the Vulkan backend. As a bonus, it will reduce the binary size of Chrome by stipping the Vulkan and Metal translation and transformation codes. Bug: angleproject:5810 Change-Id: I5673bad53817ff2aa8486622ff2c64b44c77240f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2797511 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>

  • src/compiler/translator/glslang_wrapper.h
  • //
    // Copyright 2021 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    // glslang_wrapper:
    //   A wrapper to compile GLSL strings to SPIR-V blobs.  glslang here refers to the Khronos
    //   compiler.
    //
    
    #ifndef COMPILER_TRANSLATOR_GLSLANG_WRAPPER_H_
    #define COMPILER_TRANSLATOR_GLSLANG_WRAPPER_H_
    
    #include "GLSLANG/ShaderLang.h"
    #include "common/PackedEnums.h"
    
    #include <string>
    #include <vector>
    
    namespace sh
    {
    #if defined(ANGLE_ENABLE_VULKAN) || defined(ANGLE_ENABLE_METAL)
    void GlslangInitialize();
    void GlslangFinalize();
    
    // Generate SPIR-V out of intermediate GLSL through glslang.
    ANGLE_NO_DISCARD bool GlslangCompileToSpirv(const ShBuiltInResources &resources,
                                                sh::GLenum shaderType,
                                                const std::string &shaderSource,
                                                std::vector<uint32_t> *spirvBlobOut);
    #else
    ANGLE_INLINE void GlslangInitialize()
    {
        UNREACHABLE();
    }
    ANGLE_INLINE void GlslangFinalize()
    {
        UNREACHABLE();
    }
    #endif  // defined(ANGLE_ENABLE_VULKAN) || defined(ANGLE_ENABLE_METAL)
    }  // namespace sh
    
    #endif  // COMPILER_TRANSLATOR_GLSLANG_WRAPPER_H_