动态切换vk整改

Signed-off-by: zhangchao <zhangchao345@huawei.com>
This commit is contained in:
zhangchao 2024-03-06 15:03:31 +08:00
parent fb8b720614
commit 100179d707
7 changed files with 52 additions and 23 deletions

View File

@ -226,6 +226,20 @@ if (exec_script(check_graphic_ext_file_script,
}
}
check_platform_ext_file_args = [
"--filename",
rebase_path("//foundation/graphic/graphic_2d_ext/platform/config.gni"),
]
graphic_2d_platform_configs = {
}
if (exec_script(check_graphic_ext_file_script,
check_platform_ext_file_args,
"string") == "True") {
graphic_2d_platform_configs = {
import("//foundation/graphic/graphic_2d_ext/platform/config.gni")
}
}
flutter_root = "//third_party/flutter"
ace_flutter_engine_root = "$flutter_root/build"
graphic_2d_root = "//foundation/graphic/graphic_2d"

View File

@ -193,6 +193,12 @@ template("graphics2d_source_set") {
if (platform == "ohos" || platform == "ohos_ng") {
external_deps += [ "init:libbegetutil" ]
sources += [ "$drawing_src_dir/utils/system_properties.cpp" ]
if (defined(
graphic_2d_platform_configs.system_graphic_properties_sources)) {
sources += graphic_2d_platform_configs.system_graphic_properties_sources
} else {
sources += [ "$drawing_src_dir/utils/system_graphic_properties.cpp" ]
}
}
if (is_arkui_x) {

View File

@ -18,12 +18,12 @@
namespace OHOS {
namespace Rosen {
namespace Drawing {
enum class GpuApiType {
OPENGL = 0,
VULKAN,
DDGR,
};
namespace Drawing {
class SystemProperties {
public:
static inline GpuApiType GetGpuApiType()
@ -32,6 +32,7 @@ public:
}
static bool GetHMSymbolEnable();
static GpuApiType GetSystemGraphicGpuType();
private:
static const GpuApiType systemGpuApiType_;

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "utils/system_properties.h"
namespace OHOS {
namespace Rosen {
namespace Drawing {
GpuApiType SystemProperties::GetSystemGraphicGpuType()
{
return GpuApiType::OPENGL;
}
} // namespace Drawing
} // namespace Rosen
} // namespace OHOS

View File

@ -21,13 +21,6 @@ namespace OHOS {
namespace Rosen {
namespace Drawing {
#if (defined (ACE_ENABLE_GL) && defined (ACE_ENABLE_VK)) || (defined (RS_ENABLE_GL) && defined (RS_ENABLE_VK))
static GpuApiType SystemGpuApiType()
{
return GpuApiType::OPENGL;
}
#endif
bool SystemProperties::GetHMSymbolEnable()
{
static bool isHMSymbolEnable =
@ -36,7 +29,7 @@ bool SystemProperties::GetHMSymbolEnable()
}
#if (defined (ACE_ENABLE_GL) && defined (ACE_ENABLE_VK)) || (defined (RS_ENABLE_GL) && defined (RS_ENABLE_VK))
const GpuApiType SystemProperties::systemGpuApiType_ = SystemGpuApiType();
const GpuApiType SystemProperties::systemGpuApiType_ = SystemProperties::GetSystemGraphicGpuType();
#elif defined (ACE_ENABLE_GL) || defined (RS_ENABLE_GL)
const GpuApiType SystemProperties::systemGpuApiType_ = GpuApiType::OPENGL;
#else

View File

@ -21,6 +21,7 @@
#include <vector>
#include "common/rs_macros.h"
#include "utils/system_properties.h"
namespace OHOS {
namespace Rosen {
@ -90,12 +91,6 @@ enum class HgmRefreshRateModes {
SET_RATE_MODE_HIGH = 3
};
enum class GpuApiType {
OPENGL = 0,
VULKAN,
DDGR,
};
#ifdef DDGR_ENABLE_FEATURE_OPINC
enum class DdgrOpincType {
DDGR_OPINC_NONE = 0,

View File

@ -33,14 +33,7 @@ constexpr int DEFAULT_UNI_PARTIAL_RENDER_ENABLED_VALUE = 4;
constexpr int DEFAULT_CORRECTION_MODE_VALUE = 999;
#if (defined (ACE_ENABLE_GL) && defined (ACE_ENABLE_VK)) || (defined (RS_ENABLE_GL) && defined (RS_ENABLE_VK))
static GpuApiType SystemGpuApiType()
{
return GpuApiType::OPENGL;
}
#endif
#if (defined (ACE_ENABLE_GL) && defined (ACE_ENABLE_VK)) || (defined (RS_ENABLE_GL) && defined (RS_ENABLE_VK))
const GpuApiType RSSystemProperties::systemGpuApiType_ = SystemGpuApiType();
const GpuApiType RSSystemProperties::systemGpuApiType_ = Drawing::SystemProperties::GetGpuApiType();
#elif defined (ACE_ENABLE_GL) || defined (RS_ENABLE_GL)
const GpuApiType RSSystemProperties::systemGpuApiType_ = GpuApiType::OPENGL;
#else