update wgpu-native to 29.0.0.0 (#4222)
This commit is contained in:
8
.github/workflows/android-ci.yml
vendored
8
.github/workflows/android-ci.yml
vendored
@@ -380,9 +380,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
|
|
||||||
- name: Add Android Rust target
|
|
||||||
run: rustup target add ${{ env.RUST_TARGET }}
|
|
||||||
|
|
||||||
- name: Configure cargo for Android NDK linker
|
- name: Configure cargo for Android NDK linker
|
||||||
run: |
|
run: |
|
||||||
LATEST_NDK=$(find "$ANDROID_SDK_ROOT/ndk" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -n 1)
|
LATEST_NDK=$(find "$ANDROID_SDK_ROOT/ndk" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -n 1)
|
||||||
@@ -396,6 +393,11 @@ jobs:
|
|||||||
- name: Pre-build wgpu-native for Android
|
- name: Pre-build wgpu-native for Android
|
||||||
working-directory: vendor/wgpu-native
|
working-directory: vendor/wgpu-native
|
||||||
run: |
|
run: |
|
||||||
|
# vendor/wgpu-native pins its own rust toolchain; install targets for that active toolchain
|
||||||
|
ACTIVE_TOOLCHAIN=$(rustup show active-toolchain | awk '{print $1}')
|
||||||
|
rustup target add ${{ env.RUST_TARGET }} --toolchain "$ACTIVE_TOOLCHAIN"
|
||||||
|
rustup target list --toolchain "$ACTIVE_TOOLCHAIN" --installed | grep -x '${{ env.RUST_TARGET }}'
|
||||||
|
|
||||||
LATEST_NDK=$(find "$ANDROID_SDK_ROOT/ndk" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -n 1)
|
LATEST_NDK=$(find "$ANDROID_SDK_ROOT/ndk" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -n 1)
|
||||||
NDK_PREBUILT="$LATEST_NDK/toolchains/llvm/prebuilt/linux-x86_64"
|
NDK_PREBUILT="$LATEST_NDK/toolchains/llvm/prebuilt/linux-x86_64"
|
||||||
RESOURCE_DIR=$("$NDK_PREBUILT/bin/clang" --print-resource-dir)
|
RESOURCE_DIR=$("$NDK_PREBUILT/bin/clang" --print-resource-dir)
|
||||||
|
|||||||
9
.github/workflows/ios-ci.yml
vendored
9
.github/workflows/ios-ci.yml
vendored
@@ -260,8 +260,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
|
|
||||||
- name: Add iOS Rust target
|
- name: Ensure iOS Rust targets are installed for active toolchain
|
||||||
run: rustup target add aarch64-apple-ios
|
working-directory: vendor/wgpu-native
|
||||||
|
run: |
|
||||||
|
# vendor/wgpu-native pins its own rust toolchain; install targets for that active toolchain
|
||||||
|
ACTIVE_TOOLCHAIN=$(rustup show active-toolchain | awk '{print $1}')
|
||||||
|
rustup target add aarch64-apple-ios --toolchain "$ACTIVE_TOOLCHAIN"
|
||||||
|
rustup target list --toolchain "$ACTIVE_TOOLCHAIN" --installed | grep -x 'aarch64-apple-ios'
|
||||||
|
|
||||||
- name: Configure build with CMake
|
- name: Configure build with CMake
|
||||||
run: cmake --preset ios-webgpu-wgpu
|
run: cmake --preset ios-webgpu-wgpu
|
||||||
|
|||||||
@@ -15,7 +15,14 @@
|
|||||||
#include <webgpu/webgpu_cpp.h>
|
#include <webgpu/webgpu_cpp.h>
|
||||||
#elif MLN_WEBGPU_IMPL_WGPU
|
#elif MLN_WEBGPU_IMPL_WGPU
|
||||||
// For wgpu-native backend, use the WebGPU-Cpp wrapper
|
// For wgpu-native backend, use the WebGPU-Cpp wrapper
|
||||||
|
// TODO: remove this workaround as soon as https://github.com/eliemichel/WebGPU-Cpp/issues/35 is fixed
|
||||||
|
#ifndef _NULLABLE
|
||||||
|
#define _NULLABLE WGPU_NULLABLE
|
||||||
|
#endif
|
||||||
#include <webgpu.hpp>
|
#include <webgpu.hpp>
|
||||||
|
|
||||||
|
#undef _NULLABLE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ GLFWWebGPUBackend::GLFWWebGPUBackend(GLFWwindow* window_, bool capFrameRate)
|
|||||||
x11Desc.window = x11Window;
|
x11Desc.window = x11Window;
|
||||||
|
|
||||||
wgpu::SurfaceDescriptor surfaceDesc = {};
|
wgpu::SurfaceDescriptor surfaceDesc = {};
|
||||||
surfaceDesc.nextInChain = reinterpret_cast<const WGPUChainedStruct*>(&x11Desc);
|
surfaceDesc.nextInChain = reinterpret_cast<WGPUChainedStruct*>(&x11Desc);
|
||||||
|
|
||||||
wgpuSurface = wgpuInstance.createSurface(surfaceDesc);
|
wgpuSurface = wgpuInstance.createSurface(surfaceDesc);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ namespace webgpu {
|
|||||||
|
|
||||||
class HeadlessRenderableResource final : public webgpu::RenderableResource {
|
class HeadlessRenderableResource final : public webgpu::RenderableResource {
|
||||||
public:
|
public:
|
||||||
HeadlessRenderableResource(HeadlessBackend&, webgpu::Context& context_, Size size)
|
HeadlessRenderableResource(HeadlessBackend&, webgpu::Context& context_, Size size_)
|
||||||
: context(context_),
|
: context(context_),
|
||||||
size(size) {
|
size(size_) {
|
||||||
// Create offscreen texture using the proper WebGPU OffscreenTexture class
|
// Create offscreen texture using the proper WebGPU OffscreenTexture class
|
||||||
offscreenTexture = context.createOffscreenTexture(size, gfx::TextureChannelDataType::UnsignedByte, true, true);
|
offscreenTexture = context.createOffscreenTexture(size, gfx::TextureChannelDataType::UnsignedByte, true, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,10 @@
|
|||||||
// for the WebGPU C++ wrapper functions
|
// for the WebGPU C++ wrapper functions
|
||||||
|
|
||||||
#define WEBGPU_CPP_IMPLEMENTATION
|
#define WEBGPU_CPP_IMPLEMENTATION
|
||||||
|
// TODO: remove this workaround as soon as https://github.com/eliemichel/WebGPU-Cpp/issues/35 is fixed
|
||||||
|
#ifndef _NULLABLE
|
||||||
|
#define _NULLABLE WGPU_NULLABLE
|
||||||
|
#endif
|
||||||
#include <webgpu.hpp>
|
#include <webgpu.hpp>
|
||||||
|
|
||||||
|
#undef _NULLABLE
|
||||||
|
|||||||
2
vendor/wgpu-native
vendored
2
vendor/wgpu-native
vendored
Submodule vendor/wgpu-native updated: 768f15f6ac...d2e3330ade
54
vendor/wgpu.cmake
vendored
54
vendor/wgpu.cmake
vendored
@@ -88,7 +88,23 @@ endmacro()
|
|||||||
|
|
||||||
mln_wgpu_find_library()
|
mln_wgpu_find_library()
|
||||||
|
|
||||||
if(NOT WGPU_LIBRARY)
|
if(NOT WGPU_LIBRARY OR MLN_WGPU_NATIVE_VERSION)
|
||||||
|
# Use a specific version of WGPU. This is required when to a rust application
|
||||||
|
# which uses wgpu directly instead of wgpu-native
|
||||||
|
if (MLN_WGPU_NATIVE_VERSION)
|
||||||
|
execute_process(
|
||||||
|
COMMAND git checkout ${MLN_WGPU_NATIVE_VERSION}
|
||||||
|
WORKING_DIRECTORY ${_mln_wgpu_source_dir}
|
||||||
|
RESULT_VARIABLE _git_checkout_wgpu_result
|
||||||
|
OUTPUT_VARIABLE _git_checkout_wgpu_output
|
||||||
|
ERROR_VARIABLE _git_checkout_wgpu_error
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT _git_checkout_wgpu_result EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Failed to checkout wgpu-native version '${MLN_WGPU_NATIVE_VERSION}': ${_git_checkout_wgpu_error}\n")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
message(STATUS "Pre-built wgpu-native library not found, attempting to build from source...")
|
message(STATUS "Pre-built wgpu-native library not found, attempting to build from source...")
|
||||||
|
|
||||||
# Check if cargo is available
|
# Check if cargo is available
|
||||||
@@ -147,9 +163,16 @@ else()
|
|||||||
message(STATUS "Found wgpu-native library: ${WGPU_LIBRARY}")
|
message(STATUS "Found wgpu-native library: ${WGPU_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Create compatibility shims for Dawn header paths if they don't exist
|
||||||
|
set(_webgpu-cpp-output_dir "${CMAKE_CURRENT_BINARY_DIR}/webgpu-cpp")
|
||||||
|
set(_compat_shim_dir "${_webgpu-cpp-output_dir}/webgpu")
|
||||||
|
set(_compat_shim_header "${_compat_shim_dir}/webgpu_cpp.h")
|
||||||
|
set(_compat_shim_webgpu_h "${_compat_shim_dir}/webgpu.h")
|
||||||
|
set(_compat_shim_wgpu_h "${_compat_shim_dir}/wgpu.h")
|
||||||
|
file(MAKE_DIRECTORY "${_compat_shim_dir}")
|
||||||
|
|
||||||
# Generate WebGPU-Cpp wrapper if needed
|
# Generate WebGPU-Cpp wrapper if needed
|
||||||
set(_webgpu_cpp_dir "${PROJECT_SOURCE_DIR}/vendor/webgpu-cpp")
|
set(_webgpu_cpp_header "${_webgpu-cpp-output_dir}/webgpu.hpp")
|
||||||
set(_webgpu_cpp_header "${_webgpu_cpp_dir}/webgpu.hpp")
|
|
||||||
|
|
||||||
if(NOT EXISTS "${_webgpu_cpp_header}")
|
if(NOT EXISTS "${_webgpu_cpp_header}")
|
||||||
message(STATUS "Generating WebGPU-Cpp wrapper...")
|
message(STATUS "Generating WebGPU-Cpp wrapper...")
|
||||||
@@ -167,7 +190,8 @@ if(NOT EXISTS "${_webgpu_cpp_header}")
|
|||||||
COMMAND ${PYTHON_EXECUTABLE} generate.py
|
COMMAND ${PYTHON_EXECUTABLE} generate.py
|
||||||
--use-init-macros
|
--use-init-macros
|
||||||
--header ${_mln_wgpu_source_dir}/ffi/webgpu-headers/webgpu.h
|
--header ${_mln_wgpu_source_dir}/ffi/webgpu-headers/webgpu.h
|
||||||
WORKING_DIRECTORY ${_webgpu_cpp_dir}
|
--output ${_webgpu_cpp_header}
|
||||||
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/vendor/webgpu-cpp"
|
||||||
RESULT_VARIABLE _gen_result
|
RESULT_VARIABLE _gen_result
|
||||||
OUTPUT_VARIABLE _gen_output
|
OUTPUT_VARIABLE _gen_output
|
||||||
ERROR_VARIABLE _gen_error
|
ERROR_VARIABLE _gen_error
|
||||||
@@ -181,15 +205,9 @@ if(NOT EXISTS "${_webgpu_cpp_header}")
|
|||||||
message(STATUS "Successfully generated WebGPU-Cpp wrapper")
|
message(STATUS "Successfully generated WebGPU-Cpp wrapper")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Create compatibility shims for Dawn header paths if they don't exist
|
|
||||||
set(_compat_shim_dir "${_webgpu_cpp_dir}/wgpu-native/webgpu")
|
|
||||||
set(_compat_shim_header "${_compat_shim_dir}/webgpu_cpp.h")
|
|
||||||
set(_compat_shim_webgpu_h "${_compat_shim_dir}/webgpu.h")
|
|
||||||
|
|
||||||
if(NOT EXISTS "${_compat_shim_header}")
|
if(NOT EXISTS "${_compat_shim_header}")
|
||||||
message(STATUS "Creating WebGPU-Cpp compatibility shim...")
|
message(STATUS "Creating WebGPU-Cpp compatibility shim...")
|
||||||
|
|
||||||
file(MAKE_DIRECTORY "${_compat_shim_dir}")
|
|
||||||
file(WRITE "${_compat_shim_header}"
|
file(WRITE "${_compat_shim_header}"
|
||||||
"#pragma once
|
"#pragma once
|
||||||
// Compatibility shim for Dawn header paths
|
// Compatibility shim for Dawn header paths
|
||||||
@@ -197,7 +215,13 @@ if(NOT EXISTS "${_compat_shim_header}")
|
|||||||
// for both Dawn and wgpu-native backends
|
// for both Dawn and wgpu-native backends
|
||||||
|
|
||||||
// Include the WebGPU-Cpp wrapper
|
// Include the WebGPU-Cpp wrapper
|
||||||
#include \"../../webgpu.hpp\"
|
// TODO: remove this workaround as soon as https://github.com/eliemichel/WebGPU-Cpp/issues/35 is fixed
|
||||||
|
#ifndef _NULLABLE
|
||||||
|
#define _NULLABLE WGPU_NULLABLE
|
||||||
|
#endif
|
||||||
|
#include \"${_webgpu_cpp_header}\"
|
||||||
|
|
||||||
|
#undef _NULLABLE
|
||||||
")
|
")
|
||||||
|
|
||||||
message(STATUS "Successfully created WebGPU-Cpp compatibility shim")
|
message(STATUS "Successfully created WebGPU-Cpp compatibility shim")
|
||||||
@@ -220,7 +244,6 @@ if(NOT EXISTS "${_compat_shim_webgpu_h}")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Also create wgpu.h shim for wgpu-native specific includes
|
# Also create wgpu.h shim for wgpu-native specific includes
|
||||||
set(_compat_shim_wgpu_h "${_compat_shim_dir}/wgpu.h")
|
|
||||||
if(NOT EXISTS "${_compat_shim_wgpu_h}")
|
if(NOT EXISTS "${_compat_shim_wgpu_h}")
|
||||||
message(STATUS "Creating wgpu.h compatibility shim...")
|
message(STATUS "Creating wgpu.h compatibility shim...")
|
||||||
|
|
||||||
@@ -245,10 +268,9 @@ target_link_libraries(mbgl-vendor-wgpu INTERFACE ${WGPU_LIBRARY})
|
|||||||
# Add include directories for webgpu.h, wgpu.h, and C++ wrapper
|
# Add include directories for webgpu.h, wgpu.h, and C++ wrapper
|
||||||
target_include_directories(mbgl-vendor-wgpu
|
target_include_directories(mbgl-vendor-wgpu
|
||||||
SYSTEM INTERFACE
|
SYSTEM INTERFACE
|
||||||
${_webgpu_cpp_dir} # For generated webgpu.hpp
|
${_webgpu-cpp-output_dir} # For webgpu.hpp webgpu/webgpu_cpp.h compatibility shim
|
||||||
${_webgpu_cpp_dir}/wgpu-native # For webgpu/webgpu_cpp.h compatibility shim
|
${_mln_wgpu_source_dir}/ffi/webgpu-headers # webgpu.h
|
||||||
${_mln_wgpu_source_dir}/ffi/webgpu-headers
|
${_mln_wgpu_source_dir}/ffi # wgpu.h
|
||||||
${_mln_wgpu_source_dir}/ffi
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Platform-specific system libraries that wgpu-native needs
|
# Platform-specific system libraries that wgpu-native needs
|
||||||
|
|||||||
Reference in New Issue
Block a user