Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable gfx-webgpu ci by default and fix some warnings in gfx-webgpu code #16231

Merged
merged 6 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .github/workflows/native-compile-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -512,33 +512,3 @@ jobs:
cmake --build . --config Debug -- -jobs $NUM_OF_CORES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
fi
echo "Compile iOS Done!"

compile_wgpu_mac:
name: "Emscripten"
runs-on: macos-latest
if: contains( github.event.pull_request.title, 'WGPU_CI_ON' )
steps:
- uses: actions/checkout@v2
- name: Download external libraries
shell: bash
run: |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js`
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external
- name: Setup Emscripten
run: |
NATIVE_ROOT=$GITHUB_WORKSPACE/native
git clone https://github.com/emscripten-core/emsdk.git NATIVE_ROOT/../../emsdk
cd NATIVE_ROOT/../../emsdk
./emsdk install 3.1.17
./emsdk activate 3.1.17
source ./emsdk_env.sh
emcc -v
- name: Compile
env:
COCOS_ENGINE_DEV: 1
run: |
NATIVE_ROOT=$GITHUB_WORKSPACE/native
cd $NATIVE_ROOT/cocos/renderer/gfx-wgpu
$NATIVE_ROOT/../../emsdk/upstream/emscripten/emcmake cmake .
$NATIVE_ROOT/../../emsdk/upstream/emscripten/emmake make
echo "Compile WGPU by ems on MacOS Done!"
64 changes: 64 additions & 0 deletions .github/workflows/native-compile-webgpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: <Native> Compile WebGPU

on:
pull_request:
paths:
- 'native/external-config.json'
- 'native/cocos/base/**'
- 'native/cocos/renderer/gfx-base/**'
- 'native/cocos/renderer/gfx-wgpu/**'
- 'native/cocos/renderer/gfx-validator/**'
- 'native/cocos/renderer/gfx-empty/**'
- '.github/workflows/native-compile-webgpu.yml'

# github.head_ref is only defined on pull_request events
concurrency:
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
compile_wgpu:
name: "Emscripten"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Download external libraries
shell: bash
run: |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js`
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external

- name: Setup emsdk
uses: dumganhar/setup-emsdk@997d2cde2deabda085a11f98e86e842915b0e846
with:
version: 3.1.45
actions-cache-folder: 'emsdk-cache'

- name: Verify
run: |
which emcc
emcc -v

- name: Install ninja
run: |
if ! command -v ninja &> /dev/null; then
echo "Ninja not found, installing..."
# sudo apt update
sudo apt install ninja-build
else
echo "Ninja is already installed."
fi
which ninja

- name: Compile
# env:
# COCOS_ENGINE_DEV: 1
run: |
NATIVE_ROOT=$GITHUB_WORKSPACE/native
cd $NATIVE_ROOT/cocos/renderer/gfx-wgpu
mkdir build
cd build
cmake .. -GNinja -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Debug
ninja
echo "============== Compile WGPU by ems on Ubuntu Done! =============="
8 changes: 5 additions & 3 deletions native/cocos/renderer/gfx-wgpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ include(${ENGINE_ROOT_DIR}/cmake/predefine.cmake)

include (${ENGINE_ROOT_DIR}/external/CMakeLists.txt)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wextra -Wno-nonportable-include-path -fno-exceptions -v -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES=D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g3 -D_DEBUG=1 -Wno-unused -O0 -std=c++17 -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -w -DNDEBUG=1 -O3 -std=c++17 -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES")
add_definitions(-DBOOST_NO_CXX98_FUNCTION_BASE)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wno-nonportable-include-path -fno-exceptions")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -D_DEBUG=1 -Wno-unused -O0 -std=c++17")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG=1 -O3 -std=c++17")

message(${CMAKE_BUILD_TYPE})

Expand Down
4 changes: 2 additions & 2 deletions native/cocos/renderer/gfx-wgpu/WGPUCommandBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ class CCWGPUCommandBuffer final : public CommandBuffer {
void updateBuffer(Buffer *buff, const emscripten::val &v, uint32_t size);)

protected:
virtual void doInit(const CommandBufferInfo &info);
virtual void doDestroy();
void doInit(const CommandBufferInfo &info) override;
void doDestroy() override;

// delay binding.
void bindStates();
Expand Down
1 change: 0 additions & 1 deletion native/cocos/renderer/gfx-wgpu/WGPUEMSImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
THE SOFTWARE.
****************************************************************************/

#pragma once
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include <boost/preprocessor/cat.hpp>
Expand Down
2 changes: 1 addition & 1 deletion native/cocos/renderer/gfx-wgpu/WGPUSampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#endif
#include "gfx-base/states/GFXSampler.h"

#include "WGPUobject.h"
#include "WGPUObject.h"

namespace cc {
namespace gfx {
Expand Down
2 changes: 2 additions & 0 deletions native/cocos/renderer/gfx-wgpu/WGPUUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ static WGPUTextureSampleType textureSampleTypeTrait(Format format) {
return WGPUTextureSampleType::WGPUTextureSampleType_Depth;
default:
printf("unsupport texture sample type yet, github@hana-alice to fix.");
return WGPUTextureSampleType::WGPUTextureSampleType_Undefined;
}
}

Expand Down Expand Up @@ -525,6 +526,7 @@ static WGPUVertexFormat toWGPUVertexFormat(Format format) {
return WGPUVertexFormat_Sint32x4;
default:
printf("usvf %d\n", format);
return WGPUVertexFormat_Undefined;
}
}

Expand Down