Edit

kc3-lang/angle/src/common/vulkan/vulkan_icd.h

Branch :

  • Show log

    Commit

  • Author : Antonio Maiorano
    Date : 2020-06-22 10:59:09
    Hash : b47cc50a
    Message : Enable validation layer custom extensions With this change, Vulkan-ValidationLayers will allow the specified extensions to pass through, instead of being nulled out: * VK_STRUCTURE_TYPE_SAMPLER_FILTERING_PRECISION_GOOGLE * VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT Bug: b/159027603 Bug: b/154620295 Change-Id: I0ace3acdac06a6c115834ef88b0c883fa2dd4744 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2246304 Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>

  • src/common/vulkan/vulkan_icd.h
  • //
    // Copyright 2020 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.
    //
    // vulkan_icd.h : Helper for creating vulkan instances & selecting physical device.
    
    #ifndef COMMON_VULKAN_VULKAN_ICD_H_
    #define COMMON_VULKAN_VULKAN_ICD_H_
    
    #include <string>
    
    #include "common/Optional.h"
    #include "common/angleutils.h"
    #include "common/vulkan/vk_headers.h"
    
    namespace angle
    {
    
    namespace vk
    {
    
    enum class ICD
    {
        Default,
        Mock,
        SwiftShader,
    };
    
    class ScopedVkLoaderEnvironment : angle::NonCopyable
    {
      public:
        ScopedVkLoaderEnvironment(bool enableValidationLayers, vk::ICD icd);
        ~ScopedVkLoaderEnvironment();
    
        bool canEnableValidationLayers() const { return mEnableValidationLayers; }
        vk::ICD getEnabledICD() const { return mICD; }
    
      private:
        bool setICDEnvironment(const char *icd);
        bool setCustomExtensionsEnvironment();
    
        bool mEnableValidationLayers;
        vk::ICD mICD;
        bool mChangedCWD;
        Optional<std::string> mPreviousCWD;
        bool mChangedICDEnv;
        Optional<std::string> mPreviousICDEnv;
        Optional<std::string> mPreviousCustomExtensionsEnv;
    };
    
    void ChoosePhysicalDevice(const std::vector<VkPhysicalDevice> &physicalDevices,
                              vk::ICD preferredICD,
                              VkPhysicalDevice *physicalDeviceOut,
                              VkPhysicalDeviceProperties *physicalDevicePropertiesOut);
    
    }  // namespace vk
    
    }  // namespace angle
    
    #endif  // COMMON_VULKAN_VULKAN_ICD_H_