diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt index 57e5190d69..b4b5b8281d 100644 --- a/native/CMakeLists.txt +++ b/native/CMakeLists.txt @@ -1073,8 +1073,6 @@ if(CC_USE_VULKAN) cocos/renderer/gfx-vulkan/VKRenderPass.h cocos/renderer/gfx-vulkan/VKShader.cpp cocos/renderer/gfx-vulkan/VKShader.h - cocos/renderer/gfx-vulkan/VKSPIRV.h - cocos/renderer/gfx-vulkan/VKSPIRV.cpp cocos/renderer/gfx-vulkan/VKStd.cpp cocos/renderer/gfx-vulkan/VKStd.h cocos/renderer/gfx-vulkan/VKSwapchain.cpp diff --git a/native/cocos/base/IndexHandle.h b/native/cocos/base/IndexHandle.h index 66779f2eb5..ea03bbb7db 100644 --- a/native/cocos/base/IndexHandle.h +++ b/native/cocos/base/IndexHandle.h @@ -49,7 +49,7 @@ public: inline bool operator<(IndexHandle const &rhs) const noexcept; inline bool operator==(IndexHandle const &rhs) const noexcept; inline bool operator!=(IndexHandle const &rhs) const noexcept; - inline operator IndexType() const noexcept; + inline operator IndexType() const noexcept; // NOLINT(google-explicit-constructor) we need this implicitly static IndexType constexpr UNINITIALIZED{std::numeric_limits::max()}; diff --git a/native/cocos/bindings/manual/jsb_global_init.cpp b/native/cocos/bindings/manual/jsb_global_init.cpp index 9565a1e709..e246048e2e 100644 --- a/native/cocos/bindings/manual/jsb_global_init.cpp +++ b/native/cocos/bindings/manual/jsb_global_init.cpp @@ -27,10 +27,6 @@ #include "base/Macros.h" // clang-format: off #include -#if CC_PLATFORM == CC_PLATFORM_WINDOWS - // Fix ssize_t defination - #include "cocos/bindings/jswrapper/config.h" -#endif #include "uv.h" // clang-format on @@ -57,7 +53,8 @@ se::Object *__jsbObj = nullptr; //NOLINT se::Object *__glObj = nullptr; //NOLINT static std::basic_string xxteaKey; -void jsb_set_xxtea_key(const std::string &key) { //NOLINT + +void jsb_set_xxtea_key(const std::string &key) { //NOLINT xxteaKey.assign(key.begin(), key.end()); } diff --git a/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp b/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp index 5fca80dc8d..4184c4b0d4 100644 --- a/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp +++ b/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp @@ -83,8 +83,6 @@ CommandBufferAgent::~CommandBufferAgent() { void CommandBufferAgent::initMessageQueue() { DeviceAgent *device = DeviceAgent::getInstance(); device->_cmdBuffRefs.insert(this); - // TODO(PatriceJiang): replace with: _messageQueue = CC_NEW(MessageQueue); - _messageQueue = _CC_NEW_T_ALIGN(MessageQueue, alignof(MessageQueue)); // TODO(PatriceJiang): replace with: _messageQueue = CC_NEW(MessageQueue); _messageQueue = _CC_NEW_T_ALIGN(MessageQueue, alignof(MessageQueue)); diff --git a/native/cocos/renderer/gfx-vulkan/VKSPIRV.cpp b/native/cocos/renderer/gfx-vulkan/VKSPIRV.cpp deleted file mode 100644 index de76beddf9..0000000000 --- a/native/cocos/renderer/gfx-vulkan/VKSPIRV.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. - - http://www.cocos.com - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license - to use Cocos Creator solely to develop games on your target platforms. You shall - not use Cocos Creator software for developing other software or tools that's - used for developing games. You are not granted to publish, distribute, - sublicense, and/or sell copies of Cocos Creator. - - The software or tools in this License Agreement are licensed, not sold. - Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -****************************************************************************/ - -#include "renderer/gfx-vulkan/VKSPIRV.h" - -namespace cc { -namespace gfx { - -bool glslangInitialized = false; - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/gfx-vulkan/VKSPIRV.h b/native/cocos/renderer/gfx-vulkan/VKSPIRV.h deleted file mode 100644 index d845afb284..0000000000 --- a/native/cocos/renderer/gfx-vulkan/VKSPIRV.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** - Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. - - http://www.cocos.com - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license - to use Cocos Creator solely to develop games on your target platforms. You shall - not use Cocos Creator software for developing other software or tools that's - used for developing games. You are not granted to publish, distribute, - sublicense, and/or sell copies of Cocos Creator. - - The software or tools in this License Agreement are licensed, not sold. - Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -****************************************************************************/ - -#pragma once - -#include "base/Log.h" -#include "gfx-base/GFXDef.h" - -#include "glslang/Public/ShaderLang.h" -#include "glslang/SPIRV/GlslangToSpv.h" -#include "glslang/StandAlone/ResourceLimits.h" - -namespace cc { -namespace gfx { - -inline EShLanguage getShaderStage(ShaderStageFlagBit type) { - switch (type) { - case ShaderStageFlagBit::VERTEX: return EShLangVertex; - case ShaderStageFlagBit::CONTROL: return EShLangTessControl; - case ShaderStageFlagBit::EVALUATION: return EShLangTessEvaluation; - case ShaderStageFlagBit::GEOMETRY: return EShLangGeometry; - case ShaderStageFlagBit::FRAGMENT: return EShLangFragment; - case ShaderStageFlagBit::COMPUTE: return EShLangCompute; - default: { - CCASSERT(false, "Unsupported ShaderStageFlagBit, convert to EShLanguage failed."); - return EShLangVertex; - } - } -} - -inline glslang::EShTargetClientVersion getClientVersion(int vulkanMinorVersion) { - switch (vulkanMinorVersion) { - case 0: return glslang::EShTargetVulkan_1_0; - case 1: return glslang::EShTargetVulkan_1_1; - case 2: return glslang::EShTargetVulkan_1_2; - default: { - CCASSERT(false, "Unsupported vulkan version, convert to EShTargetClientVersion failed."); - return glslang::EShTargetVulkan_1_0; - } - } -} - -inline glslang::EShTargetLanguageVersion getTargetVersion(int vulkanMinorVersion) { - switch (vulkanMinorVersion) { - case 0: return glslang::EShTargetSpv_1_0; - case 1: return glslang::EShTargetSpv_1_3; - case 2: return glslang::EShTargetSpv_1_5; - default: { - CCASSERT(false, "Unsupported vulkan version, convert to EShTargetLanguageVersion failed."); - return glslang::EShTargetSpv_1_0; - } - } -} - -extern bool glslangInitialized; - -inline vector glsl2spirv(ShaderStageFlagBit type, const String &source, int vulkanMinorVersion = 0) { - if (!glslangInitialized) { - glslang::InitializeProcess(); - glslangInitialized = true; - } - - EShLanguage stage = getShaderStage(type); - const char * string = source.c_str(); - glslang::TShader shader(stage); - shader.setStrings(&string, 1); - - int clientInputSemanticsVersion = 100 + vulkanMinorVersion * 10; - glslang::EShTargetClientVersion clientVersion = getClientVersion(vulkanMinorVersion); - glslang::EShTargetLanguageVersion targetVersion = getTargetVersion(vulkanMinorVersion); - - shader.setEnvInput(glslang::EShSourceGlsl, stage, glslang::EShClientVulkan, clientInputSemanticsVersion); - shader.setEnvClient(glslang::EShClientVulkan, clientVersion); - shader.setEnvTarget(glslang::EShTargetSpv, targetVersion); - - auto messages = static_cast(EShMsgSpvRules | EShMsgVulkanRules); - - if (!shader.parse(&glslang::DefaultTBuiltInResource, clientInputSemanticsVersion, false, messages)) { - CC_LOG_ERROR("GLSL Parsing Failed:\n%s\n%s", shader.getInfoLog(), shader.getInfoDebugLog()); - } - - glslang::TProgram program; - program.addShader(&shader); - - if (!program.link(messages)) { - CC_LOG_ERROR("GLSL Linking Failed:\n%s\n%s", program.getInfoLog(), program.getInfoDebugLog()); - } - - vector spirv; - spv::SpvBuildLogger logger; - glslang::SpvOptions spvOptions; - glslang::GlslangToSpv(*program.getIntermediate(stage), spirv, &logger, &spvOptions); - - return spirv; -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp b/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp index 5ef84a63ad..e43452f2bf 100644 --- a/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp +++ b/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp @@ -70,7 +70,7 @@ void ShadowFlow::render(scene::Camera *camera) { lightCollecting(camera, &_validLights); - if (sceneData->getShadowObjects().empty() && sceneData->getRenderObjects().empty()) { + if (sceneData->getDirShadowObjects().empty() && sceneData->getRenderObjects().empty()) { clearShadowMap(camera); return; }