Compare commits
1 Commits
temp-T1019
...
tmp-drw-sp
Author | SHA1 | Date | |
---|---|---|---|
4847bcdbe1 |
@@ -242,17 +242,17 @@ if(UNIX AND NOT (APPLE OR HAIKU))
|
|||||||
option(WITH_GHOST_X11 "Enable building Blender against X11 for windowing" ON)
|
option(WITH_GHOST_X11 "Enable building Blender against X11 for windowing" ON)
|
||||||
mark_as_advanced(WITH_GHOST_X11)
|
mark_as_advanced(WITH_GHOST_X11)
|
||||||
|
|
||||||
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing" ON)
|
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing (under development)" OFF)
|
||||||
mark_as_advanced(WITH_GHOST_WAYLAND)
|
mark_as_advanced(WITH_GHOST_WAYLAND)
|
||||||
|
|
||||||
if(WITH_GHOST_WAYLAND)
|
if(WITH_GHOST_WAYLAND)
|
||||||
option(WITH_GHOST_WAYLAND_LIBDECOR "Optionally build with LibDecor window decorations" ON)
|
option(WITH_GHOST_WAYLAND_LIBDECOR "Optionally build with LibDecor window decorations" OFF)
|
||||||
mark_as_advanced(WITH_GHOST_WAYLAND_LIBDECOR)
|
mark_as_advanced(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||||
|
|
||||||
option(WITH_GHOST_WAYLAND_DBUS "Optionally build with DBUS support (used for Cursor themes). May hang on startup systems where DBUS is not used." OFF)
|
option(WITH_GHOST_WAYLAND_DBUS "Optionally build with DBUS support (used for Cursor themes). May hang on startup systems where DBUS is not used." OFF)
|
||||||
mark_as_advanced(WITH_GHOST_WAYLAND_DBUS)
|
mark_as_advanced(WITH_GHOST_WAYLAND_DBUS)
|
||||||
|
|
||||||
option(WITH_GHOST_WAYLAND_DYNLOAD "Enable runtime dynamic WAYLAND libraries loading" ON)
|
option(WITH_GHOST_WAYLAND_DYNLOAD "Enable runtime dynamic WAYLAND libraries loading" OFF)
|
||||||
mark_as_advanced(WITH_GHOST_WAYLAND_DYNLOAD)
|
mark_as_advanced(WITH_GHOST_WAYLAND_DYNLOAD)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -1913,25 +1913,9 @@ if(FIRST_RUN)
|
|||||||
info_cfg_option(WITH_INSTALL_PORTABLE)
|
info_cfg_option(WITH_INSTALL_PORTABLE)
|
||||||
info_cfg_option(WITH_MEM_JEMALLOC)
|
info_cfg_option(WITH_MEM_JEMALLOC)
|
||||||
info_cfg_option(WITH_MEM_VALGRIND)
|
info_cfg_option(WITH_MEM_VALGRIND)
|
||||||
|
info_cfg_option(WITH_X11_XF86VMODE)
|
||||||
info_cfg_text("GHOST Options:")
|
info_cfg_option(WITH_X11_XFIXES)
|
||||||
info_cfg_option(WITH_GHOST_DEBUG)
|
info_cfg_option(WITH_X11_XINPUT)
|
||||||
info_cfg_option(WITH_GHOST_SDL)
|
|
||||||
if(UNIX AND NOT APPLE)
|
|
||||||
info_cfg_option(WITH_GHOST_X11)
|
|
||||||
info_cfg_option(WITH_GHOST_WAYLAND)
|
|
||||||
if(WITH_GHOST_X11)
|
|
||||||
info_cfg_option(WITH_GHOST_XDND)
|
|
||||||
info_cfg_option(WITH_X11_XF86VMODE)
|
|
||||||
info_cfg_option(WITH_X11_XFIXES)
|
|
||||||
info_cfg_option(WITH_X11_XINPUT)
|
|
||||||
endif()
|
|
||||||
if(WITH_GHOST_WAYLAND)
|
|
||||||
info_cfg_option(WITH_GHOST_WAYLAND_DYNLOAD)
|
|
||||||
info_cfg_option(WITH_GHOST_WAYLAND_LIBDECOR)
|
|
||||||
info_cfg_option(WITH_GHOST_WAYLAND_DBUS)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
info_cfg_text("Image Formats:")
|
info_cfg_text("Image Formats:")
|
||||||
info_cfg_option(WITH_IMAGE_CINEON)
|
info_cfg_option(WITH_IMAGE_CINEON)
|
||||||
@@ -1972,22 +1956,6 @@ if(FIRST_RUN)
|
|||||||
info_cfg_option(WITH_MOD_OCEANSIM)
|
info_cfg_option(WITH_MOD_OCEANSIM)
|
||||||
info_cfg_option(WITH_MOD_REMESH)
|
info_cfg_option(WITH_MOD_REMESH)
|
||||||
|
|
||||||
if(WITH_CYCLES)
|
|
||||||
info_cfg_text("Cycles:")
|
|
||||||
info_cfg_option(WITH_CYCLES_OSL)
|
|
||||||
info_cfg_option(WITH_CYCLES_EMBREE)
|
|
||||||
info_cfg_option(WITH_CYCLES_PATH_GUIDING)
|
|
||||||
if(NOT APPLE)
|
|
||||||
info_cfg_option(WITH_CYCLES_DEVICE_OPTIX)
|
|
||||||
info_cfg_option(WITH_CYCLES_DEVICE_CUDA)
|
|
||||||
info_cfg_option(WITH_CYCLES_CUDA_BINARIES)
|
|
||||||
info_cfg_option(WITH_CYCLES_DEVICE_HIP)
|
|
||||||
info_cfg_option(WITH_CYCLES_HIP_BINARIES)
|
|
||||||
info_cfg_option(WITH_CYCLES_DEVICE_ONEAPI)
|
|
||||||
info_cfg_option(WITH_CYCLES_ONEAPI_BINARIES)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
info_cfg_text("")
|
info_cfg_text("")
|
||||||
|
|
||||||
message("${_config_msg}")
|
message("${_config_msg}")
|
||||||
|
@@ -172,8 +172,6 @@ if(UNIX AND NOT APPLE)
|
|||||||
include(cmake/wayland_protocols.cmake)
|
include(cmake/wayland_protocols.cmake)
|
||||||
# Can be removed when the build-bot upgrades to v1.20.x or newer.
|
# Can be removed when the build-bot upgrades to v1.20.x or newer.
|
||||||
include(cmake/wayland.cmake)
|
include(cmake/wayland.cmake)
|
||||||
include(cmake/wayland_libdecor.cmake)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(cmake/harvest.cmake)
|
include(cmake/harvest.cmake)
|
||||||
include(cmake/cve_check.cmake)
|
|
||||||
|
@@ -46,7 +46,7 @@ if(UNIX)
|
|||||||
" ${_software_missing}\n"
|
" ${_software_missing}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"On Debian and Ubuntu:\n"
|
"On Debian and Ubuntu:\n"
|
||||||
" apt install autoconf automake bison libtool yasm tcl ninja-build meson python3-mako\n"
|
" apt install autoconf automake libtool yasm tcl ninja-build meson python3-mako\n"
|
||||||
"\n"
|
"\n"
|
||||||
"On macOS (with homebrew):\n"
|
"On macOS (with homebrew):\n"
|
||||||
" brew install autoconf automake bison flex libtool meson ninja pkg-config yasm\n"
|
" brew install autoconf automake bison flex libtool meson ninja pkg-config yasm\n"
|
||||||
|
@@ -1,73 +0,0 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
# CVE Check requirements
|
|
||||||
#
|
|
||||||
# - A working installation of intels cve-bin-tool [1] has to be available in
|
|
||||||
# your path
|
|
||||||
#
|
|
||||||
# - Not strictly required, but highly recommended is obtaining a NVD key from
|
|
||||||
# nist since it significantly speeds up downloading/updating the required
|
|
||||||
# databases one can request a key on the following website:
|
|
||||||
# https://nvd.nist.gov/developers/request-an-api-key
|
|
||||||
|
|
||||||
# Bill of Materials construction
|
|
||||||
#
|
|
||||||
# This constructs a CSV cve-bin-tool [1] can read and process. Sadly
|
|
||||||
# cve-bin-tool at this point does not take a list of CPE's and output a check
|
|
||||||
# based on that list. so we need to pick apart the CPE retrieve the vendor,
|
|
||||||
# product and version tokens and generate a CSV.
|
|
||||||
#
|
|
||||||
# [1] https://github.com/intel/cve-bin-tool
|
|
||||||
|
|
||||||
# Because not all deps are downloaded (ie python packages) but can still have a
|
|
||||||
# xxx_CPE declared loop over all variables and look for variables ending in CPE.
|
|
||||||
|
|
||||||
set(SBOMCONTENTS)
|
|
||||||
get_cmake_property(_variableNames VARIABLES)
|
|
||||||
foreach (_variableName ${_variableNames})
|
|
||||||
if(_variableName MATCHES "CPE$")
|
|
||||||
string(REPLACE ":" ";" CPE_LIST ${${_variableName}})
|
|
||||||
list(GET CPE_LIST 3 CPE_VENDOR)
|
|
||||||
list(GET CPE_LIST 4 CPE_NAME)
|
|
||||||
list(GET CPE_LIST 5 CPE_VERSION)
|
|
||||||
set(SBOMCONTENTS "${SBOMCONTENTS}${CPE_VENDOR},${CPE_NAME},${CPE_VERSION}\n")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/cve_check.csv.in ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv @ONLY)
|
|
||||||
|
|
||||||
# Custom Targets
|
|
||||||
#
|
|
||||||
# This defines two new custom targets one could run in the build folder
|
|
||||||
# `cve_check` which will output the report to the console, and `cve_check_html`
|
|
||||||
# which will write out blender_dependencies.html in the build folder that one
|
|
||||||
# could share with other people or be used to get more information on the
|
|
||||||
# reported CVE's.
|
|
||||||
#
|
|
||||||
# cve-bin-tool takes data from the nist nvd database which rate limits
|
|
||||||
# unauthenticated requests to 1 requests per 6 seconds making the database
|
|
||||||
# download take "quite a bit" of time.
|
|
||||||
#
|
|
||||||
# When adding -DCVE_CHECK_NVD_KEY=your_api_key_here to your cmake invocation
|
|
||||||
# this key will be passed on to cve-bin-tool speeding up the process.
|
|
||||||
#
|
|
||||||
if(DEFINED CVE_CHECK_NVD_KEY)
|
|
||||||
set(NVD_ARGS --nvd-api-key ${CVE_CHECK_NVD_KEY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# This will just report to the console
|
|
||||||
add_custom_target(cve_check
|
|
||||||
COMMAND cve-bin-tool
|
|
||||||
${NVD_ARGS}
|
|
||||||
-i ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
|
|
||||||
--affected-versions
|
|
||||||
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
|
|
||||||
)
|
|
||||||
|
|
||||||
# This will write out blender_dependencies.html
|
|
||||||
add_custom_target(cve_check_html
|
|
||||||
COMMAND cve-bin-tool
|
|
||||||
${NVD_ARGS}
|
|
||||||
-i ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
|
|
||||||
-f html
|
|
||||||
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
|
|
||||||
)
|
|
@@ -1,2 +0,0 @@
|
|||||||
vendor,product,version
|
|
||||||
@SBOMCONTENTS@
|
|
@@ -14,20 +14,6 @@ function(download_source dep)
|
|||||||
else()
|
else()
|
||||||
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
|
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
|
||||||
endif()
|
endif()
|
||||||
# Validate all required variables are set and give an explicit error message
|
|
||||||
# rather than CMake erroring out later on with a more ambigious error.
|
|
||||||
if (NOT DEFINED TARGET_FILE)
|
|
||||||
message(FATAL_ERROR "${dep}_FILE variable not set")
|
|
||||||
endif()
|
|
||||||
if (NOT DEFINED TARGET_HASH)
|
|
||||||
message(FATAL_ERROR "${dep}_HASH variable not set")
|
|
||||||
endif()
|
|
||||||
if (NOT DEFINED TARGET_HASH_TYPE)
|
|
||||||
message(FATAL_ERROR "${dep}_HASH_TYPE variable not set")
|
|
||||||
endif()
|
|
||||||
if (NOT DEFINED TARGET_URI)
|
|
||||||
message(FATAL_ERROR "${dep}_URI variable not set")
|
|
||||||
endif()
|
|
||||||
set(TARGET_FILE ${PACKAGE_DIR}/${TARGET_FILE})
|
set(TARGET_FILE ${PACKAGE_DIR}/${TARGET_FILE})
|
||||||
message("Checking source : ${dep} (${TARGET_FILE})")
|
message("Checking source : ${dep} (${TARGET_FILE})")
|
||||||
if(NOT EXISTS ${TARGET_FILE})
|
if(NOT EXISTS ${TARGET_FILE})
|
||||||
@@ -39,36 +25,6 @@ function(download_source dep)
|
|||||||
SHOW_PROGRESS
|
SHOW_PROGRESS
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(EXISTS ${TARGET_FILE})
|
|
||||||
# Sometimes the download fails, but that is not a
|
|
||||||
# fail condition for "file(DOWNLOAD" it will warn about
|
|
||||||
# a crc mismatch and just carry on, we need to explicitly
|
|
||||||
# catch this and remove the bogus 0 byte file so we can
|
|
||||||
# retry without having to go find the file and manually
|
|
||||||
# delete it.
|
|
||||||
file (SIZE ${TARGET_FILE} TARGET_SIZE)
|
|
||||||
if(${TARGET_SIZE} EQUAL 0)
|
|
||||||
file(REMOVE ${TARGET_FILE})
|
|
||||||
message(FATAL_ERROR "for ${TARGET_FILE} file size 0, download likely failed, deleted...")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# If we are using sources from the blender repo also
|
|
||||||
# validate that the hashes match, this takes a
|
|
||||||
# little more time, but protects us when we are
|
|
||||||
# building a release package and one of the packages
|
|
||||||
# is missing or incorrect.
|
|
||||||
#
|
|
||||||
# For regular platform maintenaince this is not needed
|
|
||||||
# since the actual build of the dep will notify the
|
|
||||||
# platform maintainer if there is a problem with the
|
|
||||||
# source package and refuse to build.
|
|
||||||
if(NOT PACKAGE_USE_UPSTREAM_SOURCES)
|
|
||||||
file(${TARGET_HASH_TYPE} ${TARGET_FILE} LOCAL_HASH)
|
|
||||||
if(NOT ${TARGET_HASH} STREQUAL ${LOCAL_HASH})
|
|
||||||
message(FATAL_ERROR "${TARGET_FILE} ${TARGET_HASH_TYPE} mismatch\nExpected\t: ${TARGET_HASH}\nActual\t: ${LOCAL_HASH}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endfunction(download_source)
|
endfunction(download_source)
|
||||||
|
|
||||||
download_source(ZLIB)
|
download_source(ZLIB)
|
||||||
@@ -95,6 +51,7 @@ download_source(OSL)
|
|||||||
download_source(PYTHON)
|
download_source(PYTHON)
|
||||||
download_source(TBB)
|
download_source(TBB)
|
||||||
download_source(OPENVDB)
|
download_source(OPENVDB)
|
||||||
|
download_source(NANOVDB)
|
||||||
download_source(NUMPY)
|
download_source(NUMPY)
|
||||||
download_source(LAME)
|
download_source(LAME)
|
||||||
download_source(OGG)
|
download_source(OGG)
|
||||||
@@ -133,7 +90,6 @@ download_source(NASM)
|
|||||||
download_source(XR_OPENXR_SDK)
|
download_source(XR_OPENXR_SDK)
|
||||||
download_source(WL_PROTOCOLS)
|
download_source(WL_PROTOCOLS)
|
||||||
download_source(WAYLAND)
|
download_source(WAYLAND)
|
||||||
download_source(WAYLAND_LIBDECOR)
|
|
||||||
download_source(ISPC)
|
download_source(ISPC)
|
||||||
download_source(GMP)
|
download_source(GMP)
|
||||||
download_source(POTRACE)
|
download_source(POTRACE)
|
||||||
|
@@ -118,8 +118,6 @@ else()
|
|||||||
|
|
||||||
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
|
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
|
||||||
harvest(wayland/bin wayland/bin "wayland-scanner")
|
harvest(wayland/bin wayland/bin "wayland-scanner")
|
||||||
harvest(wayland/include wayland/include "*.h")
|
|
||||||
harvest(wayland_libdecor/include wayland_libdecor/include "*.h")
|
|
||||||
else()
|
else()
|
||||||
harvest(blosc/lib openvdb/lib "*.a")
|
harvest(blosc/lib openvdb/lib "*.a")
|
||||||
harvest(xml2/lib opencollada/lib "*.a")
|
harvest(xml2/lib opencollada/lib "*.a")
|
||||||
|
@@ -4,9 +4,11 @@
|
|||||||
# library itself does not depend on them, so should give no problems.
|
# library itself does not depend on them, so should give no problems.
|
||||||
|
|
||||||
set(OPENPGL_EXTRA_ARGS
|
set(OPENPGL_EXTRA_ARGS
|
||||||
|
-DOPENPGL_BUILD_PYTHON=OFF
|
||||||
-DOPENPGL_BUILD_STATIC=ON
|
-DOPENPGL_BUILD_STATIC=ON
|
||||||
-DOPENPGL_TBB_ROOT=${LIBDIR}/tbb
|
-DOPENPGL_TBB_ROOT=${LIBDIR}/tbb
|
||||||
-DTBB_ROOT=${LIBDIR}/tbb
|
-DTBB_ROOT=${LIBDIR}/tbb
|
||||||
|
-Dembree_DIR=${LIBDIR}/embree/lib/cmake/embree-${EMBREE_VERSION}
|
||||||
-DCMAKE_DEBUG_POSTFIX=_d
|
-DCMAKE_DEBUG_POSTFIX=_d
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -29,6 +31,7 @@ ExternalProject_Add(external_openpgl
|
|||||||
add_dependencies(
|
add_dependencies(
|
||||||
external_openpgl
|
external_openpgl
|
||||||
external_tbb
|
external_tbb
|
||||||
|
external_embree
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
@@ -40,7 +43,6 @@ if(WIN32)
|
|||||||
else()
|
else()
|
||||||
ExternalProject_Add_Step(external_openpgl after_install
|
ExternalProject_Add_Step(external_openpgl after_install
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openpgl/lib/openpgl_d.lib ${HARVEST_TARGET}/openpgl/lib/openpgl_d.lib
|
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openpgl/lib/openpgl_d.lib ${HARVEST_TARGET}/openpgl/lib/openpgl_d.lib
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION}/openpgl_Exports-debug.cmake ${HARVEST_TARGET}/openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION}/openpgl_Exports-debug.cmake
|
|
||||||
DEPENDEES install
|
DEPENDEES install
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -101,16 +101,34 @@ else()
|
|||||||
set(LIBPREFIX "lib")
|
set(LIBPREFIX "lib")
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
# Use same Xcode detection as Blender itself.
|
# Let's get the current Xcode dir, to support xcode-select
|
||||||
include(../cmake/platform/platform_apple_xcode.cmake)
|
execute_process(
|
||||||
|
COMMAND xcode-select --print-path
|
||||||
|
OUTPUT_VARIABLE XCODE_DEV_PATH OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND xcodebuild -version -sdk macosx SDKVersion
|
||||||
|
OUTPUT_VARIABLE MACOSX_SDK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||||
|
execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
message(STATUS "Detected native architecture ${ARCHITECTURE}.")
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES "${ARCHITECTURE}")
|
||||||
|
endif()
|
||||||
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
||||||
|
set(OSX_DEPLOYMENT_TARGET 10.13)
|
||||||
|
else()
|
||||||
|
set(OSX_DEPLOYMENT_TARGET 11.00)
|
||||||
|
endif()
|
||||||
|
set(OSX_SYSROOT ${XCODE_DEV_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
|
||||||
|
|
||||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||||
set(BLENDER_PLATFORM_ARM ON)
|
set(BLENDER_PLATFORM_ARM ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
|
set(PLATFORM_CFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
|
||||||
set(PLATFORM_CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
|
set(PLATFORM_CXXFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
|
||||||
set(PLATFORM_LDFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
|
set(PLATFORM_LDFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
|
||||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
||||||
set(PLATFORM_BUILD_TARGET --build=x86_64-apple-darwin17.0.0) # OS X 10.13
|
set(PLATFORM_BUILD_TARGET --build=x86_64-apple-darwin17.0.0) # OS X 10.13
|
||||||
else()
|
else()
|
||||||
@@ -118,8 +136,8 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
set(PLATFORM_CMAKE_FLAGS
|
set(PLATFORM_CMAKE_FLAGS
|
||||||
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
|
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
|
||||||
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
|
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${OSX_DEPLOYMENT_TARGET}
|
||||||
-DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
|
-DCMAKE_OSX_SYSROOT:PATH=${OSX_SYSROOT}
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
|
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
|
||||||
@@ -153,8 +171,8 @@ else()
|
|||||||
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG ${PLATFORM_CXXFLAGS}")
|
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG ${PLATFORM_CXXFLAGS}")
|
||||||
|
|
||||||
set(CONFIGURE_ENV
|
set(CONFIGURE_ENV
|
||||||
export MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} &&
|
export MACOSX_DEPLOYMENT_TARGET=${OSX_DEPLOYMENT_TARGET} &&
|
||||||
export MACOSX_SDK_VERSION=${CMAKE_OSX_DEPLOYMENT_TARGET} &&
|
export MACOSX_SDK_VERSION=${OSX_DEPLOYMENT_TARGET} &&
|
||||||
export CFLAGS=${PLATFORM_CFLAGS} &&
|
export CFLAGS=${PLATFORM_CFLAGS} &&
|
||||||
export CXXFLAGS=${PLATFORM_CXXFLAGS} &&
|
export CXXFLAGS=${PLATFORM_CXXFLAGS} &&
|
||||||
export LDFLAGS=${PLATFORM_LDFLAGS}
|
export LDFLAGS=${PLATFORM_LDFLAGS}
|
||||||
|
@@ -1,19 +1,10 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
# CPE's are used to identify dependencies, for more information on what they
|
|
||||||
# are please see https://nvd.nist.gov/products/cpe
|
|
||||||
#
|
|
||||||
# We use them in combination with cve-bin-tool to scan for known security issues.
|
|
||||||
#
|
|
||||||
# Not all of our dependencies are currently in the nvd database so not all
|
|
||||||
# dependencies have one assigned.
|
|
||||||
|
|
||||||
set(ZLIB_VERSION 1.2.12)
|
set(ZLIB_VERSION 1.2.12)
|
||||||
set(ZLIB_URI https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz)
|
set(ZLIB_URI https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz)
|
||||||
set(ZLIB_HASH 5fc414a9726be31427b440b434d05f78)
|
set(ZLIB_HASH 5fc414a9726be31427b440b434d05f78)
|
||||||
set(ZLIB_HASH_TYPE MD5)
|
set(ZLIB_HASH_TYPE MD5)
|
||||||
set(ZLIB_FILE zlib-${ZLIB_VERSION}.tar.gz)
|
set(ZLIB_FILE zlib-${ZLIB_VERSION}.tar.gz)
|
||||||
set(ZLIB_CPE "cpe:2.3:a:zlib:zlib:${ZLIB_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(OPENAL_VERSION 1.21.1)
|
set(OPENAL_VERSION 1.21.1)
|
||||||
set(OPENAL_URI http://openal-soft.org/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2)
|
set(OPENAL_URI http://openal-soft.org/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2)
|
||||||
@@ -26,14 +17,12 @@ set(PNG_URI http://prdownloads.sourceforge.net/libpng/libpng-${PNG_VERSION}.tar.
|
|||||||
set(PNG_HASH 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca)
|
set(PNG_HASH 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca)
|
||||||
set(PNG_HASH_TYPE SHA256)
|
set(PNG_HASH_TYPE SHA256)
|
||||||
set(PNG_FILE libpng-${PNG_VERSION}.tar.xz)
|
set(PNG_FILE libpng-${PNG_VERSION}.tar.xz)
|
||||||
set(PNG_CPE "cpe:2.3:a:libpng:libpng:${PNG_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(JPEG_VERSION 2.1.3)
|
set(JPEG_VERSION 2.1.3)
|
||||||
set(JPEG_URI https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_VERSION}.tar.gz)
|
set(JPEG_URI https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_VERSION}.tar.gz)
|
||||||
set(JPEG_HASH 627b980fad0573e08e4c3b80b290fc91)
|
set(JPEG_HASH 627b980fad0573e08e4c3b80b290fc91)
|
||||||
set(JPEG_HASH_TYPE MD5)
|
set(JPEG_HASH_TYPE MD5)
|
||||||
set(JPEG_FILE libjpeg-turbo-${JPEG_VERSION}.tar.gz)
|
set(JPEG_FILE libjpeg-turbo-${JPEG_VERSION}.tar.gz)
|
||||||
set(JPEG_CPE "cpe:2.3:a:d.r.commander:libjpeg-turbo:${JPEG_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(BOOST_VERSION 1.78.0)
|
set(BOOST_VERSION 1.78.0)
|
||||||
set(BOOST_VERSION_SHORT 1.78)
|
set(BOOST_VERSION_SHORT 1.78)
|
||||||
@@ -43,14 +32,12 @@ set(BOOST_URI https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION
|
|||||||
set(BOOST_HASH c2f6428ac52b0e5a3c9b2e1d8cc832b5)
|
set(BOOST_HASH c2f6428ac52b0e5a3c9b2e1d8cc832b5)
|
||||||
set(BOOST_HASH_TYPE MD5)
|
set(BOOST_HASH_TYPE MD5)
|
||||||
set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz)
|
set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz)
|
||||||
set(BOOST_CPE "cpe:2.3:a:boost:boost:${BOOST_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(BLOSC_VERSION 1.21.1)
|
set(BLOSC_VERSION 1.21.1)
|
||||||
set(BLOSC_URI https://github.com/Blosc/c-blosc/archive/v${BLOSC_VERSION}.tar.gz)
|
set(BLOSC_URI https://github.com/Blosc/c-blosc/archive/v${BLOSC_VERSION}.tar.gz)
|
||||||
set(BLOSC_HASH 134b55813b1dca57019d2a2dc1f7a923)
|
set(BLOSC_HASH 134b55813b1dca57019d2a2dc1f7a923)
|
||||||
set(BLOSC_HASH_TYPE MD5)
|
set(BLOSC_HASH_TYPE MD5)
|
||||||
set(BLOSC_FILE blosc-${BLOSC_VERSION}.tar.gz)
|
set(BLOSC_FILE blosc-${BLOSC_VERSION}.tar.gz)
|
||||||
set(BLOSC_CPE "cpe:2.3:a:c-blosc2_project:c-blosc2:${BLOSC_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(PTHREADS_VERSION 3.0.0)
|
set(PTHREADS_VERSION 3.0.0)
|
||||||
set(PTHREADS_URI http://prdownloads.sourceforge.net/pthreads4w/pthreads4w-code-v${PTHREADS_VERSION}.zip)
|
set(PTHREADS_URI http://prdownloads.sourceforge.net/pthreads4w/pthreads4w-code-v${PTHREADS_VERSION}.zip)
|
||||||
@@ -63,7 +50,6 @@ set(OPENEXR_URI https://github.com/AcademySoftwareFoundation/openexr/archive/v${
|
|||||||
set(OPENEXR_HASH a92f38eedd43e56c0af56d4852506886)
|
set(OPENEXR_HASH a92f38eedd43e56c0af56d4852506886)
|
||||||
set(OPENEXR_HASH_TYPE MD5)
|
set(OPENEXR_HASH_TYPE MD5)
|
||||||
set(OPENEXR_FILE openexr-${OPENEXR_VERSION}.tar.gz)
|
set(OPENEXR_FILE openexr-${OPENEXR_VERSION}.tar.gz)
|
||||||
set(OPENEXR_CPE "cpe:2.3:a:openexr:openexr:${OPENEXR_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(IMATH_VERSION 3.1.5)
|
set(IMATH_VERSION 3.1.5)
|
||||||
set(IMATH_URI https://github.com/AcademySoftwareFoundation/Imath/archive/v${OPENEXR_VERSION}.tar.gz)
|
set(IMATH_URI https://github.com/AcademySoftwareFoundation/Imath/archive/v${OPENEXR_VERSION}.tar.gz)
|
||||||
@@ -93,7 +79,6 @@ set(FREETYPE_URI http://prdownloads.sourceforge.net/freetype/freetype-${FREETYPE
|
|||||||
set(FREETYPE_HASH bd4e3b007474319909a6b79d50908e85)
|
set(FREETYPE_HASH bd4e3b007474319909a6b79d50908e85)
|
||||||
set(FREETYPE_HASH_TYPE MD5)
|
set(FREETYPE_HASH_TYPE MD5)
|
||||||
set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
|
set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
|
||||||
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(EPOXY_VERSION 1.5.10)
|
set(EPOXY_VERSION 1.5.10)
|
||||||
set(EPOXY_URI https://github.com/anholt/libepoxy/archive/refs/tags/${EPOXY_VERSION}.tar.gz)
|
set(EPOXY_URI https://github.com/anholt/libepoxy/archive/refs/tags/${EPOXY_VERSION}.tar.gz)
|
||||||
@@ -112,7 +97,6 @@ set(ALEMBIC_URI https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.ta
|
|||||||
set(ALEMBIC_HASH 2cd8d6e5a3ac4a014e24a4b04f4fadf9)
|
set(ALEMBIC_HASH 2cd8d6e5a3ac4a014e24a4b04f4fadf9)
|
||||||
set(ALEMBIC_HASH_TYPE MD5)
|
set(ALEMBIC_HASH_TYPE MD5)
|
||||||
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
|
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
|
||||||
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(OPENSUBDIV_VERSION v3_4_4)
|
set(OPENSUBDIV_VERSION v3_4_4)
|
||||||
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
|
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
|
||||||
@@ -125,7 +109,6 @@ set(SDL_URI https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz)
|
|||||||
set(SDL_HASH a53acc02e1cca98c4123229069b67c9e)
|
set(SDL_HASH a53acc02e1cca98c4123229069b67c9e)
|
||||||
set(SDL_HASH_TYPE MD5)
|
set(SDL_HASH_TYPE MD5)
|
||||||
set(SDL_FILE SDL2-${SDL_VERSION}.tar.gz)
|
set(SDL_FILE SDL2-${SDL_VERSION}.tar.gz)
|
||||||
set(SDL_CPE "cpe:2.3:a:libsdl:sdl:${SDL_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(OPENCOLLADA_VERSION v1.6.68)
|
set(OPENCOLLADA_VERSION v1.6.68)
|
||||||
set(OPENCOLLADA_URI https://github.com/KhronosGroup/OpenCOLLADA/archive/${OPENCOLLADA_VERSION}.tar.gz)
|
set(OPENCOLLADA_URI https://github.com/KhronosGroup/OpenCOLLADA/archive/${OPENCOLLADA_VERSION}.tar.gz)
|
||||||
@@ -144,7 +127,6 @@ set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LL
|
|||||||
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
|
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
|
||||||
set(LLVM_HASH_TYPE MD5)
|
set(LLVM_HASH_TYPE MD5)
|
||||||
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
|
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
|
||||||
set(LLVM_CPE "cpe:2.3:a:llvm:compiler:${LLVM_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
# Cloth physics test is crashing due to this bug:
|
# Cloth physics test is crashing due to this bug:
|
||||||
@@ -172,7 +154,6 @@ set(FMT_URI https://github.com/fmtlib/fmt/archive/refs/tags/${FMT_VERSION}.tar.g
|
|||||||
set(FMT_HASH 7bce0e9e022e586b178b150002e7c2339994e3c2bbe44027e9abb0d60f9cce83)
|
set(FMT_HASH 7bce0e9e022e586b178b150002e7c2339994e3c2bbe44027e9abb0d60f9cce83)
|
||||||
set(FMT_HASH_TYPE SHA256)
|
set(FMT_HASH_TYPE SHA256)
|
||||||
set(FMT_FILE fmt-${FMT_VERSION}.tar.gz)
|
set(FMT_FILE fmt-${FMT_VERSION}.tar.gz)
|
||||||
set(FMT_CPE "cpe:2.3:a:fmt:fmt:${FMT_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
# 0.6.2 is currently oiio's preferred version although never versions may be available.
|
# 0.6.2 is currently oiio's preferred version although never versions may be available.
|
||||||
# the preferred version can be found in oiio's externalpackages.cmake
|
# the preferred version can be found in oiio's externalpackages.cmake
|
||||||
@@ -187,7 +168,6 @@ set(TIFF_URI http://download.osgeo.org/libtiff/tiff-${TIFF_VERSION}.tar.gz)
|
|||||||
set(TIFF_HASH 376f17f189e9d02280dfe709b2b2bbea)
|
set(TIFF_HASH 376f17f189e9d02280dfe709b2b2bbea)
|
||||||
set(TIFF_HASH_TYPE MD5)
|
set(TIFF_HASH_TYPE MD5)
|
||||||
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
|
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
|
||||||
set(TIFF_CPE "cpe:2.3:a:libtiff:libtiff:${TIFF_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(OSL_VERSION 1.11.17.0)
|
set(OSL_VERSION 1.11.17.0)
|
||||||
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
|
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
|
||||||
@@ -202,15 +182,12 @@ set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTH
|
|||||||
set(PYTHON_HASH 14e8c22458ed7779a1957b26cde01db9)
|
set(PYTHON_HASH 14e8c22458ed7779a1957b26cde01db9)
|
||||||
set(PYTHON_HASH_TYPE MD5)
|
set(PYTHON_HASH_TYPE MD5)
|
||||||
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
|
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
|
||||||
set(PYTHON_CPE "cpe:2.3:a:python:python:${PYTHON_VERSION}:-:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(TBB_YEAR 2020)
|
set(TBB_VERSION 2020_U3)
|
||||||
set(TBB_VERSION ${TBB_YEAR}_U3)
|
|
||||||
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
|
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
|
||||||
set(TBB_HASH 55ec8df6eae5ed6364a47f0e671e460c)
|
set(TBB_HASH 55ec8df6eae5ed6364a47f0e671e460c)
|
||||||
set(TBB_HASH_TYPE MD5)
|
set(TBB_HASH_TYPE MD5)
|
||||||
set(TBB_FILE oneTBB-${TBB_VERSION}.tar.gz)
|
set(TBB_FILE oneTBB-${TBB_VERSION}.tar.gz)
|
||||||
set(TBB_CPE "cpe:2.3:a:intel:threading_building_blocks:${TBB_YEAR}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(OPENVDB_VERSION 9.0.0)
|
set(OPENVDB_VERSION 9.0.0)
|
||||||
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
|
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
|
||||||
@@ -221,7 +198,6 @@ set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
|
|||||||
set(IDNA_VERSION 3.3)
|
set(IDNA_VERSION 3.3)
|
||||||
set(CHARSET_NORMALIZER_VERSION 2.0.10)
|
set(CHARSET_NORMALIZER_VERSION 2.0.10)
|
||||||
set(URLLIB3_VERSION 1.26.8)
|
set(URLLIB3_VERSION 1.26.8)
|
||||||
set(URLLIB3_CPE "cpe:2.3:a:urllib3:urllib3:${URLLIB3_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
set(CERTIFI_VERSION 2021.10.8)
|
set(CERTIFI_VERSION 2021.10.8)
|
||||||
set(REQUESTS_VERSION 2.27.1)
|
set(REQUESTS_VERSION 2.27.1)
|
||||||
set(CYTHON_VERSION 0.29.26)
|
set(CYTHON_VERSION 0.29.26)
|
||||||
@@ -238,14 +214,12 @@ set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}
|
|||||||
set(NUMPY_HASH 252de134862a27bd66705d29622edbfe)
|
set(NUMPY_HASH 252de134862a27bd66705d29622edbfe)
|
||||||
set(NUMPY_HASH_TYPE MD5)
|
set(NUMPY_HASH_TYPE MD5)
|
||||||
set(NUMPY_FILE numpy-${NUMPY_VERSION}.zip)
|
set(NUMPY_FILE numpy-${NUMPY_VERSION}.zip)
|
||||||
set(NUMPY_CPE "cpe:2.3:a:numpy:numpy:${NUMPY_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(LAME_VERSION 3.100)
|
set(LAME_VERSION 3.100)
|
||||||
set(LAME_URI http://downloads.sourceforge.net/project/lame/lame/3.100/lame-${LAME_VERSION}.tar.gz)
|
set(LAME_URI http://downloads.sourceforge.net/project/lame/lame/3.100/lame-${LAME_VERSION}.tar.gz)
|
||||||
set(LAME_HASH 83e260acbe4389b54fe08e0bdbf7cddb)
|
set(LAME_HASH 83e260acbe4389b54fe08e0bdbf7cddb)
|
||||||
set(LAME_HASH_TYPE MD5)
|
set(LAME_HASH_TYPE MD5)
|
||||||
set(LAME_FILE lame-${LAME_VERSION}.tar.gz)
|
set(LAME_FILE lame-${LAME_VERSION}.tar.gz)
|
||||||
set(LAME_CPE "cpe:2.3:a:lame_project:lame:${LAME_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(OGG_VERSION 1.3.5)
|
set(OGG_VERSION 1.3.5)
|
||||||
set(OGG_URI http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz)
|
set(OGG_URI http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz)
|
||||||
@@ -258,7 +232,6 @@ set(VORBIS_URI http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERS
|
|||||||
set(VORBIS_HASH 0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab)
|
set(VORBIS_HASH 0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab)
|
||||||
set(VORBIS_HASH_TYPE SHA256)
|
set(VORBIS_HASH_TYPE SHA256)
|
||||||
set(VORBIS_FILE libvorbis-${VORBIS_VERSION}.tar.gz)
|
set(VORBIS_FILE libvorbis-${VORBIS_VERSION}.tar.gz)
|
||||||
set(VORBIS_CPE "cpe:2.3:a:xiph.org:libvorbis:${VORBIS_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(THEORA_VERSION 1.1.1)
|
set(THEORA_VERSION 1.1.1)
|
||||||
set(THEORA_URI http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.bz2)
|
set(THEORA_URI http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.bz2)
|
||||||
@@ -271,14 +244,12 @@ set(FLAC_URI http://downloads.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz
|
|||||||
set(FLAC_HASH 8ff0607e75a322dd7cd6ec48f4f225471404ae2730d0ea945127b1355155e737 )
|
set(FLAC_HASH 8ff0607e75a322dd7cd6ec48f4f225471404ae2730d0ea945127b1355155e737 )
|
||||||
set(FLAC_HASH_TYPE SHA256)
|
set(FLAC_HASH_TYPE SHA256)
|
||||||
set(FLAC_FILE flac-${FLAC_VERSION}.tar.xz)
|
set(FLAC_FILE flac-${FLAC_VERSION}.tar.xz)
|
||||||
set(FLAC_CPE "cpe:2.3:a:flac_project:flac:${FLAC_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(VPX_VERSION 1.11.0)
|
set(VPX_VERSION 1.11.0)
|
||||||
set(VPX_URI https://github.com/webmproject/libvpx/archive/v${VPX_VERSION}/libvpx-v${VPX_VERSION}.tar.gz)
|
set(VPX_URI https://github.com/webmproject/libvpx/archive/v${VPX_VERSION}/libvpx-v${VPX_VERSION}.tar.gz)
|
||||||
set(VPX_HASH 965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83)
|
set(VPX_HASH 965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83)
|
||||||
set(VPX_HASH_TYPE SHA256)
|
set(VPX_HASH_TYPE SHA256)
|
||||||
set(VPX_FILE libvpx-v${VPX_VERSION}.tar.gz)
|
set(VPX_FILE libvpx-v${VPX_VERSION}.tar.gz)
|
||||||
set(VPX_CPE "cpe:2.3:a:webmproject:libvpx:${VPX_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(OPUS_VERSION 1.3.1)
|
set(OPUS_VERSION 1.3.1)
|
||||||
set(OPUS_URI https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz)
|
set(OPUS_URI https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz)
|
||||||
@@ -304,14 +275,12 @@ set(OPENJPEG_URI https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSI
|
|||||||
set(OPENJPEG_HASH 8702ba68b442657f11aaeb2b338443ca8d5fb95b0d845757968a7be31ef7f16d)
|
set(OPENJPEG_HASH 8702ba68b442657f11aaeb2b338443ca8d5fb95b0d845757968a7be31ef7f16d)
|
||||||
set(OPENJPEG_HASH_TYPE SHA256)
|
set(OPENJPEG_HASH_TYPE SHA256)
|
||||||
set(OPENJPEG_FILE openjpeg-v${OPENJPEG_VERSION}.tar.gz)
|
set(OPENJPEG_FILE openjpeg-v${OPENJPEG_VERSION}.tar.gz)
|
||||||
set(OPENJPEG_CPE "cpe:2.3:a:uclouvain:openjpeg:${OPENJPEG_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(FFMPEG_VERSION 5.0)
|
set(FFMPEG_VERSION 5.0)
|
||||||
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
|
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
|
||||||
set(FFMPEG_HASH c0130b8db2c763430fd1c6905288d61bc44ee0548ad5fcd2dfd650b88432bed9)
|
set(FFMPEG_HASH c0130b8db2c763430fd1c6905288d61bc44ee0548ad5fcd2dfd650b88432bed9)
|
||||||
set(FFMPEG_HASH_TYPE SHA256)
|
set(FFMPEG_HASH_TYPE SHA256)
|
||||||
set(FFMPEG_FILE ffmpeg-${FFMPEG_VERSION}.tar.bz2)
|
set(FFMPEG_FILE ffmpeg-${FFMPEG_VERSION}.tar.bz2)
|
||||||
set(FFMPEG_CPE "cpe:2.3:a:ffmpeg:ffmpeg:${FFMPEG_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(FFTW_VERSION 3.3.10)
|
set(FFTW_VERSION 3.3.10)
|
||||||
set(FFTW_URI http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz)
|
set(FFTW_URI http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz)
|
||||||
@@ -330,14 +299,12 @@ set(SNDFILE_URI http://www.mega-nerd.com/libsndfile/files/libsndfile-${SNDFILE_V
|
|||||||
set(SNDFILE_HASH 646b5f98ce89ac60cdb060fcd398247c)
|
set(SNDFILE_HASH 646b5f98ce89ac60cdb060fcd398247c)
|
||||||
set(SNDFILE_HASH_TYPE MD5)
|
set(SNDFILE_HASH_TYPE MD5)
|
||||||
set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.gz)
|
set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.gz)
|
||||||
set(SNDFILE_CPE "cpe:2.3:a:libsndfile_project:libsndfile:${SNDFILE_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(WEBP_VERSION 1.2.2)
|
set(WEBP_VERSION 1.2.2)
|
||||||
set(WEBP_URI https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz)
|
set(WEBP_URI https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz)
|
||||||
set(WEBP_HASH b5e2e414a8adee4c25fe56b18dd9c549)
|
set(WEBP_HASH b5e2e414a8adee4c25fe56b18dd9c549)
|
||||||
set(WEBP_HASH_TYPE MD5)
|
set(WEBP_HASH_TYPE MD5)
|
||||||
set(WEBP_FILE libwebp-${WEBP_VERSION}.tar.gz)
|
set(WEBP_FILE libwebp-${WEBP_VERSION}.tar.gz)
|
||||||
set(WEBP_CPE "cpe:2.3:a:webmproject:libwebp:${WEBP_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(SPNAV_VERSION 0.2.3)
|
set(SPNAV_VERSION 0.2.3)
|
||||||
set(SPNAV_URI http://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%20${SPNAV_VERSION}/libspnav-${SPNAV_VERSION}.tar.gz)
|
set(SPNAV_URI http://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%20${SPNAV_VERSION}/libspnav-${SPNAV_VERSION}.tar.gz)
|
||||||
@@ -356,7 +323,6 @@ set(XML2_URI http://xmlsoft.org/sources/libxml2-${XML2_VERSION}.tar.gz)
|
|||||||
set(XML2_HASH 10942a1dc23137a8aa07f0639cbfece5)
|
set(XML2_HASH 10942a1dc23137a8aa07f0639cbfece5)
|
||||||
set(XML2_HASH_TYPE MD5)
|
set(XML2_HASH_TYPE MD5)
|
||||||
set(XML2_FILE libxml2-${XML2_VERSION}.tar.gz)
|
set(XML2_FILE libxml2-${XML2_VERSION}.tar.gz)
|
||||||
set(XML2_CPE "cpe:2.3:a:xmlsoft:libxml2:${XML2_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(TINYXML_VERSION 2_6_2)
|
set(TINYXML_VERSION 2_6_2)
|
||||||
set(TINYXML_VERSION_DOTS 2.6.2)
|
set(TINYXML_VERSION_DOTS 2.6.2)
|
||||||
@@ -364,14 +330,12 @@ set(TINYXML_URI https://nchc.dl.sourceforge.net/project/tinyxml/tinyxml/${TINYXM
|
|||||||
set(TINYXML_HASH c1b864c96804a10526540c664ade67f0)
|
set(TINYXML_HASH c1b864c96804a10526540c664ade67f0)
|
||||||
set(TINYXML_HASH_TYPE MD5)
|
set(TINYXML_HASH_TYPE MD5)
|
||||||
set(TINYXML_FILE tinyxml_${TINYXML_VERSION}.tar.gz)
|
set(TINYXML_FILE tinyxml_${TINYXML_VERSION}.tar.gz)
|
||||||
set(TINYXML_CPE "cpe:2.3:a:tinyxml_project:tinyxml:${TINYXML_VERSION_DOTS}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(YAMLCPP_VERSION 0.6.3)
|
set(YAMLCPP_VERSION 0.6.3)
|
||||||
set(YAMLCPP_URI https://codeload.github.com/jbeder/yaml-cpp/tar.gz/yaml-cpp-${YAMLCPP_VERSION})
|
set(YAMLCPP_URI https://codeload.github.com/jbeder/yaml-cpp/tar.gz/yaml-cpp-${YAMLCPP_VERSION})
|
||||||
set(YAMLCPP_HASH b45bf1089a382e81f6b661062c10d0c2)
|
set(YAMLCPP_HASH b45bf1089a382e81f6b661062c10d0c2)
|
||||||
set(YAMLCPP_HASH_TYPE MD5)
|
set(YAMLCPP_HASH_TYPE MD5)
|
||||||
set(YAMLCPP_FILE yaml-cpp-${YAMLCPP_VERSION}.tar.gz)
|
set(YAMLCPP_FILE yaml-cpp-${YAMLCPP_VERSION}.tar.gz)
|
||||||
set(YAMLCPP "cpe:2.3:a:yaml-cpp_project:yaml-cpp:${YAMLCPP_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(PYSTRING_VERSION v1.1.3)
|
set(PYSTRING_VERSION v1.1.3)
|
||||||
set(PYSTRING_URI https://codeload.github.com/imageworks/pystring/tar.gz/refs/tags/${PYSTRING_VERSION})
|
set(PYSTRING_URI https://codeload.github.com/imageworks/pystring/tar.gz/refs/tags/${PYSTRING_VERSION})
|
||||||
@@ -380,19 +344,16 @@ set(PYSTRING_HASH_TYPE MD5)
|
|||||||
set(PYSTRING_FILE pystring-${PYSTRING_VERSION}.tar.gz)
|
set(PYSTRING_FILE pystring-${PYSTRING_VERSION}.tar.gz)
|
||||||
|
|
||||||
set(EXPAT_VERSION 2_4_4)
|
set(EXPAT_VERSION 2_4_4)
|
||||||
set(EXPAT_VERSION_DOTS 2.4.4)
|
|
||||||
set(EXPAT_URI https://github.com/libexpat/libexpat/archive/R_${EXPAT_VERSION}.tar.gz)
|
set(EXPAT_URI https://github.com/libexpat/libexpat/archive/R_${EXPAT_VERSION}.tar.gz)
|
||||||
set(EXPAT_HASH 2d3e81dee94b452369dc6394ff0f8f98)
|
set(EXPAT_HASH 2d3e81dee94b452369dc6394ff0f8f98)
|
||||||
set(EXPAT_HASH_TYPE MD5)
|
set(EXPAT_HASH_TYPE MD5)
|
||||||
set(EXPAT_FILE libexpat-${EXPAT_VERSION}.tar.gz)
|
set(EXPAT_FILE libexpat-${EXPAT_VERSION}.tar.gz)
|
||||||
set(EXPAT_CPE "cpe:2.3:a:libexpat_project:libexpat:${EXPAT_VERSION_DOTS}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(PUGIXML_VERSION 1.10)
|
set(PUGIXML_VERSION 1.10)
|
||||||
set(PUGIXML_URI https://github.com/zeux/pugixml/archive/v${PUGIXML_VERSION}.tar.gz)
|
set(PUGIXML_URI https://github.com/zeux/pugixml/archive/v${PUGIXML_VERSION}.tar.gz)
|
||||||
set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
|
set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
|
||||||
set(PUGIXML_HASH_TYPE MD5)
|
set(PUGIXML_HASH_TYPE MD5)
|
||||||
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
|
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
|
||||||
set(PUGIXML_CPE "cpe:2.3:a:pugixml_project:pugixml:${PUGIXML_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(FLEXBISON_VERSION 2.5.24)
|
set(FLEXBISON_VERSION 2.5.24)
|
||||||
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
|
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
|
||||||
@@ -415,14 +376,12 @@ set(BZIP2_URI http://http.debian.net/debian/pool/main/b/bzip2/bzip2_${BZIP2_VERS
|
|||||||
set(BZIP2_HASH ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269)
|
set(BZIP2_HASH ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269)
|
||||||
set(BZIP2_HASH_TYPE SHA256)
|
set(BZIP2_HASH_TYPE SHA256)
|
||||||
set(BZIP2_FILE bzip2_${BZIP2_VERSION}.orig.tar.gz)
|
set(BZIP2_FILE bzip2_${BZIP2_VERSION}.orig.tar.gz)
|
||||||
set(BZIP2_CPE "cpe:2.3:a:bzip:bzip2:${BZIP2_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(FFI_VERSION 3.3)
|
set(FFI_VERSION 3.3)
|
||||||
set(FFI_URI https://sourceware.org/pub/libffi/libffi-${FFI_VERSION}.tar.gz)
|
set(FFI_URI https://sourceware.org/pub/libffi/libffi-${FFI_VERSION}.tar.gz)
|
||||||
set(FFI_HASH 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056)
|
set(FFI_HASH 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056)
|
||||||
set(FFI_HASH_TYPE SHA256)
|
set(FFI_HASH_TYPE SHA256)
|
||||||
set(FFI_FILE libffi-${FFI_VERSION}.tar.gz)
|
set(FFI_FILE libffi-${FFI_VERSION}.tar.gz)
|
||||||
set(FFI_CPE "cpe:2.3:a:libffi_project:libffi:${FFI_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(LZMA_VERSION 5.2.5)
|
set(LZMA_VERSION 5.2.5)
|
||||||
set(LZMA_URI https://tukaani.org/xz/xz-${LZMA_VERSION}.tar.bz2)
|
set(LZMA_URI https://tukaani.org/xz/xz-${LZMA_VERSION}.tar.bz2)
|
||||||
@@ -444,14 +403,12 @@ else()
|
|||||||
set(SSL_HASH_TYPE SHA256)
|
set(SSL_HASH_TYPE SHA256)
|
||||||
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
|
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
|
||||||
endif()
|
endif()
|
||||||
set(SSL_CPE "cpe:2.3:a:openssl:openssl:${SSL_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(SQLITE_VERSION 3.31.1)
|
set(SQLITE_VERSION 3.31.1)
|
||||||
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
|
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
|
||||||
set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
|
set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
|
||||||
set(SQLITE_HASH_TYPE SHA1)
|
set(SQLITE_HASH_TYPE SHA1)
|
||||||
set(SQLITE_FILE sqlite-src-3240000.zip)
|
set(SQLITE_FILE sqlite-src-3240000.zip)
|
||||||
set(SQLITE_CPE "cpe:2.3:a:sqlite:sqlite:${SQLITE_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(EMBREE_VERSION 3.13.4)
|
set(EMBREE_VERSION 3.13.4)
|
||||||
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
|
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
|
||||||
@@ -482,14 +439,12 @@ set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
|
|||||||
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
|
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
|
||||||
set(MESA_HASH_TYPE SHA256)
|
set(MESA_HASH_TYPE SHA256)
|
||||||
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
|
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
|
||||||
set(MESA_CPE "cpe:2.3:a:mesa3d:mesa:${MESA_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(NASM_VERSION 2.15.02)
|
set(NASM_VERSION 2.15.02)
|
||||||
set(NASM_URI https://github.com/netwide-assembler/nasm/archive/nasm-${NASM_VERSION}.tar.gz)
|
set(NASM_URI https://github.com/netwide-assembler/nasm/archive/nasm-${NASM_VERSION}.tar.gz)
|
||||||
set(NASM_HASH aded8b796c996a486a56e0515c83e414116decc3b184d88043480b32eb0a8589)
|
set(NASM_HASH aded8b796c996a486a56e0515c83e414116decc3b184d88043480b32eb0a8589)
|
||||||
set(NASM_HASH_TYPE SHA256)
|
set(NASM_HASH_TYPE SHA256)
|
||||||
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
|
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
|
||||||
set(NASM_PCE "cpe:2.3:a:nasm:nasm:${NASM_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(XR_OPENXR_SDK_VERSION 1.0.22)
|
set(XR_OPENXR_SDK_VERSION 1.0.22)
|
||||||
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
|
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
|
||||||
@@ -509,12 +464,6 @@ set(WAYLAND_URI https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.21.0
|
|||||||
set(WAYLAND_HASH f2653a2293bcd882d756c6a83d278903)
|
set(WAYLAND_HASH f2653a2293bcd882d756c6a83d278903)
|
||||||
set(WAYLAND_HASH_TYPE MD5)
|
set(WAYLAND_HASH_TYPE MD5)
|
||||||
|
|
||||||
set(WAYLAND_LIBDECOR_VERSION 0.1.0)
|
|
||||||
set(WAYLAND_LIBDECOR_FILE libdecor-${WAYLAND_LIBDECOR_VERSION}.tar.xz)
|
|
||||||
set(WAYLAND_LIBDECOR_URI https://gitlab.gnome.org/jadahl/libdecor/uploads/81adf91d27620e20bcc5f6b9b312d768/libdecor-${WAYLAND_LIBDECOR_VERSION}.tar.xz )
|
|
||||||
set(WAYLAND_LIBDECOR_HASH 47b59eba76faa3787f0878bf8700e912)
|
|
||||||
set(WAYLAND_LIBDECOR_HASH_TYPE MD5)
|
|
||||||
|
|
||||||
set(ISPC_VERSION v1.17.0)
|
set(ISPC_VERSION v1.17.0)
|
||||||
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
|
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
|
||||||
set(ISPC_HASH 4f476a3109332a77fe839a9014c60ca9)
|
set(ISPC_HASH 4f476a3109332a77fe839a9014c60ca9)
|
||||||
@@ -526,14 +475,12 @@ set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)
|
|||||||
set(GMP_HASH 0b82665c4a92fd2ade7440c13fcaa42b)
|
set(GMP_HASH 0b82665c4a92fd2ade7440c13fcaa42b)
|
||||||
set(GMP_HASH_TYPE MD5)
|
set(GMP_HASH_TYPE MD5)
|
||||||
set(GMP_FILE gmp-${GMP_VERSION}.tar.xz)
|
set(GMP_FILE gmp-${GMP_VERSION}.tar.xz)
|
||||||
set(GMP_CPE "cpe:2.3:a:gmplib:gmp:${GMP_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(POTRACE_VERSION 1.16)
|
set(POTRACE_VERSION 1.16)
|
||||||
set(POTRACE_URI http://potrace.sourceforge.net/download/${POTRACE_VERSION}/potrace-${POTRACE_VERSION}.tar.gz)
|
set(POTRACE_URI http://potrace.sourceforge.net/download/${POTRACE_VERSION}/potrace-${POTRACE_VERSION}.tar.gz)
|
||||||
set(POTRACE_HASH 5f0bd87ddd9a620b0c4e65652ef93d69)
|
set(POTRACE_HASH 5f0bd87ddd9a620b0c4e65652ef93d69)
|
||||||
set(POTRACE_HASH_TYPE MD5)
|
set(POTRACE_HASH_TYPE MD5)
|
||||||
set(POTRACE_FILE potrace-${POTRACE_VERSION}.tar.gz)
|
set(POTRACE_FILE potrace-${POTRACE_VERSION}.tar.gz)
|
||||||
set(POTRACE_CPE "cpe:2.3:a:icoasoft:potrace:${POTRACE_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(HARU_VERSION 2_3_0)
|
set(HARU_VERSION 2_3_0)
|
||||||
set(HARU_URI https://github.com/libharu/libharu/archive/RELEASE_${HARU_VERSION}.tar.gz)
|
set(HARU_URI https://github.com/libharu/libharu/archive/RELEASE_${HARU_VERSION}.tar.gz)
|
||||||
@@ -546,7 +493,6 @@ set(ZSTD_URI https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}
|
|||||||
set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
|
set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
|
||||||
set(ZSTD_HASH_TYPE SHA256)
|
set(ZSTD_HASH_TYPE SHA256)
|
||||||
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
|
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
|
||||||
set(ZSTD_CPE "cpe:2.3:a:facebook:zstandard:${ZSTD_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(SSE2NEON_VERSION fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
|
set(SSE2NEON_VERSION fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
|
||||||
set(SSE2NEON_URI https://github.com/DLTcollab/sse2neon/archive/${SSE2NEON_VERSION}.tar.gz)
|
set(SSE2NEON_URI https://github.com/DLTcollab/sse2neon/archive/${SSE2NEON_VERSION}.tar.gz)
|
||||||
@@ -554,17 +500,16 @@ set(SSE2NEON_HASH 0780253525d299c31775ef95853698d03db9c7739942af8570000f4a25a5d6
|
|||||||
set(SSE2NEON_HASH_TYPE SHA256)
|
set(SSE2NEON_HASH_TYPE SHA256)
|
||||||
set(SSE2NEON_FILE sse2neon-${SSE2NEON_VERSION}.tar.gz)
|
set(SSE2NEON_FILE sse2neon-${SSE2NEON_VERSION}.tar.gz)
|
||||||
|
|
||||||
set(BROTLI_VERSION 1.0.9)
|
set(BROTLI_VERSION v1.0.9)
|
||||||
set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/v${BROTLI_VERSION}.tar.gz)
|
set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/${BROTLI_VERSION}.tar.gz)
|
||||||
set(BROTLI_HASH f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46)
|
set(BROTLI_HASH f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46)
|
||||||
set(BROTLI_HASH_TYPE SHA256)
|
set(BROTLI_HASH_TYPE SHA256)
|
||||||
set(BROTLI_FILE brotli-v${BROTLI_VERSION}.tar.gz)
|
set(BROTLI_FILE brotli-${BROTLI_VERSION}.tar.gz)
|
||||||
set(BROTLI_CPE "cpe:2.3:a:google:brotli:${BROTLI_VERSION}:*:*:*:*:*:*:*")
|
|
||||||
|
|
||||||
set(OPENPGL_VERSION v0.4.0-beta)
|
set(OPENPGL_VERSION v0.3.1-beta)
|
||||||
set(OPENPGL_SHORT_VERSION 0.4.0)
|
set(OPENPGL_SHORT_VERSION 0.3.1)
|
||||||
set(OPENPGL_URI https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/${OPENPGL_VERSION}.tar.gz)
|
set(OPENPGL_URI https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/${OPENPGL_VERSION}.tar.gz)
|
||||||
set(OPENPGL_HASH 58d5b65c533ce6cac3f7e1d51cf169a5411adf356abcd85f04049bbcaecc2e77)
|
set(OPENPGL_HASH 3830098c485c962018932766199527aab453a8029528dbbc04d4454d82431e2c)
|
||||||
set(OPENPGL_HASH_TYPE SHA256)
|
set(OPENPGL_HASH_TYPE SHA256)
|
||||||
set(OPENPGL_FILE openpgl-${OPENPGL_VERSION}.tar.gz)
|
set(OPENPGL_FILE openpgl-${OPENPGL_VERSION}.tar.gz)
|
||||||
|
|
||||||
|
@@ -6,11 +6,9 @@ ExternalProject_Add(external_wayland
|
|||||||
URL_HASH ${WAYLAND_HASH_TYPE}=${WAYLAND_HASH}
|
URL_HASH ${WAYLAND_HASH_TYPE}=${WAYLAND_HASH}
|
||||||
PREFIX ${BUILD_DIR}/wayland
|
PREFIX ${BUILD_DIR}/wayland
|
||||||
PATCH_COMMAND ${PATCH_CMD} -d ${BUILD_DIR}/wayland/src/external_wayland < ${PATCH_DIR}/wayland.diff
|
PATCH_COMMAND ${PATCH_CMD} -d ${BUILD_DIR}/wayland/src/external_wayland < ${PATCH_DIR}/wayland.diff
|
||||||
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own LIBEXPAT & LIBXML2.
|
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own LIBEXPAT.
|
||||||
# Note that passing link args "ffi/lib" should not be needed, but
|
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/expat/lib/pkgconfig
|
||||||
# `pkgconfig` would incorrectly look in "ffi/lib/../lib64" otherwise.
|
meson --prefix ${LIBDIR}/wayland -Ddocumentation=false -Dtests=false -Dlibraries=false . ../external_wayland
|
||||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/expat/lib/pkgconfig:${LIBDIR}/xml2/lib/pkgconfig:${LIBDIR}/ffi/lib/pkgconfig:$PKG_CONFIG_PATH
|
|
||||||
meson --prefix ${LIBDIR}/wayland -Ddocumentation=false -Dtests=false -Dc_link_args=-L${LIBDIR}/ffi/lib . ../external_wayland
|
|
||||||
BUILD_COMMAND ninja
|
BUILD_COMMAND ninja
|
||||||
INSTALL_COMMAND ninja install
|
INSTALL_COMMAND ninja install
|
||||||
)
|
)
|
||||||
@@ -18,6 +16,4 @@ ExternalProject_Add(external_wayland
|
|||||||
add_dependencies(
|
add_dependencies(
|
||||||
external_wayland
|
external_wayland
|
||||||
external_expat
|
external_expat
|
||||||
external_xml2
|
|
||||||
external_ffi
|
|
||||||
)
|
)
|
||||||
|
@@ -1,15 +0,0 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
# NOTE: currently only the header file is extracted, no compilation is needed
|
|
||||||
# as the library is dynamically loaded when found on the system.
|
|
||||||
|
|
||||||
ExternalProject_Add(external_wayland_libdecor
|
|
||||||
URL file://${PACKAGE_DIR}/${WAYLAND_LIBDECOR_FILE}
|
|
||||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
|
||||||
URL_HASH ${WAYLAND_LIBDECOR_HASH_TYPE}=${WAYLAND_LIBDECOR_HASH}
|
|
||||||
PREFIX ${BUILD_DIR}/wayland_libdecor
|
|
||||||
BUILD_COMMAND echo .
|
|
||||||
CONFIGURE_COMMAND echo .
|
|
||||||
INSTALL_COMMAND cp ../external_wayland_libdecor/src/libdecor.h ${LIBDIR}/wayland_libdecor/include/libdecor-0/libdecor.h
|
|
||||||
INSTALL_DIR ${LIBDIR}/wayland_libdecor/include/libdecor-0
|
|
||||||
)
|
|
@@ -5,14 +5,7 @@ ExternalProject_Add(external_wayland_protocols
|
|||||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
URL_HASH ${WL_PROTOCOLS_HASH_TYPE}=${WL_PROTOCOLS_HASH}
|
URL_HASH ${WL_PROTOCOLS_HASH_TYPE}=${WL_PROTOCOLS_HASH}
|
||||||
PREFIX ${BUILD_DIR}/wayland-protocols
|
PREFIX ${BUILD_DIR}/wayland-protocols
|
||||||
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own WAYLAND.
|
CONFIGURE_COMMAND meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
|
||||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/wayland/lib64/pkgconfig:$PKG_CONFIG_PATH
|
|
||||||
meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
|
|
||||||
BUILD_COMMAND ninja
|
BUILD_COMMAND ninja
|
||||||
INSTALL_COMMAND ninja install
|
INSTALL_COMMAND ninja install
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(
|
|
||||||
external_wayland_protocols
|
|
||||||
external_wayland
|
|
||||||
)
|
|
||||||
|
@@ -40,15 +40,15 @@ ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,ver-
|
|||||||
force-all,force-python,force-boost,force-tbb,\
|
force-all,force-python,force-boost,force-tbb,\
|
||||||
force-ocio,force-imath,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
|
force-ocio,force-imath,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
|
||||||
force-ffmpeg,force-opencollada,force-alembic,force-embree,force-oidn,force-usd,\
|
force-ffmpeg,force-opencollada,force-alembic,force-embree,force-oidn,force-usd,\
|
||||||
force-xr-openxr,force-level-zero, force-openpgl,\
|
force-xr-openxr,force-level-zero,\
|
||||||
build-all,build-python,build-boost,build-tbb,\
|
build-all,build-python,build-boost,build-tbb,\
|
||||||
build-ocio,build-imath,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
|
build-ocio,build-imath,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
|
||||||
build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,build-usd,\
|
build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,build-usd,\
|
||||||
build-xr-openxr,build-level-zero, build-openpgl,\
|
build-xr-openxr,build-level-zero,\
|
||||||
skip-python,skip-boost,skip-tbb,\
|
skip-python,skip-boost,skip-tbb,\
|
||||||
skip-ocio,skip-imath,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
|
skip-ocio,skip-imath,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
|
||||||
skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-usd,\
|
skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-usd,\
|
||||||
skip-xr-openxr,skip-level-zero, skip-openpgl \
|
skip-xr-openxr,skip-level-zero \
|
||||||
-- "$@" \
|
-- "$@" \
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
|||||||
Build and install the OpenImageDenoise libraries.
|
Build and install the OpenImageDenoise libraries.
|
||||||
|
|
||||||
--with-nanovdb
|
--with-nanovdb
|
||||||
Build and install the NanoVDB branch of OpenVDB (instead of official release of OpenVDB).
|
Build and install NanoVDB together with OpenVDB.
|
||||||
|
|
||||||
--with-jack
|
--with-jack
|
||||||
Install the jack libraries.
|
Install the jack libraries.
|
||||||
@@ -232,9 +232,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
|||||||
--build-level-zero=<ver>
|
--build-level-zero=<ver>
|
||||||
Force the build of OneAPI Level Zero library.
|
Force the build of OneAPI Level Zero library.
|
||||||
|
|
||||||
--build-openpgl
|
|
||||||
Force the build of OpenPGL library.
|
|
||||||
|
|
||||||
Note about the --build-foo options:
|
Note about the --build-foo options:
|
||||||
* They force the script to prefer building dependencies rather than using available packages.
|
* They force the script to prefer building dependencies rather than using available packages.
|
||||||
This may make things simpler and allow working around some distribution bugs, but on the other hand it will
|
This may make things simpler and allow working around some distribution bugs, but on the other hand it will
|
||||||
@@ -305,9 +302,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
|||||||
--force-level-zero=<ver>
|
--force-level-zero=<ver>
|
||||||
Force the rebuild of OneAPI Level Zero library.
|
Force the rebuild of OneAPI Level Zero library.
|
||||||
|
|
||||||
--force-openpgl
|
|
||||||
Force the rebuild of OpenPGL library.
|
|
||||||
|
|
||||||
Note about the --force-foo options:
|
Note about the --force-foo options:
|
||||||
* They obviously only have an effect if those libraries are built by this script
|
* They obviously only have an effect if those libraries are built by this script
|
||||||
(i.e. if there is no available and satisfactory package)!
|
(i.e. if there is no available and satisfactory package)!
|
||||||
@@ -369,10 +363,7 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
|||||||
Unconditionally skip OpenXR-SDK installation/building.
|
Unconditionally skip OpenXR-SDK installation/building.
|
||||||
|
|
||||||
--skip-level-zero=<ver>
|
--skip-level-zero=<ver>
|
||||||
Unconditionally skip OneAPI Level Zero installation/building.
|
Unconditionally skip OneAPI Level Zero installation/building.\""
|
||||||
|
|
||||||
--skip-openpgl
|
|
||||||
Unconditionally skip OpenPGL installation/building.\""
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Main Vars
|
# Main Vars
|
||||||
@@ -394,7 +385,7 @@ CLANG_FORMAT_VERSION="10.0"
|
|||||||
CLANG_FORMAT_VERSION_MIN="6.0"
|
CLANG_FORMAT_VERSION_MIN="6.0"
|
||||||
CLANG_FORMAT_VERSION_MEX="14.0"
|
CLANG_FORMAT_VERSION_MEX="14.0"
|
||||||
|
|
||||||
PYTHON_VERSION="3.10.2"
|
PYTHON_VERSION="3.10.6"
|
||||||
PYTHON_VERSION_SHORT="3.10"
|
PYTHON_VERSION_SHORT="3.10"
|
||||||
PYTHON_VERSION_MIN="3.10"
|
PYTHON_VERSION_MIN="3.10"
|
||||||
PYTHON_VERSION_MEX="3.12"
|
PYTHON_VERSION_MEX="3.12"
|
||||||
@@ -434,7 +425,7 @@ PYTHON_ZSTANDARD_VERSION_MIN="0.15.2"
|
|||||||
PYTHON_ZSTANDARD_VERSION_MEX="0.20.0"
|
PYTHON_ZSTANDARD_VERSION_MEX="0.20.0"
|
||||||
PYTHON_ZSTANDARD_NAME="zstandard"
|
PYTHON_ZSTANDARD_NAME="zstandard"
|
||||||
|
|
||||||
PYTHON_NUMPY_VERSION="1.22.0"
|
PYTHON_NUMPY_VERSION="1.23.2"
|
||||||
PYTHON_NUMPY_VERSION_MIN="1.14"
|
PYTHON_NUMPY_VERSION_MIN="1.14"
|
||||||
PYTHON_NUMPY_VERSION_MEX="2.0"
|
PYTHON_NUMPY_VERSION_MEX="2.0"
|
||||||
PYTHON_NUMPY_NAME="numpy"
|
PYTHON_NUMPY_NAME="numpy"
|
||||||
@@ -462,8 +453,8 @@ PYTHON_MODULES_PIP=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
BOOST_VERSION="1.78.0"
|
BOOST_VERSION="1.80.0"
|
||||||
BOOST_VERSION_SHORT="1.78"
|
BOOST_VERSION_SHORT="1.80"
|
||||||
BOOST_VERSION_MIN="1.49"
|
BOOST_VERSION_MIN="1.49"
|
||||||
BOOST_VERSION_MEX="2.0"
|
BOOST_VERSION_MEX="2.0"
|
||||||
BOOST_FORCE_BUILD=false
|
BOOST_FORCE_BUILD=false
|
||||||
@@ -505,7 +496,7 @@ OPENEXR_FORCE_REBUILD=false
|
|||||||
OPENEXR_SKIP=false
|
OPENEXR_SKIP=false
|
||||||
_with_built_openexr=false
|
_with_built_openexr=false
|
||||||
|
|
||||||
OIIO_VERSION="2.3.13.0"
|
OIIO_VERSION="2.3.18.0"
|
||||||
OIIO_VERSION_SHORT="2.3"
|
OIIO_VERSION_SHORT="2.3"
|
||||||
OIIO_VERSION_MIN="2.1.12"
|
OIIO_VERSION_MIN="2.1.12"
|
||||||
OIIO_VERSION_MEX="2.4.0"
|
OIIO_VERSION_MEX="2.4.0"
|
||||||
@@ -543,10 +534,10 @@ OSD_SKIP=false
|
|||||||
# OpenVDB needs to be compiled for now
|
# OpenVDB needs to be compiled for now
|
||||||
OPENVDB_BLOSC_VERSION="1.21.1"
|
OPENVDB_BLOSC_VERSION="1.21.1"
|
||||||
|
|
||||||
OPENVDB_VERSION="9.0.0"
|
OPENVDB_VERSION="9.1.0"
|
||||||
OPENVDB_VERSION_SHORT="9.0"
|
OPENVDB_VERSION_SHORT="9.1"
|
||||||
OPENVDB_VERSION_MIN="9.0"
|
OPENVDB_VERSION_MIN="9.0"
|
||||||
OPENVDB_VERSION_MEX="9.1"
|
OPENVDB_VERSION_MEX="9.2"
|
||||||
OPENVDB_FORCE_BUILD=false
|
OPENVDB_FORCE_BUILD=false
|
||||||
OPENVDB_FORCE_REBUILD=false
|
OPENVDB_FORCE_REBUILD=false
|
||||||
OPENVDB_SKIP=false
|
OPENVDB_SKIP=false
|
||||||
@@ -602,14 +593,6 @@ LEVEL_ZERO_FORCE_BUILD=false
|
|||||||
LEVEL_ZERO_FORCE_REBUILD=false
|
LEVEL_ZERO_FORCE_REBUILD=false
|
||||||
LEVEL_ZERO_SKIP=false
|
LEVEL_ZERO_SKIP=false
|
||||||
|
|
||||||
OPENPGL_VERSION="0.3.1"
|
|
||||||
OPENPGL_VERSION_SHORT="0.3"
|
|
||||||
OPENPGL_VERSION_MIN="0.3.1"
|
|
||||||
OPENPGL_VERSION_MEX="0.3.2"
|
|
||||||
OPENPGL_FORCE_BUILD=false
|
|
||||||
OPENPGL_FORCE_REBUILD=false
|
|
||||||
OPENPGL_SKIP=false
|
|
||||||
|
|
||||||
XR_OPENXR_VERSION="1.0.22"
|
XR_OPENXR_VERSION="1.0.22"
|
||||||
XR_OPENXR_VERSION_SHORT="1.0"
|
XR_OPENXR_VERSION_SHORT="1.0"
|
||||||
XR_OPENXR_VERSION_MIN="1.0.8"
|
XR_OPENXR_VERSION_MIN="1.0.8"
|
||||||
@@ -844,7 +827,6 @@ while true; do
|
|||||||
USD_FORCE_BUILD=true
|
USD_FORCE_BUILD=true
|
||||||
XR_OPENXR_FORCE_BUILD=true
|
XR_OPENXR_FORCE_BUILD=true
|
||||||
LEVEL_ZERO_FORCE_BUILD=true
|
LEVEL_ZERO_FORCE_BUILD=true
|
||||||
OPENPGL_FORCE_BUILD=true
|
|
||||||
shift; continue
|
shift; continue
|
||||||
;;
|
;;
|
||||||
--build-python)
|
--build-python)
|
||||||
@@ -905,9 +887,6 @@ while true; do
|
|||||||
--build-level-zero)
|
--build-level-zero)
|
||||||
LEVEL_ZERO_FORCE_BUILD=true; shift; continue
|
LEVEL_ZERO_FORCE_BUILD=true; shift; continue
|
||||||
;;
|
;;
|
||||||
--build-openpgl)
|
|
||||||
OPENPGL_FORCE_BUILD=true; shift; continue
|
|
||||||
;;
|
|
||||||
--force-all)
|
--force-all)
|
||||||
PYTHON_FORCE_REBUILD=true
|
PYTHON_FORCE_REBUILD=true
|
||||||
BOOST_FORCE_REBUILD=true
|
BOOST_FORCE_REBUILD=true
|
||||||
@@ -928,7 +907,6 @@ while true; do
|
|||||||
USD_FORCE_REBUILD=true
|
USD_FORCE_REBUILD=true
|
||||||
XR_OPENXR_FORCE_REBUILD=true
|
XR_OPENXR_FORCE_REBUILD=true
|
||||||
LEVEL_ZERO_FORCE_REBUILD=true
|
LEVEL_ZERO_FORCE_REBUILD=true
|
||||||
OPENPGL_FORCE_REBUILD=true
|
|
||||||
shift; continue
|
shift; continue
|
||||||
;;
|
;;
|
||||||
--force-python)
|
--force-python)
|
||||||
@@ -989,9 +967,6 @@ while true; do
|
|||||||
--force-level-zero)
|
--force-level-zero)
|
||||||
LEVEL_ZERO_FORCE_REBUILD=true; shift; continue
|
LEVEL_ZERO_FORCE_REBUILD=true; shift; continue
|
||||||
;;
|
;;
|
||||||
--force-openpgl)
|
|
||||||
OPENPGL_FORCE_REBUILD=true; shift; continue
|
|
||||||
;;
|
|
||||||
--skip-python)
|
--skip-python)
|
||||||
PYTHON_SKIP=true; shift; continue
|
PYTHON_SKIP=true; shift; continue
|
||||||
;;
|
;;
|
||||||
@@ -1049,9 +1024,6 @@ while true; do
|
|||||||
--skip-level-zero)
|
--skip-level-zero)
|
||||||
LEVEL_ZERO_SKIP=true; shift; continue
|
LEVEL_ZERO_SKIP=true; shift; continue
|
||||||
;;
|
;;
|
||||||
--skip-openpgl)
|
|
||||||
OPENPGL_SKIP=true; shift; continue
|
|
||||||
;;
|
|
||||||
--)
|
--)
|
||||||
# no more arguments to parse
|
# no more arguments to parse
|
||||||
break
|
break
|
||||||
@@ -1201,9 +1173,6 @@ XR_OPENXR_REPO_BRANCH="master"
|
|||||||
|
|
||||||
LEVEL_ZERO_SOURCE=("https://github.com/oneapi-src/level-zero/archive/refs/tags/v${LEVEL_ZERO_VERSION}.tar.gz")
|
LEVEL_ZERO_SOURCE=("https://github.com/oneapi-src/level-zero/archive/refs/tags/v${LEVEL_ZERO_VERSION}.tar.gz")
|
||||||
|
|
||||||
OPENPGL_USE_REPO=false
|
|
||||||
OPENPGL_SOURCE=( "https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/v${OPENPGL_VERSION}-beta.tar.gz" )
|
|
||||||
|
|
||||||
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
|
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
|
||||||
|
|
||||||
# C++11 is required now
|
# C++11 is required now
|
||||||
@@ -1222,7 +1191,7 @@ Those libraries should be available as packages in all recent distributions (opt
|
|||||||
* Basics of dev environment (cmake, gcc, svn , git, ...).
|
* Basics of dev environment (cmake, gcc, svn , git, ...).
|
||||||
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
|
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
|
||||||
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
|
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
|
||||||
* libwayland-client0, libdecor, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
|
* libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
|
||||||
* libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex.
|
* libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex.
|
||||||
* libsdl2, libepoxy, libpugixml, libpotrace, [libgmp], fontconfig, [libharu/libhpdf].\""
|
* libsdl2, libepoxy, libpugixml, libpotrace, [libgmp], fontconfig, [libharu/libhpdf].\""
|
||||||
|
|
||||||
@@ -1258,8 +1227,7 @@ You may also want to build them yourself (optional ones are [between brackets]):
|
|||||||
* [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).
|
* [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).
|
||||||
* [Universal Scene Description $USD_VERSION] (from $USD_SOURCE).
|
* [Universal Scene Description $USD_VERSION] (from $USD_SOURCE).
|
||||||
* [OpenXR-SDK $XR_OPENXR_VERSION] (from $XR_OPENXR_SOURCE).
|
* [OpenXR-SDK $XR_OPENXR_VERSION] (from $XR_OPENXR_SOURCE).
|
||||||
* [OneAPI Level Zero $LEVEL_ZERO_VERSION] (from $LEVEL_ZERO_SOURCE).
|
* [OneAPI Level Zero $LEVEL_ZERO_VERSION] (from $LEVEL_ZERO_SOURCE).\""
|
||||||
* [OpenPGL $OPENPGL_VERSION] (from $OPENPGL_SOURCE).\""
|
|
||||||
|
|
||||||
if [ "$DO_SHOW_DEPS" = true ]; then
|
if [ "$DO_SHOW_DEPS" = true ]; then
|
||||||
PRINT ""
|
PRINT ""
|
||||||
@@ -1693,7 +1661,6 @@ _update_deps_tbb() {
|
|||||||
USD_FORCE_BUILD=true
|
USD_FORCE_BUILD=true
|
||||||
EMBREE_FORCE_BUILD=true
|
EMBREE_FORCE_BUILD=true
|
||||||
OIDN_FORCE_BUILD=true
|
OIDN_FORCE_BUILD=true
|
||||||
OPENPGL_FORCE_BUILD=true
|
|
||||||
fi
|
fi
|
||||||
if [ "$2" = true ]; then
|
if [ "$2" = true ]; then
|
||||||
OSD_FORCE_REBUILD=true
|
OSD_FORCE_REBUILD=true
|
||||||
@@ -1701,7 +1668,6 @@ _update_deps_tbb() {
|
|||||||
USD_FORCE_REBUILD=true
|
USD_FORCE_REBUILD=true
|
||||||
EMBREE_FORCE_REBUILD=true
|
EMBREE_FORCE_REBUILD=true
|
||||||
OIDN_FORCE_REBUILD=true
|
OIDN_FORCE_REBUILD=true
|
||||||
OPENPGL_FORCE_REBUILD=true
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2953,6 +2919,10 @@ compile_OPENVDB() {
|
|||||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
||||||
cmake_d="$cmake_d -D USE_STATIC_DEPENDENCIES=OFF"
|
cmake_d="$cmake_d -D USE_STATIC_DEPENDENCIES=OFF"
|
||||||
cmake_d="$cmake_d -D OPENVDB_BUILD_BINARIES=OFF"
|
cmake_d="$cmake_d -D OPENVDB_BUILD_BINARIES=OFF"
|
||||||
|
# Unfortunately OpenVDB currently forces using recent oneTBB over older versions when it finds it,
|
||||||
|
# even when TBB_ROOT is specified. So have to prevent any check for system library -
|
||||||
|
# in the hope it will not break in some other cases.
|
||||||
|
cmake_d="$cmake_d -D DISABLE_CMAKE_SEARCH_PATHS=ON"
|
||||||
|
|
||||||
if [ "$WITH_NANOVDB" = true ]; then
|
if [ "$WITH_NANOVDB" = true ]; then
|
||||||
cmake_d="$cmake_d -D USE_NANOVDB=ON"
|
cmake_d="$cmake_d -D USE_NANOVDB=ON"
|
||||||
@@ -2965,7 +2935,6 @@ compile_OPENVDB() {
|
|||||||
cmake_d="$cmake_d -D Boost_USE_MULTITHREADED=ON"
|
cmake_d="$cmake_d -D Boost_USE_MULTITHREADED=ON"
|
||||||
cmake_d="$cmake_d -D Boost_NO_SYSTEM_PATHS=ON"
|
cmake_d="$cmake_d -D Boost_NO_SYSTEM_PATHS=ON"
|
||||||
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
|
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
|
||||||
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
|
|
||||||
fi
|
fi
|
||||||
if [ -d $INST/tbb ]; then
|
if [ -d $INST/tbb ]; then
|
||||||
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
|
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
|
||||||
@@ -3229,7 +3198,7 @@ _init_opencollada() {
|
|||||||
_inst_shortcut=$INST/opencollada
|
_inst_shortcut=$INST/opencollada
|
||||||
}
|
}
|
||||||
|
|
||||||
_update_deps_collada() {
|
_update_deps_opencollada() {
|
||||||
:
|
:
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3340,12 +3309,7 @@ _init_embree() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_update_deps_embree() {
|
_update_deps_embree() {
|
||||||
if [ "$1" = true ]; then
|
:
|
||||||
OPENPGL_FORCE_BUILD=true
|
|
||||||
fi
|
|
||||||
if [ "$2" = true ]; then
|
|
||||||
OPENPGL_FORCE_REBUILD=true
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_Embree() {
|
clean_Embree() {
|
||||||
@@ -3364,7 +3328,7 @@ compile_Embree() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# To be changed each time we make edits that would modify the compiled results!
|
# To be changed each time we make edits that would modify the compiled results!
|
||||||
embree_magic=12
|
embree_magic=11
|
||||||
_init_embree
|
_init_embree
|
||||||
|
|
||||||
# Force having own builds for the dependencies.
|
# Force having own builds for the dependencies.
|
||||||
@@ -4001,112 +3965,6 @@ compile_Level_Zero() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Build OpenPGL
|
|
||||||
|
|
||||||
_init_openpgl() {
|
|
||||||
_src=$SRC/openpgl-$OPENPGL_VERSION
|
|
||||||
_git=false
|
|
||||||
_inst=$INST/openpgl-$OPENPGL_VERSION_SHORT
|
|
||||||
_inst_shortcut=$INST/openpgl
|
|
||||||
}
|
|
||||||
|
|
||||||
_update_deps_openpgl() {
|
|
||||||
:
|
|
||||||
}
|
|
||||||
|
|
||||||
clean_OpenPGL() {
|
|
||||||
_init_openpgl
|
|
||||||
if [ -d $_inst ]; then
|
|
||||||
# Force rebuilding the dependencies if needed.
|
|
||||||
_update_deps_openpgl false true
|
|
||||||
fi
|
|
||||||
_clean
|
|
||||||
}
|
|
||||||
|
|
||||||
compile_OpenPGL() {
|
|
||||||
if [ "$NO_BUILD" = true ]; then
|
|
||||||
WARNING "--no-build enabled, OpenPGL will not be compiled!"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# To be changed each time we make edits that would modify the compiled results!
|
|
||||||
openpgl_magic=1
|
|
||||||
_init_openpgl
|
|
||||||
|
|
||||||
# Force having own builds for the dependencies.
|
|
||||||
_update_deps_openpgl true false
|
|
||||||
|
|
||||||
# Clean install if needed!
|
|
||||||
magic_compile_check openpgl-$OPENPGL_VERSION $openpgl_magic
|
|
||||||
if [ $? -eq 1 -o "$OPENPGL_FORCE_REBUILD" = true ]; then
|
|
||||||
clean_OpenPGL
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d $_inst ]; then
|
|
||||||
INFO "Building OpenPGL-$OPENPGL_VERSION"
|
|
||||||
|
|
||||||
# Force rebuilding the dependencies.
|
|
||||||
_update_deps_openpgl true true
|
|
||||||
|
|
||||||
prepare_inst
|
|
||||||
|
|
||||||
if [ ! -d $_src ]; then
|
|
||||||
mkdir -p $SRC
|
|
||||||
download OPENPGL_SOURCE[@] "$_src.tar.gz"
|
|
||||||
INFO "Unpacking OpenPGL-$OPENPGL_VERSION"
|
|
||||||
tar -C $SRC --transform "s,(.*/?)openpgl-$OPENPGL_VERSION-beta[^/]*(.*),\1openpgl-$OPENPGL_VERSION\2,x" \
|
|
||||||
-xf $_src.tar.gz
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $_src
|
|
||||||
|
|
||||||
INFO "$_src"
|
|
||||||
|
|
||||||
# Always refresh the whole build!
|
|
||||||
if [ -d build ]; then
|
|
||||||
rm -rf build
|
|
||||||
fi
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
|
|
||||||
cmake_d="-D CMAKE_BUILD_TYPE=Release"
|
|
||||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
|
||||||
cmake_d="$cmake_d -D OPENPGL_BUILD_STATIC=OFF"
|
|
||||||
cmake_d="$cmake_d -D OPENPGL_BUILD_PYTHON=OFF"
|
|
||||||
cmake_d="$cmake_d -D EMBREE_ISPC_SUPPORT=OFF"
|
|
||||||
if [ -d $INST/tbb ]; then
|
|
||||||
cmake_d="$cmake_d -D OPENPGL_TBB_ROOT=$INST/tbb"
|
|
||||||
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cmake $cmake_d ../
|
|
||||||
|
|
||||||
make -j$THREADS && make install
|
|
||||||
make clean
|
|
||||||
|
|
||||||
if [ ! -d $_inst ]; then
|
|
||||||
ERROR "OpenPGL-$OPENPGL_VERSION failed to compile, exiting"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
magic_compile_set openpgl-$OPENPGL_VERSION $openpgl_magic
|
|
||||||
|
|
||||||
cd $CWD
|
|
||||||
INFO "Done compiling OpenPGL-$OPENPGL_VERSION!"
|
|
||||||
else
|
|
||||||
INFO "Own OpenPGL-$OPENPGL_VERSION is up to date, nothing to do!"
|
|
||||||
INFO "If you want to force rebuild of this lib, use the --force-openpgl option."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d $_inst ]; then
|
|
||||||
_create_inst_shortcut
|
|
||||||
fi
|
|
||||||
|
|
||||||
run_ldconfig "openpgl"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Install on DEB-like
|
# Install on DEB-like
|
||||||
|
|
||||||
@@ -4205,12 +4063,11 @@ install_DEB() {
|
|||||||
_packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
|
_packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
|
||||||
git libfreetype6-dev libfontconfig-dev libx11-dev flex bison libxxf86vm-dev \
|
git libfreetype6-dev libfontconfig-dev libx11-dev flex bison libxxf86vm-dev \
|
||||||
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
|
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
|
||||||
libwayland-dev libdecor-0-dev wayland-protocols libegl-dev libxkbcommon-dev libdbus-1-dev linux-libc-dev \
|
libwayland-dev wayland-protocols libegl-dev libxkbcommon-dev libdbus-1-dev linux-libc-dev \
|
||||||
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
|
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
|
||||||
libopenal-dev libepoxy-dev yasm \
|
libopenal-dev libepoxy-dev yasm \
|
||||||
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
|
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
|
||||||
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev libpystring-dev \
|
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev libpystring-dev"
|
||||||
libglfw3-dev"
|
|
||||||
|
|
||||||
VORBIS_USE=true
|
VORBIS_USE=true
|
||||||
OGG_USE=true
|
OGG_USE=true
|
||||||
@@ -4740,18 +4597,6 @@ install_DEB() {
|
|||||||
PRINT ""
|
PRINT ""
|
||||||
compile_Level_Zero
|
compile_Level_Zero
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PRINT ""
|
|
||||||
if [ "$OPENPGL_SKIP" = true ]; then
|
|
||||||
WARNING "Skipping OpenPGL installation, as requested..."
|
|
||||||
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
|
|
||||||
INFO "Forced OpenPGL building, as requested..."
|
|
||||||
compile_OpenPGL
|
|
||||||
else
|
|
||||||
# No package currently!
|
|
||||||
PRINT ""
|
|
||||||
compile_OpenPGL
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4928,7 +4773,7 @@ install_RPM() {
|
|||||||
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison fontconfig-devel \
|
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison fontconfig-devel \
|
||||||
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
|
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
|
||||||
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
|
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
|
||||||
wayland-devel libdecor-devel wayland-protocols-devel mesa-libEGL-devel libxkbcommon-devel dbus-devel kernel-headers \
|
wayland-devel wayland-protocols-devel mesa-libEGL-devel libxkbcommon-devel dbus-devel kernel-headers \
|
||||||
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
|
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
|
||||||
libepoxy-devel yasm patch \
|
libepoxy-devel yasm patch \
|
||||||
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
|
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
|
||||||
@@ -5459,18 +5304,6 @@ install_RPM() {
|
|||||||
PRINT ""
|
PRINT ""
|
||||||
compile_Level_Zero
|
compile_Level_Zero
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PRINT ""
|
|
||||||
if [ "$OPENPGL_SKIP" = true ]; then
|
|
||||||
WARNING "Skipping OpenPGL installation, as requested..."
|
|
||||||
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
|
|
||||||
INFO "Forced OpenPGL building, as requested..."
|
|
||||||
compile_OpenPGL
|
|
||||||
else
|
|
||||||
# No package currently!
|
|
||||||
PRINT ""
|
|
||||||
compile_OpenPGL
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5582,7 +5415,7 @@ install_ARCH() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
_packages="$BASE_DEVEL git cmake fontconfig flex \
|
_packages="$BASE_DEVEL git cmake fontconfig flex \
|
||||||
libxi libxcursor libxrandr libxinerama libepoxy libdecor libpng libtiff wget openal \
|
libxi libxcursor libxrandr libxinerama libepoxy libpng libtiff wget openal \
|
||||||
$OPENJPEG_DEV yasm sdl2 fftw \
|
$OPENJPEG_DEV yasm sdl2 fftw \
|
||||||
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu \
|
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu \
|
||||||
zstd pystring"
|
zstd pystring"
|
||||||
@@ -6067,18 +5900,6 @@ install_ARCH() {
|
|||||||
PRINT ""
|
PRINT ""
|
||||||
compile_Level_Zero
|
compile_Level_Zero
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PRINT ""
|
|
||||||
if [ "$OPENPGL_SKIP" = true ]; then
|
|
||||||
WARNING "Skipping OpenPGL installation, as requested..."
|
|
||||||
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
|
|
||||||
INFO "Forced OpenPGL building, as requested..."
|
|
||||||
compile_OpenPGL
|
|
||||||
else
|
|
||||||
# No package currently!
|
|
||||||
PRINT ""
|
|
||||||
compile_OpenPGL
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -6261,14 +6082,6 @@ install_OTHER() {
|
|||||||
INFO "Forced Level Zero building, as requested..."
|
INFO "Forced Level Zero building, as requested..."
|
||||||
compile_Level_Zero
|
compile_Level_Zero
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PRINT ""
|
|
||||||
if [ "$OPENPGL_SKIP" = true ]; then
|
|
||||||
WARNING "Skipping OpenPGL installation, as requested..."
|
|
||||||
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
|
|
||||||
INFO "Forced OpenPGL building, as requested..."
|
|
||||||
compile_OpenPGL
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
@@ -6286,7 +6099,7 @@ print_info() {
|
|||||||
_buildargs="-U *SNDFILE* -U PYTHON* -U *BOOST* -U *Boost* -U *TBB*"
|
_buildargs="-U *SNDFILE* -U PYTHON* -U *BOOST* -U *Boost* -U *TBB*"
|
||||||
_buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CLANG* -U *CYCLES*"
|
_buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CLANG* -U *CYCLES*"
|
||||||
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *BLOSC* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC* -U *USD*"
|
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *BLOSC* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC* -U *USD*"
|
||||||
_buildargs="$_buildargs -U *EMBREE* -U *OPENIMAGEDENOISE* -U *OPENXR* -U *OPENPGL*"
|
_buildargs="$_buildargs -U *EMBREE* -U *OPENIMAGEDENOISE* -U *OPENXR*"
|
||||||
|
|
||||||
_1="-D WITH_CODEC_SNDFILE=ON"
|
_1="-D WITH_CODEC_SNDFILE=ON"
|
||||||
PRINT " $_1"
|
PRINT " $_1"
|
||||||
@@ -6405,7 +6218,7 @@ print_info() {
|
|||||||
fi
|
fi
|
||||||
if [ -d $INST/nanovdb ]; then
|
if [ -d $INST/nanovdb ]; then
|
||||||
_1="-D WITH_NANOVDB=ON"
|
_1="-D WITH_NANOVDB=ON"
|
||||||
_2="-D NANOVDB_ROOT_DIR=$INST/nanovdb"
|
_2="-D NANOVDB_ROOT_DIR=$INST/openvdb"
|
||||||
PRINT " $_1"
|
PRINT " $_1"
|
||||||
PRINT " $_2"
|
PRINT " $_2"
|
||||||
_buildargs="$_buildargs $_1 $_2"
|
_buildargs="$_buildargs $_1 $_2"
|
||||||
@@ -6517,16 +6330,6 @@ print_info() {
|
|||||||
#~ fi
|
#~ fi
|
||||||
#~ fi
|
#~ fi
|
||||||
|
|
||||||
if [ "$OPENPGL_SKIP" = false ]; then
|
|
||||||
if [ -d $INST/openpgl ]; then
|
|
||||||
_1="-D openpgl_DIR=$INST/openpgl/lib/cmake/openpgl-$OPENPGL_VERSION"
|
|
||||||
_2="-D WITH_CYCLES_PATH_GUIDING=ON"
|
|
||||||
PRINT " $_1"
|
|
||||||
PRINT " $_2"
|
|
||||||
_buildargs="$_buildargs $_1 $_2"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
PRINT ""
|
PRINT ""
|
||||||
PRINT "Or even simpler, just run (in your blender-source dir):"
|
PRINT "Or even simpler, just run (in your blender-source dir):"
|
||||||
PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
|
PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
|
||||||
|
@@ -1,130 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
# This script is part of the official build environment, see WIKI page for details.
|
|
||||||
# https://wiki.blender.org/wiki/Building_Blender/Other/CentOS7ReleaseEnvironment
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ `id -u` -ne 0 ]; then
|
|
||||||
echo "This script must be run as root"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# yum-config-manager does not come in the default minimal install,
|
|
||||||
# so make sure it is installed and available.
|
|
||||||
yum -y update
|
|
||||||
yum -y install yum-utils
|
|
||||||
|
|
||||||
# Install all the packages needed for a new toolchain.
|
|
||||||
#
|
|
||||||
# NOTE: Keep this separate from the packages install, since otherwise
|
|
||||||
# older toolchain will be installed.
|
|
||||||
yum -y update
|
|
||||||
yum -y install epel-release
|
|
||||||
yum -y install centos-release-scl
|
|
||||||
yum -y install devtoolset-9
|
|
||||||
|
|
||||||
# Install packages needed for Blender's dependencies.
|
|
||||||
PACKAGES_FOR_LIBS=(
|
|
||||||
# Used to checkout Blender's code.
|
|
||||||
git
|
|
||||||
# Used to checkout Blender's `../lib/` directory.
|
|
||||||
subversion
|
|
||||||
# Used to extract packages.
|
|
||||||
bzip2
|
|
||||||
# Used to extract packages.
|
|
||||||
tar
|
|
||||||
# Blender and some dependencies use `cmake`.
|
|
||||||
cmake3
|
|
||||||
# Apply patches from Blender's: `./build_files/build_environment/patches`
|
|
||||||
patch
|
|
||||||
# Use by `cmake` and `autoconf`.
|
|
||||||
make
|
|
||||||
|
|
||||||
# Required by: `external_nasm` which uses an `autoconf` build-system.
|
|
||||||
autoconf
|
|
||||||
automake
|
|
||||||
libtool
|
|
||||||
|
|
||||||
# Meta-build system used by various packages.
|
|
||||||
meson
|
|
||||||
# Builds generated by meson use Ninja for the actual build.
|
|
||||||
ninja-build
|
|
||||||
|
|
||||||
# Required by Blender build option: `WITH_GHOST_X11`.
|
|
||||||
libXrandr-devel
|
|
||||||
libXinerama-devel
|
|
||||||
libXcursor-devel
|
|
||||||
libXi-devel
|
|
||||||
libX11-devel
|
|
||||||
libXt-devel
|
|
||||||
|
|
||||||
# Required by Blender build option: `WITH_GHOST_WAYLAND`.
|
|
||||||
mesa-libEGL-devel
|
|
||||||
# Required by: Blender & `external_opensubdiv` (probably others).
|
|
||||||
mesa-libGL-devel
|
|
||||||
mesa-libGLU-devel
|
|
||||||
|
|
||||||
# Required by: `external_ispc`.
|
|
||||||
zlib-devel
|
|
||||||
# TODO: dependencies build without this, consider removal.
|
|
||||||
rubygem-asciidoctor
|
|
||||||
# TODO: dependencies build without this, consider removal.
|
|
||||||
wget
|
|
||||||
# Required by: `external_sqlite` as a build-time dependency (needed for the `tclsh` command).
|
|
||||||
tcl
|
|
||||||
# Required by: `external_aom`.
|
|
||||||
# TODO: Blender is already building `external_nasm` which is listed as an alternative to `yasm`.
|
|
||||||
# Why are both needed?
|
|
||||||
yasm
|
|
||||||
|
|
||||||
# Required by: `meson` (Python based build system).
|
|
||||||
python36
|
|
||||||
# Required by: `mako` (Python module used for building `external_mesa`)
|
|
||||||
python-setuptools
|
|
||||||
|
|
||||||
# Required by: `external_igc` & `external_osl` as a build-time dependency.
|
|
||||||
bison
|
|
||||||
# Required by: `external_osl` as a build-time dependency.
|
|
||||||
flex
|
|
||||||
# TODO: dependencies build without this, consider removal.
|
|
||||||
ncurses-devel
|
|
||||||
)
|
|
||||||
|
|
||||||
# Additional packages needed for building Blender.
|
|
||||||
PACKAGES_FOR_BLENDER=(
|
|
||||||
# Required by Blender build option: `WITH_GHOST_WAYLAND`.
|
|
||||||
libxkbcommon-devel
|
|
||||||
)
|
|
||||||
|
|
||||||
yum -y install -y ${PACKAGES_FOR_LIBS[@]} ${PACKAGES_FOR_BLENDER[@]}
|
|
||||||
|
|
||||||
# Dependencies for Mesa
|
|
||||||
yum -y install expat-devel
|
|
||||||
python3 -m pip install mako
|
|
||||||
|
|
||||||
# Dependencies for pip (needed for buildbot-worker).
|
|
||||||
yum -y install python36-pip python36-devel
|
|
||||||
|
|
||||||
# Dependencies for asound.
|
|
||||||
yum -y install -y \
|
|
||||||
alsa-lib-devel pulseaudio-libs-devel
|
|
||||||
|
|
||||||
alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10 \
|
|
||||||
--slave /usr/local/bin/ctest ctest /usr/bin/ctest \
|
|
||||||
--slave /usr/local/bin/cpack cpack /usr/bin/cpack \
|
|
||||||
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake \
|
|
||||||
--family cmake
|
|
||||||
|
|
||||||
alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
|
|
||||||
--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
|
|
||||||
--slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \
|
|
||||||
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \
|
|
||||||
--family cmake
|
|
||||||
|
|
||||||
alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
|
|
||||||
--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
|
|
||||||
--slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \
|
|
||||||
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \
|
|
||||||
--family cmake
|
|
@@ -62,13 +62,6 @@ FIND_LIBRARY(SYCL_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
string(REPLACE ".lib" "d.lib" SYCL_LIBRARY_DEBUG ${SYCL_LIBRARY})
|
|
||||||
set(SYCL_LIBRARY_DEBUG ${SYCL_LIBRARY_DEBUG} CACHE FILEPATH "Path to SYCL debug library")
|
|
||||||
else()
|
|
||||||
set(SYCL_LIBRARY_DEBUG ${SYCL_LIBRARY} CACHE FILEPATH "Path to SYCL debug library")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
FIND_PATH(SYCL_INCLUDE_DIR
|
FIND_PATH(SYCL_INCLUDE_DIR
|
||||||
NAMES
|
NAMES
|
||||||
CL/sycl.hpp
|
CL/sycl.hpp
|
||||||
@@ -92,5 +85,4 @@ ENDIF()
|
|||||||
|
|
||||||
MARK_AS_ADVANCED(
|
MARK_AS_ADVANCED(
|
||||||
_SYCL_INCLUDE_PARENT_DIR
|
_SYCL_INCLUDE_PARENT_DIR
|
||||||
SYCL_LIBRARY_DEBUG
|
|
||||||
)
|
)
|
||||||
|
@@ -429,18 +429,6 @@ if(WITH_HARU)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CYCLES AND WITH_CYCLES_PATH_GUIDING)
|
|
||||||
find_package(openpgl QUIET)
|
|
||||||
if(openpgl_FOUND)
|
|
||||||
get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION)
|
|
||||||
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
|
|
||||||
message(STATUS "Found OpenPGL: ${OPENPGL_LIBRARIES}")
|
|
||||||
else()
|
|
||||||
set(WITH_CYCLES_PATH_GUIDING OFF)
|
|
||||||
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(ZSTD_ROOT_DIR ${LIBDIR}/zstd)
|
set(ZSTD_ROOT_DIR ${LIBDIR}/zstd)
|
||||||
find_package(Zstd REQUIRED)
|
find_package(Zstd REQUIRED)
|
||||||
|
|
||||||
|
@@ -329,24 +329,16 @@ if(WITH_CYCLES AND WITH_CYCLES_OSL)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
|
if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||||
set(CYCLES_LEVEL_ZERO ${LIBDIR}/level-zero CACHE PATH "Path to Level Zero installation")
|
set(CYCLES_LEVEL_ZERO ${LIBDIR}/level-zero CACHE PATH "Path to Level Zero installation")
|
||||||
if(EXISTS ${CYCLES_LEVEL_ZERO} AND NOT LEVEL_ZERO_ROOT_DIR)
|
if(EXISTS ${CYCLES_LEVEL_ZERO} AND NOT LEVEL_ZERO_ROOT_DIR)
|
||||||
set(LEVEL_ZERO_ROOT_DIR ${CYCLES_LEVEL_ZERO})
|
set(LEVEL_ZERO_ROOT_DIR ${CYCLES_LEVEL_ZERO})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CYCLES_SYCL ${LIBDIR}/dpcpp CACHE PATH "Path to oneAPI DPC++ compiler")
|
set(CYCLES_SYCL ${LIBDIR}/dpcpp CACHE PATH "Path to DPC++ and SYCL installation")
|
||||||
if(EXISTS ${CYCLES_SYCL} AND NOT SYCL_ROOT_DIR)
|
if(EXISTS ${CYCLES_SYCL} AND NOT SYCL_ROOT_DIR)
|
||||||
set(SYCL_ROOT_DIR ${CYCLES_SYCL})
|
set(SYCL_ROOT_DIR ${CYCLES_SYCL})
|
||||||
endif()
|
endif()
|
||||||
file(GLOB _sycl_runtime_libraries
|
|
||||||
${SYCL_ROOT_DIR}/lib/libsycl.so
|
|
||||||
${SYCL_ROOT_DIR}/lib/libsycl.so.[0-9]
|
|
||||||
${SYCL_ROOT_DIR}/lib/libsycl.so.[0-9].[0-9].[0-9]-[0-9]
|
|
||||||
${SYCL_ROOT_DIR}/lib/libpi_level_zero.so
|
|
||||||
)
|
|
||||||
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries})
|
|
||||||
unset(_sycl_runtime_libraries)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_OPENVDB)
|
if(WITH_OPENVDB)
|
||||||
@@ -592,18 +584,6 @@ if(WITH_HARU)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CYCLES AND WITH_CYCLES_PATH_GUIDING)
|
|
||||||
find_package_wrapper(openpgl)
|
|
||||||
if(openpgl_FOUND)
|
|
||||||
get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION)
|
|
||||||
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
|
|
||||||
message(STATUS "Found OpenPGL: ${OPENPGL_LIBRARIES}")
|
|
||||||
else()
|
|
||||||
set(WITH_CYCLES_PATH_GUIDING OFF)
|
|
||||||
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EXISTS ${LIBDIR})
|
if(EXISTS ${LIBDIR})
|
||||||
without_system_libs_end()
|
without_system_libs_end()
|
||||||
endif()
|
endif()
|
||||||
@@ -699,23 +679,14 @@ endif()
|
|||||||
|
|
||||||
if(WITH_GHOST_WAYLAND)
|
if(WITH_GHOST_WAYLAND)
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(wayland-client wayland-client>=1.12)
|
||||||
|
pkg_check_modules(wayland-egl wayland-egl)
|
||||||
|
pkg_check_modules(wayland-scanner wayland-scanner)
|
||||||
pkg_check_modules(xkbcommon xkbcommon)
|
pkg_check_modules(xkbcommon xkbcommon)
|
||||||
|
pkg_check_modules(wayland-cursor wayland-cursor)
|
||||||
|
pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
|
||||||
|
|
||||||
# When dynamically linked WAYLAND is used and `${LIBDIR}/wayland` is present,
|
if(${wayland-protocols_FOUND})
|
||||||
# there is no need to search for the libraries as they are not needed for building.
|
|
||||||
# Only the headers are needed which can reference the known paths.
|
|
||||||
if(EXISTS "${LIBDIR}/wayland" AND WITH_GHOST_WAYLAND_DYNLOAD)
|
|
||||||
set(_use_system_wayland OFF)
|
|
||||||
else()
|
|
||||||
set(_use_system_wayland ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(_use_system_wayland)
|
|
||||||
pkg_check_modules(wayland-client wayland-client>=1.12)
|
|
||||||
pkg_check_modules(wayland-egl wayland-egl)
|
|
||||||
pkg_check_modules(wayland-scanner wayland-scanner)
|
|
||||||
pkg_check_modules(wayland-cursor wayland-cursor)
|
|
||||||
pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
|
|
||||||
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
|
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
|
||||||
else()
|
else()
|
||||||
# CentOS 7 packages have too old a version, a newer version exist in the
|
# CentOS 7 packages have too old a version, a newer version exist in the
|
||||||
@@ -729,38 +700,29 @@ if(WITH_GHOST_WAYLAND)
|
|||||||
if(EXISTS ${WAYLAND_PROTOCOLS_DIR})
|
if(EXISTS ${WAYLAND_PROTOCOLS_DIR})
|
||||||
set(wayland-protocols_FOUND ON)
|
set(wayland-protocols_FOUND ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(wayland-client_INCLUDE_DIRS "${LIBDIR}/wayland/include")
|
|
||||||
set(wayland-egl_INCLUDE_DIRS "${LIBDIR}/wayland/include")
|
|
||||||
set(wayland-cursor_INCLUDE_DIRS "${LIBDIR}/wayland/include")
|
|
||||||
|
|
||||||
set(wayland-client_FOUND ON)
|
|
||||||
set(wayland-egl_FOUND ON)
|
|
||||||
set(wayland-scanner_FOUND ON)
|
|
||||||
set(wayland-cursor_FOUND ON)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT wayland-client_FOUND)
|
if (NOT ${wayland-client_FOUND})
|
||||||
message(STATUS "wayland-client not found, disabling WITH_GHOST_WAYLAND")
|
message(STATUS "wayland-client not found, disabling WITH_GHOST_WAYLAND")
|
||||||
set(WITH_GHOST_WAYLAND OFF)
|
set(WITH_GHOST_WAYLAND OFF)
|
||||||
endif()
|
endif()
|
||||||
if (NOT wayland-egl_FOUND)
|
if (NOT ${wayland-egl_FOUND})
|
||||||
message(STATUS "wayland-egl not found, disabling WITH_GHOST_WAYLAND")
|
message(STATUS "wayland-egl not found, disabling WITH_GHOST_WAYLAND")
|
||||||
set(WITH_GHOST_WAYLAND OFF)
|
set(WITH_GHOST_WAYLAND OFF)
|
||||||
endif()
|
endif()
|
||||||
if (NOT wayland-scanner_FOUND)
|
if (NOT ${wayland-scanner_FOUND})
|
||||||
message(STATUS "wayland-scanner not found, disabling WITH_GHOST_WAYLAND")
|
message(STATUS "wayland-scanner not found, disabling WITH_GHOST_WAYLAND")
|
||||||
set(WITH_GHOST_WAYLAND OFF)
|
set(WITH_GHOST_WAYLAND OFF)
|
||||||
endif()
|
endif()
|
||||||
if (NOT wayland-cursor_FOUND)
|
if (NOT ${wayland-cursor_FOUND})
|
||||||
message(STATUS "wayland-cursor not found, disabling WITH_GHOST_WAYLAND")
|
message(STATUS "wayland-cursor not found, disabling WITH_GHOST_WAYLAND")
|
||||||
set(WITH_GHOST_WAYLAND OFF)
|
set(WITH_GHOST_WAYLAND OFF)
|
||||||
endif()
|
endif()
|
||||||
if (NOT wayland-protocols_FOUND)
|
if (NOT ${wayland-protocols_FOUND})
|
||||||
message(STATUS "wayland-protocols not found, disabling WITH_GHOST_WAYLAND")
|
message(STATUS "wayland-protocols not found, disabling WITH_GHOST_WAYLAND")
|
||||||
set(WITH_GHOST_WAYLAND OFF)
|
set(WITH_GHOST_WAYLAND OFF)
|
||||||
endif()
|
endif()
|
||||||
if (NOT xkbcommon_FOUND)
|
if (NOT ${xkbcommon_FOUND})
|
||||||
message(STATUS "xkbcommon not found, disabling WITH_GHOST_WAYLAND")
|
message(STATUS "xkbcommon not found, disabling WITH_GHOST_WAYLAND")
|
||||||
set(WITH_GHOST_WAYLAND OFF)
|
set(WITH_GHOST_WAYLAND OFF)
|
||||||
endif()
|
endif()
|
||||||
@@ -771,18 +733,34 @@ if(WITH_GHOST_WAYLAND)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||||
if(_use_system_wayland)
|
pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1)
|
||||||
pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1)
|
endif()
|
||||||
else()
|
|
||||||
set(libdecor_INCLUDE_DIRS "${LIBDIR}/wayland_libdecor/include/libdecor-0")
|
list(APPEND PLATFORM_LINKLIBS
|
||||||
endif()
|
${xkbcommon_LINK_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
|
||||||
|
list(APPEND PLATFORM_LINKLIBS
|
||||||
|
${wayland-client_LINK_LIBRARIES}
|
||||||
|
${wayland-egl_LINK_LIBRARIES}
|
||||||
|
${wayland-cursor_LINK_LIBRARIES}
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_GHOST_WAYLAND_DBUS)
|
if(WITH_GHOST_WAYLAND_DBUS)
|
||||||
|
list(APPEND PLATFORM_LINKLIBS
|
||||||
|
${dbus_LINK_LIBRARIES}
|
||||||
|
)
|
||||||
add_definitions(-DWITH_GHOST_WAYLAND_DBUS)
|
add_definitions(-DWITH_GHOST_WAYLAND_DBUS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||||
|
if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
|
||||||
|
list(APPEND PLATFORM_LINKLIBS
|
||||||
|
${libdecor_LIBRARIES}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR)
|
add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -825,8 +803,6 @@ if(WITH_GHOST_WAYLAND)
|
|||||||
# End wayland-scanner version check.
|
# End wayland-scanner version check.
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
unset(_use_system_wayland)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_GHOST_X11)
|
if(WITH_GHOST_X11)
|
||||||
@@ -835,8 +811,12 @@ if(WITH_GHOST_X11)
|
|||||||
find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
|
find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
|
||||||
mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
|
mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
|
||||||
|
|
||||||
|
list(APPEND PLATFORM_LINKLIBS ${X11_X11_LIB})
|
||||||
|
|
||||||
if(WITH_X11_XINPUT)
|
if(WITH_X11_XINPUT)
|
||||||
if(NOT X11_Xinput_LIB)
|
if(X11_Xinput_LIB)
|
||||||
|
list(APPEND PLATFORM_LINKLIBS ${X11_Xinput_LIB})
|
||||||
|
else()
|
||||||
message(FATAL_ERROR "LibXi not found. Disable WITH_X11_XINPUT if you
|
message(FATAL_ERROR "LibXi not found. Disable WITH_X11_XINPUT if you
|
||||||
want to build without tablet support")
|
want to build without tablet support")
|
||||||
endif()
|
endif()
|
||||||
@@ -846,14 +826,18 @@ if(WITH_GHOST_X11)
|
|||||||
# XXX, why doesn't cmake make this available?
|
# XXX, why doesn't cmake make this available?
|
||||||
find_library(X11_Xxf86vmode_LIB Xxf86vm ${X11_LIB_SEARCH_PATH})
|
find_library(X11_Xxf86vmode_LIB Xxf86vm ${X11_LIB_SEARCH_PATH})
|
||||||
mark_as_advanced(X11_Xxf86vmode_LIB)
|
mark_as_advanced(X11_Xxf86vmode_LIB)
|
||||||
if(NOT X11_Xxf86vmode_LIB)
|
if(X11_Xxf86vmode_LIB)
|
||||||
|
list(APPEND PLATFORM_LINKLIBS ${X11_Xxf86vmode_LIB})
|
||||||
|
else()
|
||||||
message(FATAL_ERROR "libXxf86vm not found. Disable WITH_X11_XF86VMODE if you
|
message(FATAL_ERROR "libXxf86vm not found. Disable WITH_X11_XF86VMODE if you
|
||||||
want to build without")
|
want to build without")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_X11_XFIXES)
|
if(WITH_X11_XFIXES)
|
||||||
if(NOT X11_Xfixes_LIB)
|
if(X11_Xfixes_LIB)
|
||||||
|
list(APPEND PLATFORM_LINKLIBS ${X11_Xfixes_LIB})
|
||||||
|
else()
|
||||||
message(FATAL_ERROR "libXfixes not found. Disable WITH_X11_XFIXES if you
|
message(FATAL_ERROR "libXfixes not found. Disable WITH_X11_XFIXES if you
|
||||||
want to build without")
|
want to build without")
|
||||||
endif()
|
endif()
|
||||||
@@ -862,7 +846,9 @@ if(WITH_GHOST_X11)
|
|||||||
if(WITH_X11_ALPHA)
|
if(WITH_X11_ALPHA)
|
||||||
find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
|
find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
|
||||||
mark_as_advanced(X11_Xrender_LIB)
|
mark_as_advanced(X11_Xrender_LIB)
|
||||||
if(NOT X11_Xrender_LIB)
|
if(X11_Xrender_LIB)
|
||||||
|
list(APPEND PLATFORM_LINKLIBS ${X11_Xrender_LIB})
|
||||||
|
else()
|
||||||
message(FATAL_ERROR "libXrender not found. Disable WITH_X11_ALPHA if you
|
message(FATAL_ERROR "libXrender not found. Disable WITH_X11_ALPHA if you
|
||||||
want to build without")
|
want to build without")
|
||||||
endif()
|
endif()
|
||||||
|
@@ -936,39 +936,8 @@ if(WITH_HARU)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CYCLES AND WITH_CYCLES_PATH_GUIDING)
|
|
||||||
find_package(openpgl QUIET)
|
|
||||||
if(openpgl_FOUND)
|
|
||||||
get_target_property(OPENPGL_LIBRARIES_RELEASE openpgl::openpgl LOCATION_RELEASE)
|
|
||||||
get_target_property(OPENPGL_LIBRARIES_DEBUG openpgl::openpgl LOCATION_DEBUG)
|
|
||||||
set(OPENPGL_LIBRARIES optimized ${OPENPGL_LIBRARIES_RELEASE} debug ${OPENPGL_LIBRARIES_DEBUG})
|
|
||||||
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
|
|
||||||
else()
|
|
||||||
set(WITH_CYCLES_PATH_GUIDING OFF)
|
|
||||||
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(ZSTD_INCLUDE_DIRS ${LIBDIR}/zstd/include)
|
set(ZSTD_INCLUDE_DIRS ${LIBDIR}/zstd/include)
|
||||||
set(ZSTD_LIBRARIES ${LIBDIR}/zstd/lib/zstd_static.lib)
|
set(ZSTD_LIBRARIES ${LIBDIR}/zstd/lib/zstd_static.lib)
|
||||||
|
|
||||||
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
|
set(LEVEL_ZERO_ROOT_DIR ${LIBDIR}/level_zero)
|
||||||
set(LEVEL_ZERO_ROOT_DIR ${LIBDIR}/level_zero)
|
set(SYCL_ROOT_DIR ${LIBDIR}/dpcpp)
|
||||||
set(CYCLES_SYCL ${LIBDIR}/dpcpp CACHE PATH "Path to oneAPI DPC++ compiler")
|
|
||||||
if(EXISTS ${CYCLES_SYCL} AND NOT SYCL_ROOT_DIR)
|
|
||||||
set(SYCL_ROOT_DIR ${CYCLES_SYCL})
|
|
||||||
endif()
|
|
||||||
file(GLOB _sycl_runtime_libraries_glob
|
|
||||||
${SYCL_ROOT_DIR}/bin/sycl.dll
|
|
||||||
${SYCL_ROOT_DIR}/bin/sycl[0-9].dll
|
|
||||||
)
|
|
||||||
foreach(sycl_runtime_library IN LISTS _sycl_runtime_libraries_glob)
|
|
||||||
string(REPLACE ".dll" "$<$<CONFIG:Debug>:d>.dll" sycl_runtime_library ${sycl_runtime_library})
|
|
||||||
list(APPEND _sycl_runtime_libraries ${sycl_runtime_library})
|
|
||||||
endforeach()
|
|
||||||
unset(_sycl_runtime_libraries_glob)
|
|
||||||
|
|
||||||
list(APPEND _sycl_runtime_libraries ${SYCL_ROOT_DIR}/bin/pi_level_zero.dll)
|
|
||||||
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries})
|
|
||||||
unset(_sycl_runtime_libraries)
|
|
||||||
endif()
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
sphinx==5.2.3
|
sphinx==5.1.1
|
||||||
|
|
||||||
# Sphinx dependencies that are important
|
# Sphinx dependencies that are important
|
||||||
Jinja2==3.1.2
|
Jinja2==3.1.2
|
||||||
@@ -6,7 +6,7 @@ Pygments==2.13.0
|
|||||||
docutils==0.17.1
|
docutils==0.17.1
|
||||||
snowballstemmer==2.2.0
|
snowballstemmer==2.2.0
|
||||||
babel==2.10.3
|
babel==2.10.3
|
||||||
requests==2.28.1
|
requests==2.27.1
|
||||||
|
|
||||||
# Only needed to match the theme used for the official documentation.
|
# Only needed to match the theme used for the official documentation.
|
||||||
# Without this theme, the default theme will be used.
|
# Without this theme, the default theme will be used.
|
||||||
|
@@ -7,7 +7,6 @@ set(INC
|
|||||||
../../mikktspace
|
../../mikktspace
|
||||||
../../../source/blender/makesdna
|
../../../source/blender/makesdna
|
||||||
../../../source/blender/makesrna
|
../../../source/blender/makesrna
|
||||||
../../../source/blender/blenkernel
|
|
||||||
../../../source/blender/blenlib
|
../../../source/blender/blenlib
|
||||||
../../../source/blender/gpu
|
../../../source/blender/gpu
|
||||||
../../../source/blender/render
|
../../../source/blender/render
|
||||||
|
@@ -525,8 +525,8 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
|||||||
|
|
||||||
use_deterministic_guiding: BoolProperty(
|
use_deterministic_guiding: BoolProperty(
|
||||||
name="Deterministic",
|
name="Deterministic",
|
||||||
description="Makes path guiding deterministic which means renderings will be "
|
description="Makes path guiding deterministic which means renderings will be"
|
||||||
"reproducible with the same pixel values every time. This feature slows down "
|
"reproducible with the same pixel values every time. This feature slows down"
|
||||||
"training",
|
"training",
|
||||||
default=True,
|
default=True,
|
||||||
)
|
)
|
||||||
@@ -562,7 +562,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
|||||||
description="The maximum number of samples used for training path guiding. "
|
description="The maximum number of samples used for training path guiding. "
|
||||||
"Higher samples lead to more accurate guiding, however may also unnecessarily slow "
|
"Higher samples lead to more accurate guiding, however may also unnecessarily slow "
|
||||||
"down rendering once guiding is accurate enough. "
|
"down rendering once guiding is accurate enough. "
|
||||||
"A value of 0 will continue training until the last sample",
|
"A value 0 will continue training until the last sample",
|
||||||
min=0,
|
min=0,
|
||||||
soft_min=1,
|
soft_min=1,
|
||||||
default=128,
|
default=128,
|
||||||
|
@@ -1880,12 +1880,6 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
|
|||||||
layout.prop(rd, "use_bake_multires")
|
layout.prop(rd, "use_bake_multires")
|
||||||
layout.prop(cscene, "bake_type")
|
layout.prop(cscene, "bake_type")
|
||||||
|
|
||||||
if not rd.use_bake_multires and cscene.bake_type not in {
|
|
||||||
"AO", "POSITION", "NORMAL", "UV", "ROUGHNESS", "ENVIRONMENT"}:
|
|
||||||
row = layout.row()
|
|
||||||
row.prop(cbk, "view_from")
|
|
||||||
row.active = scene.camera is not None
|
|
||||||
|
|
||||||
|
|
||||||
class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
|
class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
|
||||||
bl_label = "Influence"
|
bl_label = "Influence"
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
* Copyright 2011-2022 Blender Foundation */
|
* Copyright 2011-2022 Blender Foundation */
|
||||||
|
|
||||||
#include "scene/camera.h"
|
#include "scene/camera.h"
|
||||||
#include "scene/bake.h"
|
|
||||||
#include "scene/scene.h"
|
#include "scene/scene.h"
|
||||||
|
|
||||||
#include "blender/sync.h"
|
#include "blender/sync.h"
|
||||||
@@ -593,11 +592,6 @@ void BlenderSync::sync_camera(BL::RenderSettings &b_render,
|
|||||||
blender_camera_from_object(&bcam, b_engine, b_ob);
|
blender_camera_from_object(&bcam, b_engine, b_ob);
|
||||||
b_engine.camera_model_matrix(b_ob, bcam.use_spherical_stereo, b_ob_matrix);
|
b_engine.camera_model_matrix(b_ob, bcam.use_spherical_stereo, b_ob_matrix);
|
||||||
bcam.matrix = get_transform(b_ob_matrix);
|
bcam.matrix = get_transform(b_ob_matrix);
|
||||||
scene->bake_manager->set_use_camera(b_render.bake().view_from() ==
|
|
||||||
BL::BakeSettings::view_from_ACTIVE_CAMERA);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
scene->bake_manager->set_use_camera(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sync */
|
/* sync */
|
||||||
|
@@ -20,7 +20,7 @@ CCL_NAMESPACE_BEGIN
|
|||||||
* Utility class to map between Blender datablocks and Cycles data structures,
|
* Utility class to map between Blender datablocks and Cycles data structures,
|
||||||
* and keep track of recalc tags from the dependency graph. */
|
* and keep track of recalc tags from the dependency graph. */
|
||||||
|
|
||||||
template<typename K, typename T, typename Flags = uint> class id_map {
|
template<typename K, typename T> class id_map {
|
||||||
public:
|
public:
|
||||||
id_map(Scene *scene_) : scene(scene_)
|
id_map(Scene *scene_) : scene(scene_)
|
||||||
{
|
{
|
||||||
@@ -63,11 +63,6 @@ template<typename K, typename T, typename Flags = uint> class id_map {
|
|||||||
b_recalc.insert(id_ptr);
|
b_recalc.insert(id_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_recalc(const BL::ID &id)
|
|
||||||
{
|
|
||||||
return id.ptr.data && b_recalc.find(id.ptr.data) != b_recalc.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool has_recalc()
|
bool has_recalc()
|
||||||
{
|
{
|
||||||
return !(b_recalc.empty());
|
return !(b_recalc.empty());
|
||||||
@@ -159,7 +154,6 @@ template<typename K, typename T, typename Flags = uint> class id_map {
|
|||||||
TMapPair &pair = *jt;
|
TMapPair &pair = *jt;
|
||||||
|
|
||||||
if (do_delete && used_set.find(pair.second) == used_set.end()) {
|
if (do_delete && used_set.find(pair.second) == used_set.end()) {
|
||||||
flags.erase(pair.second);
|
|
||||||
scene->delete_node(pair.second);
|
scene->delete_node(pair.second);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -177,33 +171,9 @@ template<typename K, typename T, typename Flags = uint> class id_map {
|
|||||||
return b_map;
|
return b_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool test_flag(T *data, Flags val)
|
|
||||||
{
|
|
||||||
typename map<T *, uint>::iterator it = flags.find(data);
|
|
||||||
return it != flags.end() && (it->second & (1 << val)) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_flag(T *data, Flags val)
|
|
||||||
{
|
|
||||||
flags[data] |= (1 << val);
|
|
||||||
}
|
|
||||||
|
|
||||||
void clear_flag(T *data, Flags val)
|
|
||||||
{
|
|
||||||
typename map<T *, uint>::iterator it = flags.find(data);
|
|
||||||
if (it != flags.end()) {
|
|
||||||
it->second &= ~(1 << val);
|
|
||||||
|
|
||||||
if (it->second == 0) {
|
|
||||||
flags.erase(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
map<K, T *> b_map;
|
map<K, T *> b_map;
|
||||||
set<T *> used_set;
|
set<T *> used_set;
|
||||||
map<T *, uint> flags;
|
|
||||||
set<void *> b_recalc;
|
set<void *> b_recalc;
|
||||||
Scene *scene;
|
Scene *scene;
|
||||||
};
|
};
|
||||||
|
@@ -23,8 +23,6 @@
|
|||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/task.h"
|
#include "util/task.h"
|
||||||
|
|
||||||
#include "BKE_duplilist.h"
|
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
/* Utilities */
|
/* Utilities */
|
||||||
@@ -96,13 +94,6 @@ bool BlenderSync::object_is_light(BL::Object &b_ob)
|
|||||||
return (b_ob_data && b_ob_data.is_a(&RNA_Light));
|
return (b_ob_data && b_ob_data.is_a(&RNA_Light));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlenderSync::object_is_camera(BL::Object &b_ob)
|
|
||||||
{
|
|
||||||
BL::ID b_ob_data = b_ob.data();
|
|
||||||
|
|
||||||
return (b_ob_data && b_ob_data.is_a(&RNA_Camera));
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlenderSync::sync_object_motion_init(BL::Object &b_parent, BL::Object &b_ob, Object *object)
|
void BlenderSync::sync_object_motion_init(BL::Object &b_parent, BL::Object &b_ob, Object *object)
|
||||||
{
|
{
|
||||||
/* Initialize motion blur for object, detecting if it's enabled and creating motion
|
/* Initialize motion blur for object, detecting if it's enabled and creating motion
|
||||||
@@ -362,26 +353,79 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" DupliObject *rna_hack_DepsgraphObjectInstance_dupli_object_get(PointerRNA *ptr);
|
/* This function mirrors drw_uniform_property_lookup in draw_instance_data.cpp */
|
||||||
|
static bool lookup_property(BL::ID b_id, const string &name, float4 *r_value)
|
||||||
|
{
|
||||||
|
PointerRNA ptr;
|
||||||
|
PropertyRNA *prop;
|
||||||
|
|
||||||
|
if (!RNA_path_resolve(&b_id.ptr, name.c_str(), &ptr, &prop)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prop == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyType type = RNA_property_type(prop);
|
||||||
|
int arraylen = RNA_property_array_length(&ptr, prop);
|
||||||
|
|
||||||
|
if (arraylen == 0) {
|
||||||
|
float value;
|
||||||
|
|
||||||
|
if (type == PROP_FLOAT)
|
||||||
|
value = RNA_property_float_get(&ptr, prop);
|
||||||
|
else if (type == PROP_INT)
|
||||||
|
value = static_cast<float>(RNA_property_int_get(&ptr, prop));
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
*r_value = make_float4(value, value, value, 1.0f);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (type == PROP_FLOAT && arraylen <= 4) {
|
||||||
|
*r_value = make_float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
RNA_property_float_get_array(&ptr, prop, &r_value->x);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This function mirrors drw_uniform_attribute_lookup in draw_instance_data.cpp */
|
||||||
static float4 lookup_instance_property(BL::DepsgraphObjectInstance &b_instance,
|
static float4 lookup_instance_property(BL::DepsgraphObjectInstance &b_instance,
|
||||||
const string &name,
|
const string &name,
|
||||||
bool use_instancer)
|
bool use_instancer)
|
||||||
{
|
{
|
||||||
::Object *ob = (::Object *)b_instance.object().ptr.data;
|
string idprop_name = string_printf("[\"%s\"]", name.c_str());
|
||||||
::DupliObject *dupli = nullptr;
|
float4 value;
|
||||||
::Object *dupli_parent = nullptr;
|
|
||||||
|
|
||||||
/* If requesting instance data, check the parent particle system and object. */
|
/* If requesting instance data, check the parent particle system and object. */
|
||||||
if (use_instancer && b_instance.is_instance()) {
|
if (use_instancer && b_instance.is_instance()) {
|
||||||
dupli = rna_hack_DepsgraphObjectInstance_dupli_object_get(&b_instance.ptr);
|
BL::ParticleSystem b_psys = b_instance.particle_system();
|
||||||
dupli_parent = (::Object *)b_instance.parent().ptr.data;
|
|
||||||
|
if (b_psys) {
|
||||||
|
if (lookup_property(b_psys.settings(), idprop_name, &value) ||
|
||||||
|
lookup_property(b_psys.settings(), name, &value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lookup_property(b_instance.parent(), idprop_name, &value) ||
|
||||||
|
lookup_property(b_instance.parent(), name, &value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float4 value;
|
/* Check the object and mesh. */
|
||||||
BKE_object_dupli_find_rgba_attribute(ob, dupli, dupli_parent, name.c_str(), &value.x);
|
BL::Object b_ob = b_instance.object();
|
||||||
|
BL::ID b_data = b_ob.data();
|
||||||
|
|
||||||
return value;
|
if (lookup_property(b_ob, idprop_name, &value) || lookup_property(b_ob, name, &value) ||
|
||||||
|
lookup_property(b_data, idprop_name, &value) || lookup_property(b_data, name, &value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return zero_float4();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance, Object *object)
|
bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance, Object *object)
|
||||||
@@ -407,8 +451,7 @@ bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance
|
|||||||
std::string real_name;
|
std::string real_name;
|
||||||
BlenderAttributeType type = blender_attribute_name_split_type(name, &real_name);
|
BlenderAttributeType type = blender_attribute_name_split_type(name, &real_name);
|
||||||
|
|
||||||
if (type == BL::ShaderNodeAttribute::attribute_type_OBJECT ||
|
if (type != BL::ShaderNodeAttribute::attribute_type_GEOMETRY) {
|
||||||
type == BL::ShaderNodeAttribute::attribute_type_INSTANCER) {
|
|
||||||
bool use_instancer = (type == BL::ShaderNodeAttribute::attribute_type_INSTANCER);
|
bool use_instancer = (type == BL::ShaderNodeAttribute::attribute_type_INSTANCER);
|
||||||
float4 value = lookup_instance_property(b_instance, real_name, use_instancer);
|
float4 value = lookup_instance_property(b_instance, real_name, use_instancer);
|
||||||
|
|
||||||
|
@@ -194,7 +194,7 @@ static void export_pointcloud(Scene *scene,
|
|||||||
/* Export points. */
|
/* Export points. */
|
||||||
for (int i = 0; i < num_points; i++) {
|
for (int i = 0; i < num_points; i++) {
|
||||||
const float3 co = get_float3(b_attr_position.data[i].vector());
|
const float3 co = get_float3(b_attr_position.data[i].vector());
|
||||||
const float radius = b_attr_radius ? b_attr_radius->data[i].value() : 0.01f;
|
const float radius = b_attr_radius ? b_attr_radius->data[i].value() : 0.0f;
|
||||||
pointcloud->add_point(co, radius);
|
pointcloud->add_point(co, radius);
|
||||||
|
|
||||||
/* Random number per point. */
|
/* Random number per point. */
|
||||||
@@ -232,7 +232,7 @@ static void export_pointcloud_motion(PointCloud *pointcloud,
|
|||||||
|
|
||||||
for (int i = 0; i < std::min(num_points, b_points_num); i++) {
|
for (int i = 0; i < std::min(num_points, b_points_num); i++) {
|
||||||
const float3 co = get_float3(b_attr_position.data[i].vector());
|
const float3 co = get_float3(b_attr_position.data[i].vector());
|
||||||
const float radius = b_attr_radius ? b_attr_radius->data[i].value() : 0.01f;
|
const float radius = b_attr_radius ? b_attr_radius->data[i].value() : 0.0f;
|
||||||
float3 P = co;
|
float3 P = co;
|
||||||
P.w = radius;
|
P.w = radius;
|
||||||
mP[i] = P;
|
mP[i] = P;
|
||||||
|
@@ -60,8 +60,7 @@ BlenderSession::BlenderSession(BL::RenderEngine &b_engine,
|
|||||||
height(0),
|
height(0),
|
||||||
preview_osl(preview_osl),
|
preview_osl(preview_osl),
|
||||||
python_thread_state(NULL),
|
python_thread_state(NULL),
|
||||||
use_developer_ui(b_userpref.experimental().use_cycles_debug() &&
|
use_developer_ui(false)
|
||||||
b_userpref.view().show_developer_ui())
|
|
||||||
{
|
{
|
||||||
/* offline render */
|
/* offline render */
|
||||||
background = true;
|
background = true;
|
||||||
|
@@ -22,8 +22,6 @@
|
|||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
#include "util/task.h"
|
#include "util/task.h"
|
||||||
|
|
||||||
#include "BKE_duplilist.h"
|
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
typedef map<void *, ShaderInput *> PtrInputMap;
|
typedef map<void *, ShaderInput *> PtrInputMap;
|
||||||
@@ -105,7 +103,6 @@ static ImageAlphaType get_image_alpha_type(BL::Image &b_image)
|
|||||||
|
|
||||||
static const string_view object_attr_prefix("\x01object:");
|
static const string_view object_attr_prefix("\x01object:");
|
||||||
static const string_view instancer_attr_prefix("\x01instancer:");
|
static const string_view instancer_attr_prefix("\x01instancer:");
|
||||||
static const string_view view_layer_attr_prefix("\x01layer:");
|
|
||||||
|
|
||||||
static ustring blender_attribute_name_add_type(const string &name, BlenderAttributeType type)
|
static ustring blender_attribute_name_add_type(const string &name, BlenderAttributeType type)
|
||||||
{
|
{
|
||||||
@@ -114,8 +111,6 @@ static ustring blender_attribute_name_add_type(const string &name, BlenderAttrib
|
|||||||
return ustring::concat(object_attr_prefix, name);
|
return ustring::concat(object_attr_prefix, name);
|
||||||
case BL::ShaderNodeAttribute::attribute_type_INSTANCER:
|
case BL::ShaderNodeAttribute::attribute_type_INSTANCER:
|
||||||
return ustring::concat(instancer_attr_prefix, name);
|
return ustring::concat(instancer_attr_prefix, name);
|
||||||
case BL::ShaderNodeAttribute::attribute_type_VIEW_LAYER:
|
|
||||||
return ustring::concat(view_layer_attr_prefix, name);
|
|
||||||
default:
|
default:
|
||||||
return ustring(name);
|
return ustring(name);
|
||||||
}
|
}
|
||||||
@@ -135,11 +130,6 @@ BlenderAttributeType blender_attribute_name_split_type(ustring name, string *r_r
|
|||||||
return BL::ShaderNodeAttribute::attribute_type_INSTANCER;
|
return BL::ShaderNodeAttribute::attribute_type_INSTANCER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sname.substr(0, view_layer_attr_prefix.size()) == view_layer_attr_prefix) {
|
|
||||||
*r_real_name = sname.substr(view_layer_attr_prefix.size());
|
|
||||||
return BL::ShaderNodeAttribute::attribute_type_VIEW_LAYER;
|
|
||||||
}
|
|
||||||
|
|
||||||
return BL::ShaderNodeAttribute::attribute_type_GEOMETRY;
|
return BL::ShaderNodeAttribute::attribute_type_GEOMETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,9 +205,7 @@ static void set_default_value(ShaderInput *input,
|
|||||||
}
|
}
|
||||||
case SocketType::INT: {
|
case SocketType::INT: {
|
||||||
if (b_sock.type() == BL::NodeSocket::type_BOOLEAN) {
|
if (b_sock.type() == BL::NodeSocket::type_BOOLEAN) {
|
||||||
/* Make sure to call the int overload of set() since this is an integer socket as far as
|
node->set(socket, get_boolean(b_sock.ptr, "default_value"));
|
||||||
* Cycles is concerned. */
|
|
||||||
node->set(socket, get_boolean(b_sock.ptr, "default_value") ? 1 : 0);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
node->set(socket, get_int(b_sock.ptr, "default_value"));
|
node->set(socket, get_int(b_sock.ptr, "default_value"));
|
||||||
@@ -1432,89 +1420,6 @@ static void add_nodes(Scene *scene,
|
|||||||
empty_proxy_map);
|
empty_proxy_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look up and constant fold all references to View Layer attributes. */
|
|
||||||
void BlenderSync::resolve_view_layer_attributes(Shader *shader,
|
|
||||||
ShaderGraph *graph,
|
|
||||||
BL::Depsgraph &b_depsgraph)
|
|
||||||
{
|
|
||||||
bool updated = false;
|
|
||||||
|
|
||||||
foreach (ShaderNode *node, graph->nodes) {
|
|
||||||
if (node->is_a(AttributeNode::node_type)) {
|
|
||||||
AttributeNode *attr_node = static_cast<AttributeNode *>(node);
|
|
||||||
|
|
||||||
std::string real_name;
|
|
||||||
BlenderAttributeType type = blender_attribute_name_split_type(attr_node->get_attribute(),
|
|
||||||
&real_name);
|
|
||||||
|
|
||||||
if (type == BL::ShaderNodeAttribute::attribute_type_VIEW_LAYER) {
|
|
||||||
/* Look up the value. */
|
|
||||||
BL::ViewLayer b_layer = b_depsgraph.view_layer_eval();
|
|
||||||
BL::Scene b_scene = b_depsgraph.scene_eval();
|
|
||||||
float4 value;
|
|
||||||
|
|
||||||
BKE_view_layer_find_rgba_attribute((::Scene *)b_scene.ptr.data,
|
|
||||||
(::ViewLayer *)b_layer.ptr.data,
|
|
||||||
real_name.c_str(),
|
|
||||||
&value.x);
|
|
||||||
|
|
||||||
/* Replace all outgoing links, using appropriate output types. */
|
|
||||||
float val_avg = (value.x + value.y + value.z) / 3.0f;
|
|
||||||
|
|
||||||
foreach (ShaderOutput *output, node->outputs) {
|
|
||||||
float val_float;
|
|
||||||
float3 val_float3;
|
|
||||||
|
|
||||||
if (output->type() == SocketType::FLOAT) {
|
|
||||||
val_float = (output->name() == "Alpha") ? value.w : val_avg;
|
|
||||||
val_float3 = make_float3(val_float);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
val_float = val_avg;
|
|
||||||
val_float3 = float4_to_float3(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (ShaderInput *sock, output->links) {
|
|
||||||
if (sock->type() == SocketType::FLOAT) {
|
|
||||||
sock->set(val_float);
|
|
||||||
}
|
|
||||||
else if (SocketType::is_float3(sock->type())) {
|
|
||||||
sock->set(val_float3);
|
|
||||||
}
|
|
||||||
|
|
||||||
sock->constant_folded_in = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
graph->disconnect(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear the attribute name to avoid further attempts to look up. */
|
|
||||||
attr_node->set_attribute(ustring());
|
|
||||||
updated = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updated) {
|
|
||||||
shader_map.set_flag(shader, SHADER_WITH_LAYER_ATTRS);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
shader_map.clear_flag(shader, SHADER_WITH_LAYER_ATTRS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlenderSync::scene_attr_needs_recalc(Shader *shader, BL::Depsgraph &b_depsgraph)
|
|
||||||
{
|
|
||||||
if (shader && shader_map.test_flag(shader, SHADER_WITH_LAYER_ATTRS)) {
|
|
||||||
BL::Scene scene = b_depsgraph.scene_eval();
|
|
||||||
|
|
||||||
return shader_map.check_recalc(scene) || shader_map.check_recalc(scene.world()) ||
|
|
||||||
shader_map.check_recalc(scene.camera());
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sync Materials */
|
/* Sync Materials */
|
||||||
|
|
||||||
void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
|
void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
|
||||||
@@ -1533,8 +1438,7 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
|
|||||||
Shader *shader;
|
Shader *shader;
|
||||||
|
|
||||||
/* test if we need to sync */
|
/* test if we need to sync */
|
||||||
if (shader_map.add_or_update(&shader, b_mat) || update_all ||
|
if (shader_map.add_or_update(&shader, b_mat) || update_all) {
|
||||||
scene_attr_needs_recalc(shader, b_depsgraph)) {
|
|
||||||
ShaderGraph *graph = new ShaderGraph();
|
ShaderGraph *graph = new ShaderGraph();
|
||||||
|
|
||||||
shader->name = b_mat.name().c_str();
|
shader->name = b_mat.name().c_str();
|
||||||
@@ -1555,8 +1459,6 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
|
|||||||
graph->connect(diffuse->output("BSDF"), out->input("Surface"));
|
graph->connect(diffuse->output("BSDF"), out->input("Surface"));
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_view_layer_attributes(shader, graph, b_depsgraph);
|
|
||||||
|
|
||||||
/* settings */
|
/* settings */
|
||||||
PointerRNA cmat = RNA_pointer_get(&b_mat.ptr, "cycles");
|
PointerRNA cmat = RNA_pointer_get(&b_mat.ptr, "cycles");
|
||||||
shader->set_use_mis(get_boolean(cmat, "sample_as_light"));
|
shader->set_use_mis(get_boolean(cmat, "sample_as_light"));
|
||||||
@@ -1613,11 +1515,9 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
|
|||||||
|
|
||||||
BlenderViewportParameters new_viewport_parameters(b_v3d, use_developer_ui);
|
BlenderViewportParameters new_viewport_parameters(b_v3d, use_developer_ui);
|
||||||
|
|
||||||
Shader *shader = scene->default_background;
|
|
||||||
|
|
||||||
if (world_recalc || update_all || b_world.ptr.data != world_map ||
|
if (world_recalc || update_all || b_world.ptr.data != world_map ||
|
||||||
viewport_parameters.shader_modified(new_viewport_parameters) ||
|
viewport_parameters.shader_modified(new_viewport_parameters)) {
|
||||||
scene_attr_needs_recalc(shader, b_depsgraph)) {
|
Shader *shader = scene->default_background;
|
||||||
ShaderGraph *graph = new ShaderGraph();
|
ShaderGraph *graph = new ShaderGraph();
|
||||||
|
|
||||||
/* create nodes */
|
/* create nodes */
|
||||||
@@ -1715,8 +1615,6 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
|
|||||||
background->set_visibility(visibility);
|
background->set_visibility(visibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_view_layer_attributes(shader, graph, b_depsgraph);
|
|
||||||
|
|
||||||
shader->set_graph(graph);
|
shader->set_graph(graph);
|
||||||
shader->tag_update(scene);
|
shader->tag_update(scene);
|
||||||
}
|
}
|
||||||
@@ -1783,8 +1681,7 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all)
|
|||||||
Shader *shader;
|
Shader *shader;
|
||||||
|
|
||||||
/* test if we need to sync */
|
/* test if we need to sync */
|
||||||
if (shader_map.add_or_update(&shader, b_light) || update_all ||
|
if (shader_map.add_or_update(&shader, b_light) || update_all) {
|
||||||
scene_attr_needs_recalc(shader, b_depsgraph)) {
|
|
||||||
ShaderGraph *graph = new ShaderGraph();
|
ShaderGraph *graph = new ShaderGraph();
|
||||||
|
|
||||||
/* create nodes */
|
/* create nodes */
|
||||||
@@ -1805,8 +1702,6 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all)
|
|||||||
graph->connect(emission->output("Emission"), out->input("Surface"));
|
graph->connect(emission->output("Emission"), out->input("Surface"));
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_view_layer_attributes(shader, graph, b_depsgraph);
|
|
||||||
|
|
||||||
shader->set_graph(graph);
|
shader->set_graph(graph);
|
||||||
shader->tag_update(scene);
|
shader->tag_update(scene);
|
||||||
}
|
}
|
||||||
|
@@ -206,9 +206,6 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (object_is_camera(b_ob)) {
|
|
||||||
shader_map.set_recalc(b_ob);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Mesh */
|
/* Mesh */
|
||||||
else if (b_id.is_a(&RNA_Mesh)) {
|
else if (b_id.is_a(&RNA_Mesh)) {
|
||||||
@@ -221,11 +218,6 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
|
|||||||
if (world_map == b_world.ptr.data) {
|
if (world_map == b_world.ptr.data) {
|
||||||
world_recalc = true;
|
world_recalc = true;
|
||||||
}
|
}
|
||||||
shader_map.set_recalc(b_world);
|
|
||||||
}
|
|
||||||
/* World */
|
|
||||||
else if (b_id.is_a(&RNA_Scene)) {
|
|
||||||
shader_map.set_recalc(b_id);
|
|
||||||
}
|
}
|
||||||
/* Volume */
|
/* Volume */
|
||||||
else if (b_id.is_a(&RNA_Volume)) {
|
else if (b_id.is_a(&RNA_Volume)) {
|
||||||
|
@@ -120,11 +120,6 @@ class BlenderSync {
|
|||||||
void sync_shaders(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, bool update_all);
|
void sync_shaders(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, bool update_all);
|
||||||
void sync_nodes(Shader *shader, BL::ShaderNodeTree &b_ntree);
|
void sync_nodes(Shader *shader, BL::ShaderNodeTree &b_ntree);
|
||||||
|
|
||||||
bool scene_attr_needs_recalc(Shader *shader, BL::Depsgraph &b_depsgraph);
|
|
||||||
void resolve_view_layer_attributes(Shader *shader,
|
|
||||||
ShaderGraph *graph,
|
|
||||||
BL::Depsgraph &b_depsgraph);
|
|
||||||
|
|
||||||
/* Object */
|
/* Object */
|
||||||
Object *sync_object(BL::Depsgraph &b_depsgraph,
|
Object *sync_object(BL::Depsgraph &b_depsgraph,
|
||||||
BL::ViewLayer &b_view_layer,
|
BL::ViewLayer &b_view_layer,
|
||||||
@@ -212,16 +207,13 @@ class BlenderSync {
|
|||||||
bool object_is_geometry(BObjectInfo &b_ob_info);
|
bool object_is_geometry(BObjectInfo &b_ob_info);
|
||||||
bool object_can_have_geometry(BL::Object &b_ob);
|
bool object_can_have_geometry(BL::Object &b_ob);
|
||||||
bool object_is_light(BL::Object &b_ob);
|
bool object_is_light(BL::Object &b_ob);
|
||||||
bool object_is_camera(BL::Object &b_ob);
|
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
BL::RenderEngine b_engine;
|
BL::RenderEngine b_engine;
|
||||||
BL::BlendData b_data;
|
BL::BlendData b_data;
|
||||||
BL::Scene b_scene;
|
BL::Scene b_scene;
|
||||||
|
|
||||||
enum ShaderFlags { SHADER_WITH_LAYER_ATTRS };
|
id_map<void *, Shader> shader_map;
|
||||||
|
|
||||||
id_map<void *, Shader, ShaderFlags> shader_map;
|
|
||||||
id_map<ObjectKey, Object> object_map;
|
id_map<ObjectKey, Object> object_map;
|
||||||
id_map<void *, Procedural> procedural_map;
|
id_map<void *, Procedural> procedural_map;
|
||||||
id_map<GeometryKey, Geometry> geometry_map;
|
id_map<GeometryKey, Geometry> geometry_map;
|
||||||
|
@@ -104,6 +104,10 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
|||||||
else()
|
else()
|
||||||
unset(_cycles_lib_dir)
|
unset(_cycles_lib_dir)
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
if(EXISTS ${LIBDIR})
|
||||||
|
set(_cycles_lib_dir ${LIBDIR})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
@@ -273,8 +277,8 @@ endif()
|
|||||||
# OpenPGL
|
# OpenPGL
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_PATH_GUIDING)
|
if(WITH_CYCLES_PATH_GUIDING)
|
||||||
if(NOT openpgl_DIR AND EXISTS ${_cycles_lib_dir})
|
if(EXISTS ${_cycles_lib_dir})
|
||||||
set(openpgl_DIR ${_cycles_lib_dir}/openpgl/lib/cmake/openpgl)
|
set(openpgl_DIR ${_cycles_lib_dir}/openpgl/lib/cmake/openpgl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -541,7 +545,7 @@ endif()
|
|||||||
|
|
||||||
if(CYCLES_STANDALONE_REPOSITORY)
|
if(CYCLES_STANDALONE_REPOSITORY)
|
||||||
if((WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI) OR
|
if((WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI) OR
|
||||||
WITH_CYCLES_HYDRA_RENDER_DELEGATE)
|
WITH_CYCLES_HYDRA_RENDER_DELEGATE)
|
||||||
if(MSVC AND EXISTS ${_cycles_lib_dir})
|
if(MSVC AND EXISTS ${_cycles_lib_dir})
|
||||||
set(Epoxy_LIBRARIES "${_cycles_lib_dir}/epoxy/lib/epoxy.lib")
|
set(Epoxy_LIBRARIES "${_cycles_lib_dir}/epoxy/lib/epoxy.lib")
|
||||||
set(Epoxy_INCLUDE_DIRS "${_cycles_lib_dir}/epoxy/include")
|
set(Epoxy_INCLUDE_DIRS "${_cycles_lib_dir}/epoxy/include")
|
||||||
|
@@ -142,6 +142,7 @@ set(SRC
|
|||||||
${SRC_DUMMY}
|
${SRC_DUMMY}
|
||||||
${SRC_MULTI}
|
${SRC_MULTI}
|
||||||
${SRC_OPTIX}
|
${SRC_OPTIX}
|
||||||
|
${SRC_ONEAPI}
|
||||||
${SRC_HEADERS}
|
${SRC_HEADERS}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -187,25 +188,7 @@ if(WITH_CYCLES_DEVICE_METAL)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if (WITH_CYCLES_DEVICE_ONEAPI)
|
if (WITH_CYCLES_DEVICE_ONEAPI)
|
||||||
if(WIN32)
|
|
||||||
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/../kernel/cycles_kernel_oneapi.lib)
|
|
||||||
else()
|
|
||||||
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/../kernel/libcycles_kernel_oneapi.so)
|
|
||||||
endif()
|
|
||||||
list(APPEND LIB
|
|
||||||
${cycles_kernel_oneapi_lib}
|
|
||||||
"$<$<CONFIG:Debug>:${SYCL_LIBRARY_DEBUG}>"
|
|
||||||
"$<$<CONFIG:Release>:${SYCL_LIBRARY}>"
|
|
||||||
"$<$<CONFIG:RelWithDebInfo>:${SYCL_LIBRARY}>"
|
|
||||||
"$<$<CONFIG:MinSizeRel>:${SYCL_LIBRARY}>"
|
|
||||||
)
|
|
||||||
add_definitions(-DWITH_ONEAPI)
|
add_definitions(-DWITH_ONEAPI)
|
||||||
list(APPEND SRC
|
|
||||||
${SRC_ONEAPI}
|
|
||||||
)
|
|
||||||
list(APPEND INC_SYS
|
|
||||||
${SYCL_INCLUDE_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_OPENIMAGEDENOISE)
|
if(WITH_OPENIMAGEDENOISE)
|
||||||
|
@@ -254,10 +254,6 @@ void MetalDevice::make_source(MetalPipelineType pso_type, const uint kernel_feat
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
|
|
||||||
NSOperatingSystemVersion macos_ver = [processInfo operatingSystemVersion];
|
|
||||||
global_defines += "#define __KERNEL_METAL_MACOS__ " + to_string(macos_ver.majorVersion) + "\n";
|
|
||||||
|
|
||||||
string &source = this->source[pso_type];
|
string &source = this->source[pso_type];
|
||||||
source = "\n#include \"kernel/device/metal/kernel.metal\"\n";
|
source = "\n#include \"kernel/device/metal/kernel.metal\"\n";
|
||||||
source = path_source_replace_includes(source, path_get("source"));
|
source = path_source_replace_includes(source, path_get("source"));
|
||||||
|
@@ -19,12 +19,62 @@
|
|||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
#ifdef WITH_ONEAPI
|
||||||
|
static OneAPIDLLInterface oneapi_dll;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# define LOAD_ONEAPI_SHARED_LIBRARY(path) (void *)(LoadLibrary(path))
|
||||||
|
# define LOAD_ONEAPI_SHARED_LIBRARY_ERROR() GetLastError()
|
||||||
|
# define FREE_SHARED_LIBRARY(handle) FreeLibrary((HMODULE)handle)
|
||||||
|
# define GET_SHARED_LIBRARY_SYMBOL(handle, name) GetProcAddress((HMODULE)handle, name)
|
||||||
|
#elif __linux__
|
||||||
|
# define LOAD_ONEAPI_SHARED_LIBRARY(path) dlopen(path, RTLD_NOW)
|
||||||
|
# define LOAD_ONEAPI_SHARED_LIBRARY_ERROR() dlerror()
|
||||||
|
# define FREE_SHARED_LIBRARY(handle) dlclose(handle)
|
||||||
|
# define GET_SHARED_LIBRARY_SYMBOL(handle, name) dlsym(handle, name)
|
||||||
|
#endif
|
||||||
|
|
||||||
bool device_oneapi_init()
|
bool device_oneapi_init()
|
||||||
{
|
{
|
||||||
#if !defined(WITH_ONEAPI)
|
#if !defined(WITH_ONEAPI)
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
string lib_path = path_get("lib");
|
||||||
|
# ifdef _WIN32
|
||||||
|
lib_path = path_join(lib_path, "cycles_kernel_oneapi.dll");
|
||||||
|
# else
|
||||||
|
lib_path = path_join(lib_path, "cycles_kernel_oneapi.so");
|
||||||
|
# endif
|
||||||
|
void *lib_handle = LOAD_ONEAPI_SHARED_LIBRARY(lib_path.c_str());
|
||||||
|
|
||||||
|
/* This shouldn't happen, but it still makes sense to have a branch for this. */
|
||||||
|
if (lib_handle == NULL) {
|
||||||
|
LOG(ERROR) << "oneAPI kernel shared library cannot be loaded: "
|
||||||
|
<< LOAD_ONEAPI_SHARED_LIBRARY_ERROR();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
# define DLL_INTERFACE_CALL(function, return_type, ...) \
|
||||||
|
(oneapi_dll.function) = reinterpret_cast<decltype(oneapi_dll.function)>( \
|
||||||
|
GET_SHARED_LIBRARY_SYMBOL(lib_handle, #function)); \
|
||||||
|
if (oneapi_dll.function == NULL) { \
|
||||||
|
LOG(ERROR) << "oneAPI shared library function \"" << #function \
|
||||||
|
<< "\" has not been loaded from kernel shared - disable oneAPI " \
|
||||||
|
"library disable oneAPI implementation due to this"; \
|
||||||
|
FREE_SHARED_LIBRARY(lib_handle); \
|
||||||
|
return false; \
|
||||||
|
}
|
||||||
|
# include "kernel/device/oneapi/dll_interface_template.h"
|
||||||
|
# undef DLL_INTERFACE_CALL
|
||||||
|
|
||||||
|
VLOG_INFO << "oneAPI kernel shared library has been loaded successfully";
|
||||||
|
|
||||||
|
/* We need to have this oneapi kernel shared library during all life-span of the Blender.
|
||||||
|
* So it is not unloaded because of this.
|
||||||
|
* FREE_SHARED_LIBRARY(lib_handle); */
|
||||||
|
|
||||||
/* NOTE(@nsirgien): we need to enable JIT cache from here and
|
/* NOTE(@nsirgien): we need to enable JIT cache from here and
|
||||||
* right now this cache policy is controlled by env. variables. */
|
* right now this cache policy is controlled by env. variables. */
|
||||||
/* NOTE(hallade) we also disable use of copy engine as it
|
/* NOTE(hallade) we also disable use of copy engine as it
|
||||||
@@ -59,10 +109,17 @@ bool device_oneapi_init()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_WIN32) || defined(__linux__)
|
||||||
|
# undef LOAD_SYCL_SHARED_LIBRARY
|
||||||
|
# undef LOAD_ONEAPI_SHARED_LIBRARY
|
||||||
|
# undef FREE_SHARED_LIBRARY
|
||||||
|
# undef GET_SHARED_LIBRARY_SYMBOL
|
||||||
|
#endif
|
||||||
|
|
||||||
Device *device_oneapi_create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
|
Device *device_oneapi_create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
|
||||||
{
|
{
|
||||||
#ifdef WITH_ONEAPI
|
#ifdef WITH_ONEAPI
|
||||||
return new OneapiDevice(info, stats, profiler);
|
return new OneapiDevice(info, oneapi_dll, stats, profiler);
|
||||||
#else
|
#else
|
||||||
(void)info;
|
(void)info;
|
||||||
(void)stats;
|
(void)stats;
|
||||||
@@ -108,7 +165,7 @@ static void device_iterator_cb(const char *id, const char *name, int num, void *
|
|||||||
void device_oneapi_info(vector<DeviceInfo> &devices)
|
void device_oneapi_info(vector<DeviceInfo> &devices)
|
||||||
{
|
{
|
||||||
#ifdef WITH_ONEAPI
|
#ifdef WITH_ONEAPI
|
||||||
OneapiDevice::iterate_devices(device_iterator_cb, &devices);
|
(oneapi_dll.oneapi_iterate_devices)(device_iterator_cb, &devices);
|
||||||
#else /* WITH_ONEAPI */
|
#else /* WITH_ONEAPI */
|
||||||
(void)devices;
|
(void)devices;
|
||||||
#endif /* WITH_ONEAPI */
|
#endif /* WITH_ONEAPI */
|
||||||
@@ -118,10 +175,10 @@ string device_oneapi_capabilities()
|
|||||||
{
|
{
|
||||||
string capabilities;
|
string capabilities;
|
||||||
#ifdef WITH_ONEAPI
|
#ifdef WITH_ONEAPI
|
||||||
char *c_capabilities = OneapiDevice::device_capabilities();
|
char *c_capabilities = (oneapi_dll.oneapi_device_capabilities)();
|
||||||
if (c_capabilities) {
|
if (c_capabilities) {
|
||||||
capabilities = c_capabilities;
|
capabilities = c_capabilities;
|
||||||
free(c_capabilities);
|
(oneapi_dll.oneapi_free)(c_capabilities);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return capabilities;
|
return capabilities;
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
# include "util/debug.h"
|
# include "util/debug.h"
|
||||||
# include "util/log.h"
|
# include "util/log.h"
|
||||||
|
|
||||||
# include "kernel/device/oneapi/globals.h"
|
# include "kernel/device/oneapi/kernel.h"
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@@ -19,19 +19,26 @@ static void queue_error_cb(const char *message, void *user_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OneapiDevice::OneapiDevice(const DeviceInfo &info, Stats &stats, Profiler &profiler)
|
OneapiDevice::OneapiDevice(const DeviceInfo &info,
|
||||||
|
OneAPIDLLInterface &oneapi_dll_object,
|
||||||
|
Stats &stats,
|
||||||
|
Profiler &profiler)
|
||||||
: Device(info, stats, profiler),
|
: Device(info, stats, profiler),
|
||||||
device_queue_(nullptr),
|
device_queue_(nullptr),
|
||||||
texture_info_(this, "texture_info", MEM_GLOBAL),
|
texture_info_(this, "texture_info", MEM_GLOBAL),
|
||||||
kg_memory_(nullptr),
|
kg_memory_(nullptr),
|
||||||
kg_memory_device_(nullptr),
|
kg_memory_device_(nullptr),
|
||||||
kg_memory_size_(0)
|
kg_memory_size_(0),
|
||||||
|
oneapi_dll_(oneapi_dll_object)
|
||||||
{
|
{
|
||||||
need_texture_info_ = false;
|
need_texture_info_ = false;
|
||||||
|
|
||||||
oneapi_set_error_cb(queue_error_cb, &oneapi_error_string_);
|
oneapi_dll_.oneapi_set_error_cb(queue_error_cb, &oneapi_error_string_);
|
||||||
|
|
||||||
bool is_finished_ok = create_queue(device_queue_, info.num);
|
/* OneAPI calls should be initialized on this moment. */
|
||||||
|
assert(oneapi_dll_.oneapi_create_queue != nullptr);
|
||||||
|
|
||||||
|
bool is_finished_ok = oneapi_dll_.oneapi_create_queue(device_queue_, info.num);
|
||||||
if (is_finished_ok == false) {
|
if (is_finished_ok == false) {
|
||||||
set_error("oneAPI queue initialization error: got runtime exception \"" +
|
set_error("oneAPI queue initialization error: got runtime exception \"" +
|
||||||
oneapi_error_string_ + "\"");
|
oneapi_error_string_ + "\"");
|
||||||
@@ -43,7 +50,7 @@ OneapiDevice::OneapiDevice(const DeviceInfo &info, Stats &stats, Profiler &profi
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t globals_segment_size;
|
size_t globals_segment_size;
|
||||||
is_finished_ok = kernel_globals_size(globals_segment_size);
|
is_finished_ok = oneapi_dll_.oneapi_kernel_globals_size(device_queue_, globals_segment_size);
|
||||||
if (is_finished_ok == false) {
|
if (is_finished_ok == false) {
|
||||||
set_error("oneAPI constant memory initialization got runtime exception \"" +
|
set_error("oneAPI constant memory initialization got runtime exception \"" +
|
||||||
oneapi_error_string_ + "\"");
|
oneapi_error_string_ + "\"");
|
||||||
@@ -52,27 +59,27 @@ OneapiDevice::OneapiDevice(const DeviceInfo &info, Stats &stats, Profiler &profi
|
|||||||
VLOG_DEBUG << "Successfully created global/constant memory segment (kernel globals object)";
|
VLOG_DEBUG << "Successfully created global/constant memory segment (kernel globals object)";
|
||||||
}
|
}
|
||||||
|
|
||||||
kg_memory_ = usm_aligned_alloc_host(device_queue_, globals_segment_size, 16);
|
kg_memory_ = oneapi_dll_.oneapi_usm_aligned_alloc_host(device_queue_, globals_segment_size, 16);
|
||||||
usm_memset(device_queue_, kg_memory_, 0, globals_segment_size);
|
oneapi_dll_.oneapi_usm_memset(device_queue_, kg_memory_, 0, globals_segment_size);
|
||||||
|
|
||||||
kg_memory_device_ = usm_alloc_device(device_queue_, globals_segment_size);
|
kg_memory_device_ = oneapi_dll_.oneapi_usm_alloc_device(device_queue_, globals_segment_size);
|
||||||
|
|
||||||
kg_memory_size_ = globals_segment_size;
|
kg_memory_size_ = globals_segment_size;
|
||||||
|
|
||||||
max_memory_on_device_ = get_memcapacity();
|
max_memory_on_device_ = oneapi_dll_.oneapi_get_memcapacity(device_queue_);
|
||||||
}
|
}
|
||||||
|
|
||||||
OneapiDevice::~OneapiDevice()
|
OneapiDevice::~OneapiDevice()
|
||||||
{
|
{
|
||||||
texture_info_.free();
|
texture_info_.free();
|
||||||
usm_free(device_queue_, kg_memory_);
|
oneapi_dll_.oneapi_usm_free(device_queue_, kg_memory_);
|
||||||
usm_free(device_queue_, kg_memory_device_);
|
oneapi_dll_.oneapi_usm_free(device_queue_, kg_memory_device_);
|
||||||
|
|
||||||
for (ConstMemMap::iterator mt = const_mem_map_.begin(); mt != const_mem_map_.end(); mt++)
|
for (ConstMemMap::iterator mt = const_mem_map_.begin(); mt != const_mem_map_.end(); mt++)
|
||||||
delete mt->second;
|
delete mt->second;
|
||||||
|
|
||||||
if (device_queue_)
|
if (device_queue_)
|
||||||
free_queue(device_queue_);
|
oneapi_dll_.oneapi_free_queue(device_queue_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OneapiDevice::check_peer_access(Device * /*peer_device*/)
|
bool OneapiDevice::check_peer_access(Device * /*peer_device*/)
|
||||||
@@ -88,26 +95,18 @@ BVHLayoutMask OneapiDevice::get_bvh_layout_mask() const
|
|||||||
bool OneapiDevice::load_kernels(const uint requested_features)
|
bool OneapiDevice::load_kernels(const uint requested_features)
|
||||||
{
|
{
|
||||||
assert(device_queue_);
|
assert(device_queue_);
|
||||||
|
/* NOTE(@nsirgien): oneAPI can support compilation of kernel code with certain feature set
|
||||||
|
* with specialization constants, but it hasn't been implemented yet. */
|
||||||
|
(void)requested_features;
|
||||||
|
|
||||||
bool is_finished_ok = oneapi_run_test_kernel(device_queue_);
|
bool is_finished_ok = oneapi_dll_.oneapi_run_test_kernel(device_queue_);
|
||||||
if (is_finished_ok == false) {
|
if (is_finished_ok == false) {
|
||||||
set_error("oneAPI test kernel execution: got a runtime exception \"" + oneapi_error_string_ +
|
set_error("oneAPI kernel load: got runtime exception \"" + oneapi_error_string_ + "\"");
|
||||||
"\"");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VLOG_INFO << "Test kernel has been executed successfully for \"" << info.description << "\"";
|
VLOG_INFO << "Runtime compilation done for \"" << info.description << "\"";
|
||||||
assert(device_queue_);
|
assert(device_queue_);
|
||||||
}
|
}
|
||||||
|
|
||||||
is_finished_ok = oneapi_load_kernels(device_queue_, (const unsigned int)requested_features);
|
|
||||||
if (is_finished_ok == false) {
|
|
||||||
set_error("oneAPI kernels loading: got a runtime exception \"" + oneapi_error_string_ + "\"");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
VLOG_INFO << "Kernels loading (compilation) has been done for \"" << info.description << "\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_finished_ok;
|
return is_finished_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +138,7 @@ void OneapiDevice::generic_alloc(device_memory &mem)
|
|||||||
* type has been used for oneAPI device in order to better fit in Cycles architecture. */
|
* type has been used for oneAPI device in order to better fit in Cycles architecture. */
|
||||||
void *device_pointer = nullptr;
|
void *device_pointer = nullptr;
|
||||||
if (mem.memory_size() + stats.mem_used < max_memory_on_device_)
|
if (mem.memory_size() + stats.mem_used < max_memory_on_device_)
|
||||||
device_pointer = usm_alloc_device(device_queue_, memory_size);
|
device_pointer = oneapi_dll_.oneapi_usm_alloc_device(device_queue_, memory_size);
|
||||||
if (device_pointer == nullptr) {
|
if (device_pointer == nullptr) {
|
||||||
set_error("oneAPI kernel - device memory allocation error for " +
|
set_error("oneAPI kernel - device memory allocation error for " +
|
||||||
string_human_readable_size(mem.memory_size()) +
|
string_human_readable_size(mem.memory_size()) +
|
||||||
@@ -164,7 +163,8 @@ void OneapiDevice::generic_copy_to(device_memory &mem)
|
|||||||
/* Copy operation from host shouldn't be requested if there is no memory allocated on host. */
|
/* Copy operation from host shouldn't be requested if there is no memory allocated on host. */
|
||||||
assert(mem.host_pointer);
|
assert(mem.host_pointer);
|
||||||
assert(device_queue_);
|
assert(device_queue_);
|
||||||
usm_memcpy(device_queue_, (void *)mem.device_pointer, (void *)mem.host_pointer, memory_size);
|
oneapi_dll_.oneapi_usm_memcpy(
|
||||||
|
device_queue_, (void *)mem.device_pointer, (void *)mem.host_pointer, memory_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Make sycl::queue part of OneapiQueue and avoid using pointers to sycl::queue. */
|
/* TODO: Make sycl::queue part of OneapiQueue and avoid using pointers to sycl::queue. */
|
||||||
@@ -178,6 +178,11 @@ string OneapiDevice::oneapi_error_message()
|
|||||||
return string(oneapi_error_string_);
|
return string(oneapi_error_string_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OneAPIDLLInterface OneapiDevice::oneapi_dll_object()
|
||||||
|
{
|
||||||
|
return oneapi_dll_;
|
||||||
|
}
|
||||||
|
|
||||||
void *OneapiDevice::kernel_globals_device_pointer()
|
void *OneapiDevice::kernel_globals_device_pointer()
|
||||||
{
|
{
|
||||||
return kg_memory_device_;
|
return kg_memory_device_;
|
||||||
@@ -193,7 +198,7 @@ void OneapiDevice::generic_free(device_memory &mem)
|
|||||||
mem.device_size = 0;
|
mem.device_size = 0;
|
||||||
|
|
||||||
assert(device_queue_);
|
assert(device_queue_);
|
||||||
usm_free(device_queue_, (void *)mem.device_pointer);
|
oneapi_dll_.oneapi_usm_free(device_queue_, (void *)mem.device_pointer);
|
||||||
mem.device_pointer = 0;
|
mem.device_pointer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +266,8 @@ void OneapiDevice::mem_copy_from(device_memory &mem, size_t y, size_t w, size_t
|
|||||||
if (mem.device_pointer) {
|
if (mem.device_pointer) {
|
||||||
char *shifted_host = reinterpret_cast<char *>(mem.host_pointer) + offset;
|
char *shifted_host = reinterpret_cast<char *>(mem.host_pointer) + offset;
|
||||||
char *shifted_device = reinterpret_cast<char *>(mem.device_pointer) + offset;
|
char *shifted_device = reinterpret_cast<char *>(mem.device_pointer) + offset;
|
||||||
bool is_finished_ok = usm_memcpy(device_queue_, shifted_host, shifted_device, size);
|
bool is_finished_ok = oneapi_dll_.oneapi_usm_memcpy(
|
||||||
|
device_queue_, shifted_host, shifted_device, size);
|
||||||
if (is_finished_ok == false) {
|
if (is_finished_ok == false) {
|
||||||
set_error("oneAPI memory operation error: got runtime exception \"" +
|
set_error("oneAPI memory operation error: got runtime exception \"" +
|
||||||
oneapi_error_string_ + "\"");
|
oneapi_error_string_ + "\"");
|
||||||
@@ -286,7 +292,7 @@ void OneapiDevice::mem_zero(device_memory &mem)
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert(device_queue_);
|
assert(device_queue_);
|
||||||
bool is_finished_ok = usm_memset(
|
bool is_finished_ok = oneapi_dll_.oneapi_usm_memset(
|
||||||
device_queue_, (void *)mem.device_pointer, 0, mem.memory_size());
|
device_queue_, (void *)mem.device_pointer, 0, mem.memory_size());
|
||||||
if (is_finished_ok == false) {
|
if (is_finished_ok == false) {
|
||||||
set_error("oneAPI memory operation error: got runtime exception \"" + oneapi_error_string_ +
|
set_error("oneAPI memory operation error: got runtime exception \"" + oneapi_error_string_ +
|
||||||
@@ -343,9 +349,10 @@ void OneapiDevice::const_copy_to(const char *name, void *host, size_t size)
|
|||||||
memcpy(data->data(), host, size);
|
memcpy(data->data(), host, size);
|
||||||
data->copy_to_device();
|
data->copy_to_device();
|
||||||
|
|
||||||
set_global_memory(device_queue_, kg_memory_, name, (void *)data->device_pointer);
|
oneapi_dll_.oneapi_set_global_memory(
|
||||||
|
device_queue_, kg_memory_, name, (void *)data->device_pointer);
|
||||||
|
|
||||||
usm_memcpy(device_queue_, kg_memory_device_, kg_memory_, kg_memory_size_);
|
oneapi_dll_.oneapi_usm_memcpy(device_queue_, kg_memory_device_, kg_memory_, kg_memory_size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OneapiDevice::global_alloc(device_memory &mem)
|
void OneapiDevice::global_alloc(device_memory &mem)
|
||||||
@@ -360,9 +367,10 @@ void OneapiDevice::global_alloc(device_memory &mem)
|
|||||||
generic_alloc(mem);
|
generic_alloc(mem);
|
||||||
generic_copy_to(mem);
|
generic_copy_to(mem);
|
||||||
|
|
||||||
set_global_memory(device_queue_, kg_memory_, mem.name, (void *)mem.device_pointer);
|
oneapi_dll_.oneapi_set_global_memory(
|
||||||
|
device_queue_, kg_memory_, mem.name, (void *)mem.device_pointer);
|
||||||
|
|
||||||
usm_memcpy(device_queue_, kg_memory_device_, kg_memory_, kg_memory_size_);
|
oneapi_dll_.oneapi_usm_memcpy(device_queue_, kg_memory_device_, kg_memory_, kg_memory_size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OneapiDevice::global_free(device_memory &mem)
|
void OneapiDevice::global_free(device_memory &mem)
|
||||||
@@ -402,6 +410,18 @@ unique_ptr<DeviceQueue> OneapiDevice::gpu_queue_create()
|
|||||||
return make_unique<OneapiDeviceQueue>(this);
|
return make_unique<OneapiDeviceQueue>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int OneapiDevice::get_num_multiprocessors()
|
||||||
|
{
|
||||||
|
assert(device_queue_);
|
||||||
|
return oneapi_dll_.oneapi_get_num_multiprocessors(device_queue_);
|
||||||
|
}
|
||||||
|
|
||||||
|
int OneapiDevice::get_max_num_threads_per_multiprocessor()
|
||||||
|
{
|
||||||
|
assert(device_queue_);
|
||||||
|
return oneapi_dll_.oneapi_get_max_num_threads_per_multiprocessor(device_queue_);
|
||||||
|
}
|
||||||
|
|
||||||
bool OneapiDevice::should_use_graphics_interop()
|
bool OneapiDevice::should_use_graphics_interop()
|
||||||
{
|
{
|
||||||
/* NOTE(@nsirgien): oneAPI doesn't yet support direct writing into graphics API objects, so
|
/* NOTE(@nsirgien): oneAPI doesn't yet support direct writing into graphics API objects, so
|
||||||
@@ -412,465 +432,13 @@ bool OneapiDevice::should_use_graphics_interop()
|
|||||||
void *OneapiDevice::usm_aligned_alloc_host(size_t memory_size, size_t alignment)
|
void *OneapiDevice::usm_aligned_alloc_host(size_t memory_size, size_t alignment)
|
||||||
{
|
{
|
||||||
assert(device_queue_);
|
assert(device_queue_);
|
||||||
return usm_aligned_alloc_host(device_queue_, memory_size, alignment);
|
return oneapi_dll_.oneapi_usm_aligned_alloc_host(device_queue_, memory_size, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OneapiDevice::usm_free(void *usm_ptr)
|
void OneapiDevice::usm_free(void *usm_ptr)
|
||||||
{
|
{
|
||||||
assert(device_queue_);
|
assert(device_queue_);
|
||||||
return usm_free(device_queue_, usm_ptr);
|
return oneapi_dll_.oneapi_usm_free(device_queue_, usm_ptr);
|
||||||
}
|
|
||||||
|
|
||||||
void OneapiDevice::check_usm(SyclQueue *queue_, const void *usm_ptr, bool allow_host = false)
|
|
||||||
{
|
|
||||||
# ifdef _DEBUG
|
|
||||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
|
||||||
sycl::info::device_type device_type =
|
|
||||||
queue->get_device().get_info<sycl::info::device::device_type>();
|
|
||||||
sycl::usm::alloc usm_type = get_pointer_type(usm_ptr, queue->get_context());
|
|
||||||
(void)usm_type;
|
|
||||||
assert(usm_type == sycl::usm::alloc::device ||
|
|
||||||
((device_type == sycl::info::device_type::host ||
|
|
||||||
device_type == sycl::info::device_type::cpu || allow_host) &&
|
|
||||||
usm_type == sycl::usm::alloc::host));
|
|
||||||
# else
|
|
||||||
/* Silence warning about unused arguments. */
|
|
||||||
(void)queue_;
|
|
||||||
(void)usm_ptr;
|
|
||||||
(void)allow_host;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OneapiDevice::create_queue(SyclQueue *&external_queue, int device_index)
|
|
||||||
{
|
|
||||||
bool finished_correct = true;
|
|
||||||
try {
|
|
||||||
std::vector<sycl::device> devices = OneapiDevice::available_devices();
|
|
||||||
if (device_index < 0 || device_index >= devices.size()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
sycl::queue *created_queue = new sycl::queue(devices[device_index],
|
|
||||||
sycl::property::queue::in_order());
|
|
||||||
external_queue = reinterpret_cast<SyclQueue *>(created_queue);
|
|
||||||
}
|
|
||||||
catch (sycl::exception const &e) {
|
|
||||||
finished_correct = false;
|
|
||||||
oneapi_error_string_ = e.what();
|
|
||||||
}
|
|
||||||
return finished_correct;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OneapiDevice::free_queue(SyclQueue *queue_)
|
|
||||||
{
|
|
||||||
assert(queue_);
|
|
||||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
|
||||||
delete queue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *OneapiDevice::usm_aligned_alloc_host(SyclQueue *queue_, size_t memory_size, size_t alignment)
|
|
||||||
{
|
|
||||||
assert(queue_);
|
|
||||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
|
||||||
return sycl::aligned_alloc_host(alignment, memory_size, *queue);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *OneapiDevice::usm_alloc_device(SyclQueue *queue_, size_t memory_size)
|
|
||||||
{
|
|
||||||
assert(queue_);
|
|
||||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
|
||||||
return sycl::malloc_device(memory_size, *queue);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OneapiDevice::usm_free(SyclQueue *queue_, void *usm_ptr)
|
|
||||||
{
|
|
||||||
assert(queue_);
|
|
||||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
|
||||||
OneapiDevice::check_usm(queue_, usm_ptr, true);
|
|
||||||
sycl::free(usm_ptr, *queue);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OneapiDevice::usm_memcpy(SyclQueue *queue_, void *dest, void *src, size_t num_bytes)
|
|
||||||
{
|
|
||||||
assert(queue_);
|
|
||||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
|
||||||
OneapiDevice::check_usm(queue_, dest, true);
|
|
||||||
OneapiDevice::check_usm(queue_, src, true);
|
|
||||||
sycl::event mem_event = queue->memcpy(dest, src, num_bytes);
|
|
||||||
# ifdef WITH_CYCLES_DEBUG
|
|
||||||
try {
|
|
||||||
/* NOTE(@nsirgien) Waiting on memory operation may give more precise error
|
|
||||||
* messages. Due to impact on occupancy, it makes sense to enable it only during Cycles debug.
|
|
||||||
*/
|
|
||||||
mem_event.wait_and_throw();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (sycl::exception const &e) {
|
|
||||||
oneapi_error_string_ = e.what();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
# else
|
|
||||||
sycl::usm::alloc dest_type = get_pointer_type(dest, queue->get_context());
|
|
||||||
sycl::usm::alloc src_type = get_pointer_type(src, queue->get_context());
|
|
||||||
bool from_device_to_host = dest_type == sycl::usm::alloc::host &&
|
|
||||||
src_type == sycl::usm::alloc::device;
|
|
||||||
bool host_or_device_memop_with_offset = dest_type == sycl::usm::alloc::unknown ||
|
|
||||||
src_type == sycl::usm::alloc::unknown;
|
|
||||||
/* NOTE(@sirgienko) Host-side blocking wait on this operation is mandatory, otherwise the host
|
|
||||||
* may not wait until the end of the transfer before using the memory.
|
|
||||||
*/
|
|
||||||
if (from_device_to_host || host_or_device_memop_with_offset)
|
|
||||||
mem_event.wait();
|
|
||||||
return true;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OneapiDevice::usm_memset(SyclQueue *queue_,
|
|
||||||
void *usm_ptr,
|
|
||||||
unsigned char value,
|
|
||||||
size_t num_bytes)
|
|
||||||
{
|
|
||||||
assert(queue_);
|
|
||||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
|
||||||
OneapiDevice::check_usm(queue_, usm_ptr, true);
|
|
||||||
sycl::event mem_event = queue->memset(usm_ptr, value, num_bytes);
|
|
||||||
# ifdef WITH_CYCLES_DEBUG
|
|
||||||
try {
|
|
||||||
/* NOTE(@nsirgien) Waiting on memory operation may give more precise error
|
|
||||||
* messages. Due to impact on occupancy, it makes sense to enable it only during Cycles debug.
|
|
||||||
*/
|
|
||||||
mem_event.wait_and_throw();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (sycl::exception const &e) {
|
|
||||||
oneapi_error_string_ = e.what();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
# else
|
|
||||||
(void)mem_event;
|
|
||||||
return true;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OneapiDevice::queue_synchronize(SyclQueue *queue_)
|
|
||||||
{
|
|
||||||
assert(queue_);
|
|
||||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
|
||||||
try {
|
|
||||||
queue->wait_and_throw();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (sycl::exception const &e) {
|
|
||||||
oneapi_error_string_ = e.what();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OneapiDevice::kernel_globals_size(size_t &kernel_global_size)
|
|
||||||
{
|
|
||||||
kernel_global_size = sizeof(KernelGlobalsGPU);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OneapiDevice::set_global_memory(SyclQueue *queue_,
|
|
||||||
void *kernel_globals,
|
|
||||||
const char *memory_name,
|
|
||||||
void *memory_device_pointer)
|
|
||||||
{
|
|
||||||
assert(queue_);
|
|
||||||
assert(kernel_globals);
|
|
||||||
assert(memory_name);
|
|
||||||
assert(memory_device_pointer);
|
|
||||||
KernelGlobalsGPU *globals = (KernelGlobalsGPU *)kernel_globals;
|
|
||||||
OneapiDevice::check_usm(queue_, memory_device_pointer);
|
|
||||||
OneapiDevice::check_usm(queue_, kernel_globals, true);
|
|
||||||
|
|
||||||
std::string matched_name(memory_name);
|
|
||||||
|
|
||||||
/* This macro will change global ptr of KernelGlobals via name matching. */
|
|
||||||
# define KERNEL_DATA_ARRAY(type, name) \
|
|
||||||
else if (#name == matched_name) \
|
|
||||||
{ \
|
|
||||||
globals->__##name = (type *)memory_device_pointer; \
|
|
||||||
return; \
|
|
||||||
}
|
|
||||||
if (false) {
|
|
||||||
}
|
|
||||||
else if ("integrator_state" == matched_name) {
|
|
||||||
globals->integrator_state = (IntegratorStateGPU *)memory_device_pointer;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
KERNEL_DATA_ARRAY(KernelData, data)
|
|
||||||
# include "kernel/data_arrays.h"
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "Can't found global/constant memory with name \"" << matched_name << "\"!"
|
|
||||||
<< std::endl;
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
# undef KERNEL_DATA_ARRAY
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OneapiDevice::enqueue_kernel(KernelContext *kernel_context,
|
|
||||||
int kernel,
|
|
||||||
size_t global_size,
|
|
||||||
void **args)
|
|
||||||
{
|
|
||||||
return oneapi_enqueue_kernel(kernel_context, kernel, global_size, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Compute-runtime (ie. NEO) version is what gets returned by sycl/L0 on Windows
|
|
||||||
* since Windows driver 101.3268. */
|
|
||||||
/* The same min compute-runtime version is currently required across Windows and Linux.
|
|
||||||
* For Windows driver 101.3430, compute-runtime version is 23904. */
|
|
||||||
static const int lowest_supported_driver_version_win = 1013430;
|
|
||||||
static const int lowest_supported_driver_version_neo = 23904;
|
|
||||||
|
|
||||||
int OneapiDevice::parse_driver_build_version(const sycl::device &device)
|
|
||||||
{
|
|
||||||
const std::string &driver_version = device.get_info<sycl::info::device::driver_version>();
|
|
||||||
int driver_build_version = 0;
|
|
||||||
|
|
||||||
size_t second_dot_position = driver_version.find('.', driver_version.find('.') + 1);
|
|
||||||
if (second_dot_position == std::string::npos) {
|
|
||||||
std::cerr << "Unable to parse unknown Intel GPU driver version \"" << driver_version
|
|
||||||
<< "\" does not match xx.xx.xxxxx (Linux), x.x.xxxx (L0),"
|
|
||||||
<< " xx.xx.xxx.xxxx (Windows) for device \""
|
|
||||||
<< device.get_info<sycl::info::device::name>() << "\"." << std::endl;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
try {
|
|
||||||
size_t third_dot_position = driver_version.find('.', second_dot_position + 1);
|
|
||||||
if (third_dot_position != std::string::npos) {
|
|
||||||
const std::string &third_number_substr = driver_version.substr(
|
|
||||||
second_dot_position + 1, third_dot_position - second_dot_position - 1);
|
|
||||||
const std::string &forth_number_substr = driver_version.substr(third_dot_position + 1);
|
|
||||||
if (third_number_substr.length() == 3 && forth_number_substr.length() == 4)
|
|
||||||
driver_build_version = std::stoi(third_number_substr) * 10000 +
|
|
||||||
std::stoi(forth_number_substr);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const std::string &third_number_substr = driver_version.substr(second_dot_position + 1);
|
|
||||||
driver_build_version = std::stoi(third_number_substr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (std::invalid_argument &) {
|
|
||||||
std::cerr << "Unable to parse unknown Intel GPU driver version \"" << driver_version
|
|
||||||
<< "\" does not match xx.xx.xxxxx (Linux), x.x.xxxx (L0),"
|
|
||||||
<< " xx.xx.xxx.xxxx (Windows) for device \""
|
|
||||||
<< device.get_info<sycl::info::device::name>() << "\"." << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return driver_build_version;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<sycl::device> OneapiDevice::available_devices()
|
|
||||||
{
|
|
||||||
bool allow_all_devices = false;
|
|
||||||
if (getenv("CYCLES_ONEAPI_ALL_DEVICES") != nullptr)
|
|
||||||
allow_all_devices = true;
|
|
||||||
|
|
||||||
/* Host device is useful only for debugging at the moment
|
|
||||||
* so we hide this device with default build settings. */
|
|
||||||
# ifdef WITH_ONEAPI_SYCL_HOST_ENABLED
|
|
||||||
bool allow_host = true;
|
|
||||||
# else
|
|
||||||
bool allow_host = false;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
const std::vector<sycl::platform> &oneapi_platforms = sycl::platform::get_platforms();
|
|
||||||
|
|
||||||
std::vector<sycl::device> available_devices;
|
|
||||||
for (const sycl::platform &platform : oneapi_platforms) {
|
|
||||||
/* ignore OpenCL platforms to avoid using the same devices through both Level-Zero and OpenCL.
|
|
||||||
*/
|
|
||||||
if (platform.get_backend() == sycl::backend::opencl) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<sycl::device> &oneapi_devices =
|
|
||||||
(allow_all_devices || allow_host) ? platform.get_devices(sycl::info::device_type::all) :
|
|
||||||
platform.get_devices(sycl::info::device_type::gpu);
|
|
||||||
|
|
||||||
for (const sycl::device &device : oneapi_devices) {
|
|
||||||
if (allow_all_devices) {
|
|
||||||
/* still filter out host device if build doesn't support it. */
|
|
||||||
if (allow_host || !device.is_host()) {
|
|
||||||
available_devices.push_back(device);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bool filter_out = false;
|
|
||||||
|
|
||||||
/* For now we support all Intel(R) Arc(TM) devices and likely any future GPU,
|
|
||||||
* assuming they have either more than 96 Execution Units or not 7 threads per EU.
|
|
||||||
* Official support can be broaden to older and smaller GPUs once ready. */
|
|
||||||
if (device.is_gpu() && platform.get_backend() == sycl::backend::ext_oneapi_level_zero) {
|
|
||||||
/* Filtered-out defaults in-case these values aren't available through too old L0
|
|
||||||
* runtime. */
|
|
||||||
int number_of_eus = 96;
|
|
||||||
int threads_per_eu = 7;
|
|
||||||
if (device.has(sycl::aspect::ext_intel_gpu_eu_count)) {
|
|
||||||
number_of_eus = device.get_info<sycl::info::device::ext_intel_gpu_eu_count>();
|
|
||||||
}
|
|
||||||
if (device.has(sycl::aspect::ext_intel_gpu_hw_threads_per_eu)) {
|
|
||||||
threads_per_eu =
|
|
||||||
device.get_info<sycl::info::device::ext_intel_gpu_hw_threads_per_eu>();
|
|
||||||
}
|
|
||||||
/* This filters out all Level-Zero supported GPUs from older generation than Arc. */
|
|
||||||
if (number_of_eus <= 96 && threads_per_eu == 7) {
|
|
||||||
filter_out = true;
|
|
||||||
}
|
|
||||||
/* if not already filtered out, check driver version. */
|
|
||||||
if (!filter_out) {
|
|
||||||
int driver_build_version = parse_driver_build_version(device);
|
|
||||||
if ((driver_build_version > 100000 &&
|
|
||||||
driver_build_version < lowest_supported_driver_version_win) ||
|
|
||||||
driver_build_version < lowest_supported_driver_version_neo) {
|
|
||||||
filter_out = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!allow_host && device.is_host()) {
|
|
||||||
filter_out = true;
|
|
||||||
}
|
|
||||||
else if (!allow_all_devices) {
|
|
||||||
filter_out = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!filter_out) {
|
|
||||||
available_devices.push_back(device);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return available_devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *OneapiDevice::device_capabilities()
|
|
||||||
{
|
|
||||||
std::stringstream capabilities;
|
|
||||||
|
|
||||||
const std::vector<sycl::device> &oneapi_devices = available_devices();
|
|
||||||
for (const sycl::device &device : oneapi_devices) {
|
|
||||||
const std::string &name = device.get_info<sycl::info::device::name>();
|
|
||||||
|
|
||||||
capabilities << std::string("\t") << name << "\n";
|
|
||||||
# define WRITE_ATTR(attribute_name, attribute_variable) \
|
|
||||||
capabilities << "\t\tsycl::info::device::" #attribute_name "\t\t\t" << attribute_variable \
|
|
||||||
<< "\n";
|
|
||||||
# define GET_NUM_ATTR(attribute) \
|
|
||||||
{ \
|
|
||||||
size_t attribute = (size_t)device.get_info<sycl::info::device ::attribute>(); \
|
|
||||||
capabilities << "\t\tsycl::info::device::" #attribute "\t\t\t" << attribute << "\n"; \
|
|
||||||
}
|
|
||||||
|
|
||||||
GET_NUM_ATTR(vendor_id)
|
|
||||||
GET_NUM_ATTR(max_compute_units)
|
|
||||||
GET_NUM_ATTR(max_work_item_dimensions)
|
|
||||||
|
|
||||||
sycl::id<3> max_work_item_sizes =
|
|
||||||
device.get_info<sycl::info::device::max_work_item_sizes<3>>();
|
|
||||||
WRITE_ATTR("max_work_item_sizes_dim0", ((size_t)max_work_item_sizes.get(0)))
|
|
||||||
WRITE_ATTR("max_work_item_sizes_dim1", ((size_t)max_work_item_sizes.get(1)))
|
|
||||||
WRITE_ATTR("max_work_item_sizes_dim2", ((size_t)max_work_item_sizes.get(2)))
|
|
||||||
|
|
||||||
GET_NUM_ATTR(max_work_group_size)
|
|
||||||
GET_NUM_ATTR(max_num_sub_groups)
|
|
||||||
GET_NUM_ATTR(sub_group_independent_forward_progress)
|
|
||||||
|
|
||||||
GET_NUM_ATTR(preferred_vector_width_char)
|
|
||||||
GET_NUM_ATTR(preferred_vector_width_short)
|
|
||||||
GET_NUM_ATTR(preferred_vector_width_int)
|
|
||||||
GET_NUM_ATTR(preferred_vector_width_long)
|
|
||||||
GET_NUM_ATTR(preferred_vector_width_float)
|
|
||||||
GET_NUM_ATTR(preferred_vector_width_double)
|
|
||||||
GET_NUM_ATTR(preferred_vector_width_half)
|
|
||||||
|
|
||||||
GET_NUM_ATTR(native_vector_width_char)
|
|
||||||
GET_NUM_ATTR(native_vector_width_short)
|
|
||||||
GET_NUM_ATTR(native_vector_width_int)
|
|
||||||
GET_NUM_ATTR(native_vector_width_long)
|
|
||||||
GET_NUM_ATTR(native_vector_width_float)
|
|
||||||
GET_NUM_ATTR(native_vector_width_double)
|
|
||||||
GET_NUM_ATTR(native_vector_width_half)
|
|
||||||
|
|
||||||
size_t max_clock_frequency =
|
|
||||||
(size_t)(device.is_host() ? (size_t)0 :
|
|
||||||
device.get_info<sycl::info::device::max_clock_frequency>());
|
|
||||||
WRITE_ATTR("max_clock_frequency", max_clock_frequency)
|
|
||||||
|
|
||||||
GET_NUM_ATTR(address_bits)
|
|
||||||
GET_NUM_ATTR(max_mem_alloc_size)
|
|
||||||
|
|
||||||
/* NOTE(@nsirgien): Implementation doesn't use image support as bindless images aren't
|
|
||||||
* supported so we always return false, even if device supports HW texture usage acceleration.
|
|
||||||
*/
|
|
||||||
bool image_support = false;
|
|
||||||
WRITE_ATTR("image_support", (size_t)image_support)
|
|
||||||
|
|
||||||
GET_NUM_ATTR(max_parameter_size)
|
|
||||||
GET_NUM_ATTR(mem_base_addr_align)
|
|
||||||
GET_NUM_ATTR(global_mem_size)
|
|
||||||
GET_NUM_ATTR(local_mem_size)
|
|
||||||
GET_NUM_ATTR(error_correction_support)
|
|
||||||
GET_NUM_ATTR(profiling_timer_resolution)
|
|
||||||
GET_NUM_ATTR(is_available)
|
|
||||||
|
|
||||||
# undef GET_NUM_ATTR
|
|
||||||
# undef WRITE_ATTR
|
|
||||||
capabilities << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return ::strdup(capabilities.str().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void OneapiDevice::iterate_devices(OneAPIDeviceIteratorCallback cb, void *user_ptr)
|
|
||||||
{
|
|
||||||
int num = 0;
|
|
||||||
std::vector<sycl::device> devices = OneapiDevice::available_devices();
|
|
||||||
for (sycl::device &device : devices) {
|
|
||||||
const std::string &platform_name =
|
|
||||||
device.get_platform().get_info<sycl::info::platform::name>();
|
|
||||||
std::string name = device.get_info<sycl::info::device::name>();
|
|
||||||
std::string id = "ONEAPI_" + platform_name + "_" + name;
|
|
||||||
if (device.has(sycl::aspect::ext_intel_pci_address)) {
|
|
||||||
id.append("_" + device.get_info<sycl::info::device::ext_intel_pci_address>());
|
|
||||||
}
|
|
||||||
(cb)(id.c_str(), name.c_str(), num, user_ptr);
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t OneapiDevice::get_memcapacity()
|
|
||||||
{
|
|
||||||
return reinterpret_cast<sycl::queue *>(device_queue_)
|
|
||||||
->get_device()
|
|
||||||
.get_info<sycl::info::device::global_mem_size>();
|
|
||||||
}
|
|
||||||
|
|
||||||
int OneapiDevice::get_num_multiprocessors()
|
|
||||||
{
|
|
||||||
const sycl::device &device = reinterpret_cast<sycl::queue *>(device_queue_)->get_device();
|
|
||||||
if (device.has(sycl::aspect::ext_intel_gpu_eu_count)) {
|
|
||||||
return device.get_info<sycl::info::device::ext_intel_gpu_eu_count>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int OneapiDevice::get_max_num_threads_per_multiprocessor()
|
|
||||||
{
|
|
||||||
const sycl::device &device = reinterpret_cast<sycl::queue *>(device_queue_)->get_device();
|
|
||||||
if (device.has(sycl::aspect::ext_intel_gpu_eu_simd_width) &&
|
|
||||||
device.has(sycl::aspect::ext_intel_gpu_hw_threads_per_eu)) {
|
|
||||||
return device.get_info<sycl::info::device::ext_intel_gpu_eu_simd_width>() *
|
|
||||||
device.get_info<sycl::info::device::ext_intel_gpu_hw_threads_per_eu>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
@@ -3,12 +3,9 @@
|
|||||||
|
|
||||||
#ifdef WITH_ONEAPI
|
#ifdef WITH_ONEAPI
|
||||||
|
|
||||||
# include <CL/sycl.hpp>
|
|
||||||
|
|
||||||
# include "device/device.h"
|
# include "device/device.h"
|
||||||
# include "device/oneapi/device.h"
|
# include "device/oneapi/device.h"
|
||||||
# include "device/oneapi/queue.h"
|
# include "device/oneapi/queue.h"
|
||||||
# include "kernel/device/oneapi/kernel.h"
|
|
||||||
|
|
||||||
# include "util/map.h"
|
# include "util/map.h"
|
||||||
|
|
||||||
@@ -16,11 +13,6 @@ CCL_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
class DeviceQueue;
|
class DeviceQueue;
|
||||||
|
|
||||||
typedef void (*OneAPIDeviceIteratorCallback)(const char *id,
|
|
||||||
const char *name,
|
|
||||||
int num,
|
|
||||||
void *user_ptr);
|
|
||||||
|
|
||||||
class OneapiDevice : public Device {
|
class OneapiDevice : public Device {
|
||||||
private:
|
private:
|
||||||
SyclQueue *device_queue_;
|
SyclQueue *device_queue_;
|
||||||
@@ -33,12 +25,16 @@ class OneapiDevice : public Device {
|
|||||||
void *kg_memory_device_;
|
void *kg_memory_device_;
|
||||||
size_t kg_memory_size_ = (size_t)0;
|
size_t kg_memory_size_ = (size_t)0;
|
||||||
size_t max_memory_on_device_ = (size_t)0;
|
size_t max_memory_on_device_ = (size_t)0;
|
||||||
|
OneAPIDLLInterface oneapi_dll_;
|
||||||
std::string oneapi_error_string_;
|
std::string oneapi_error_string_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual BVHLayoutMask get_bvh_layout_mask() const override;
|
virtual BVHLayoutMask get_bvh_layout_mask() const override;
|
||||||
|
|
||||||
OneapiDevice(const DeviceInfo &info, Stats &stats, Profiler &profiler);
|
OneapiDevice(const DeviceInfo &info,
|
||||||
|
OneAPIDLLInterface &oneapi_dll_object,
|
||||||
|
Stats &stats,
|
||||||
|
Profiler &profiler);
|
||||||
|
|
||||||
virtual ~OneapiDevice();
|
virtual ~OneapiDevice();
|
||||||
|
|
||||||
@@ -54,8 +50,12 @@ class OneapiDevice : public Device {
|
|||||||
|
|
||||||
void generic_free(device_memory &mem);
|
void generic_free(device_memory &mem);
|
||||||
|
|
||||||
|
SyclQueue *sycl_queue();
|
||||||
|
|
||||||
string oneapi_error_message();
|
string oneapi_error_message();
|
||||||
|
|
||||||
|
OneAPIDLLInterface oneapi_dll_object();
|
||||||
|
|
||||||
void *kernel_globals_device_pointer();
|
void *kernel_globals_device_pointer();
|
||||||
|
|
||||||
void mem_alloc(device_memory &mem) override;
|
void mem_alloc(device_memory &mem) override;
|
||||||
@@ -90,37 +90,13 @@ class OneapiDevice : public Device {
|
|||||||
|
|
||||||
virtual unique_ptr<DeviceQueue> gpu_queue_create() override;
|
virtual unique_ptr<DeviceQueue> gpu_queue_create() override;
|
||||||
|
|
||||||
|
int get_num_multiprocessors();
|
||||||
|
int get_max_num_threads_per_multiprocessor();
|
||||||
|
|
||||||
/* NOTE(@nsirgien): Create this methods to avoid some compilation problems on Windows with host
|
/* NOTE(@nsirgien): Create this methods to avoid some compilation problems on Windows with host
|
||||||
* side compilation (MSVC). */
|
* side compilation (MSVC). */
|
||||||
void *usm_aligned_alloc_host(size_t memory_size, size_t alignment);
|
void *usm_aligned_alloc_host(size_t memory_size, size_t alignment);
|
||||||
void usm_free(void *usm_ptr);
|
void usm_free(void *usm_ptr);
|
||||||
|
|
||||||
static std::vector<sycl::device> available_devices();
|
|
||||||
static char *device_capabilities();
|
|
||||||
static int parse_driver_build_version(const sycl::device &device);
|
|
||||||
static void iterate_devices(OneAPIDeviceIteratorCallback cb, void *user_ptr);
|
|
||||||
|
|
||||||
size_t get_memcapacity();
|
|
||||||
int get_num_multiprocessors();
|
|
||||||
int get_max_num_threads_per_multiprocessor();
|
|
||||||
bool queue_synchronize(SyclQueue *queue);
|
|
||||||
bool kernel_globals_size(size_t &kernel_global_size);
|
|
||||||
void set_global_memory(SyclQueue *queue,
|
|
||||||
void *kernel_globals,
|
|
||||||
const char *memory_name,
|
|
||||||
void *memory_device_pointer);
|
|
||||||
bool enqueue_kernel(KernelContext *kernel_context, int kernel, size_t global_size, void **args);
|
|
||||||
SyclQueue *sycl_queue();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void check_usm(SyclQueue *queue, const void *usm_ptr, bool allow_host);
|
|
||||||
bool create_queue(SyclQueue *&external_queue, int device_index);
|
|
||||||
void free_queue(SyclQueue *queue);
|
|
||||||
void *usm_aligned_alloc_host(SyclQueue *queue, size_t memory_size, size_t alignment);
|
|
||||||
void *usm_alloc_device(SyclQueue *queue, size_t memory_size);
|
|
||||||
void usm_free(SyclQueue *queue, void *usm_ptr);
|
|
||||||
bool usm_memcpy(SyclQueue *queue, void *dest, void *src, size_t num_bytes);
|
|
||||||
bool usm_memset(SyclQueue *queue, void *usm_ptr, unsigned char value, size_t num_bytes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
17
intern/cycles/device/oneapi/dll_interface.h
Normal file
17
intern/cycles/device/oneapi/dll_interface.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/* SPDX-License-Identifier: Apache-2.0
|
||||||
|
* Copyright 2011-2022 Blender Foundation */
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* Include kernel header to get access to SYCL-specific types, like SyclQueue and
|
||||||
|
* OneAPIDeviceIteratorCallback. */
|
||||||
|
#include "kernel/device/oneapi/kernel.h"
|
||||||
|
|
||||||
|
#ifdef WITH_ONEAPI
|
||||||
|
struct OneAPIDLLInterface {
|
||||||
|
# define DLL_INTERFACE_CALL(function, return_type, ...) \
|
||||||
|
return_type (*function)(__VA_ARGS__) = nullptr;
|
||||||
|
# include "kernel/device/oneapi/dll_interface_template.h"
|
||||||
|
# undef DLL_INTERFACE_CALL
|
||||||
|
};
|
||||||
|
#endif
|
@@ -22,7 +22,10 @@ struct KernelExecutionInfo {
|
|||||||
/* OneapiDeviceQueue */
|
/* OneapiDeviceQueue */
|
||||||
|
|
||||||
OneapiDeviceQueue::OneapiDeviceQueue(OneapiDevice *device)
|
OneapiDeviceQueue::OneapiDeviceQueue(OneapiDevice *device)
|
||||||
: DeviceQueue(device), oneapi_device_(device), kernel_context_(nullptr)
|
: DeviceQueue(device),
|
||||||
|
oneapi_device_(device),
|
||||||
|
oneapi_dll_(device->oneapi_dll_object()),
|
||||||
|
kernel_context_(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,14 +81,14 @@ bool OneapiDeviceQueue::enqueue(DeviceKernel kernel,
|
|||||||
assert(signed_kernel_work_size >= 0);
|
assert(signed_kernel_work_size >= 0);
|
||||||
size_t kernel_work_size = (size_t)signed_kernel_work_size;
|
size_t kernel_work_size = (size_t)signed_kernel_work_size;
|
||||||
|
|
||||||
size_t kernel_local_size = oneapi_kernel_preferred_local_size(
|
size_t kernel_local_size = oneapi_dll_.oneapi_kernel_preferred_local_size(
|
||||||
kernel_context_->queue, (::DeviceKernel)kernel, kernel_work_size);
|
kernel_context_->queue, (::DeviceKernel)kernel, kernel_work_size);
|
||||||
size_t uniformed_kernel_work_size = round_up(kernel_work_size, kernel_local_size);
|
size_t uniformed_kernel_work_size = round_up(kernel_work_size, kernel_local_size);
|
||||||
|
|
||||||
assert(kernel_context_);
|
assert(kernel_context_);
|
||||||
|
|
||||||
/* Call the oneAPI kernel DLL to launch the requested kernel. */
|
/* Call the oneAPI kernel DLL to launch the requested kernel. */
|
||||||
bool is_finished_ok = oneapi_device_->enqueue_kernel(
|
bool is_finished_ok = oneapi_dll_.oneapi_enqueue_kernel(
|
||||||
kernel_context_, kernel, uniformed_kernel_work_size, args);
|
kernel_context_, kernel, uniformed_kernel_work_size, args);
|
||||||
|
|
||||||
if (is_finished_ok == false) {
|
if (is_finished_ok == false) {
|
||||||
@@ -105,7 +108,7 @@ bool OneapiDeviceQueue::synchronize()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_finished_ok = oneapi_device_->queue_synchronize(oneapi_device_->sycl_queue());
|
bool is_finished_ok = oneapi_dll_.oneapi_queue_synchronize(oneapi_device_->sycl_queue());
|
||||||
if (is_finished_ok == false)
|
if (is_finished_ok == false)
|
||||||
oneapi_device_->set_error("oneAPI unknown kernel execution error: got runtime exception \"" +
|
oneapi_device_->set_error("oneAPI unknown kernel execution error: got runtime exception \"" +
|
||||||
oneapi_device_->oneapi_error_message() + "\"");
|
oneapi_device_->oneapi_error_message() + "\"");
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
# include "device/queue.h"
|
# include "device/queue.h"
|
||||||
|
|
||||||
# include "device/oneapi/device.h"
|
# include "device/oneapi/device.h"
|
||||||
# include "kernel/device/oneapi/kernel.h"
|
# include "device/oneapi/dll_interface.h"
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@@ -41,7 +41,9 @@ class OneapiDeviceQueue : public DeviceQueue {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
OneapiDevice *oneapi_device_;
|
OneapiDevice *oneapi_device_;
|
||||||
|
OneAPIDLLInterface oneapi_dll_;
|
||||||
KernelContext *kernel_context_;
|
KernelContext *kernel_context_;
|
||||||
|
bool with_kernel_statistics_;
|
||||||
};
|
};
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
@@ -43,11 +43,8 @@ PathTrace::PathTrace(Device *device,
|
|||||||
/* Create path tracing work in advance, so that it can be reused by incremental sampling as much
|
/* Create path tracing work in advance, so that it can be reused by incremental sampling as much
|
||||||
* as possible. */
|
* as possible. */
|
||||||
device_->foreach_device([&](Device *path_trace_device) {
|
device_->foreach_device([&](Device *path_trace_device) {
|
||||||
unique_ptr<PathTraceWork> work = PathTraceWork::create(
|
path_trace_works_.emplace_back(PathTraceWork::create(
|
||||||
path_trace_device, film, device_scene, &render_cancel_.is_requested);
|
path_trace_device, film, device_scene, &render_cancel_.is_requested));
|
||||||
if (work) {
|
|
||||||
path_trace_works_.emplace_back(std::move(work));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
work_balance_infos_.resize(path_trace_works_.size());
|
work_balance_infos_.resize(path_trace_works_.size());
|
||||||
@@ -1296,7 +1293,6 @@ void PathTrace::set_guiding_params(const GuidingParams &guiding_params, const bo
|
|||||||
# if OPENPGL_VERSION_MINOR >= 4
|
# if OPENPGL_VERSION_MINOR >= 4
|
||||||
field_args.deterministic = guiding_params.deterministic;
|
field_args.deterministic = guiding_params.deterministic;
|
||||||
# endif
|
# endif
|
||||||
reinterpret_cast<PGLKDTreeArguments *>(field_args.spatialSturctureArguments)->maxDepth = 16;
|
|
||||||
openpgl::cpp::Device *guiding_device = static_cast<openpgl::cpp::Device *>(
|
openpgl::cpp::Device *guiding_device = static_cast<openpgl::cpp::Device *>(
|
||||||
device_->get_guiding_device());
|
device_->get_guiding_device());
|
||||||
if (guiding_device) {
|
if (guiding_device) {
|
||||||
|
@@ -23,10 +23,6 @@ unique_ptr<PathTraceWork> PathTraceWork::create(Device *device,
|
|||||||
if (device->info.type == DEVICE_CPU) {
|
if (device->info.type == DEVICE_CPU) {
|
||||||
return make_unique<PathTraceWorkCPU>(device, film, device_scene, cancel_requested_flag);
|
return make_unique<PathTraceWorkCPU>(device, film, device_scene, cancel_requested_flag);
|
||||||
}
|
}
|
||||||
if (device->info.type == DEVICE_DUMMY) {
|
|
||||||
/* Dummy devices can't perform any work. */
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return make_unique<PathTraceWorkGPU>(device, film, device_scene, cancel_requested_flag);
|
return make_unique<PathTraceWorkGPU>(device, film, device_scene, cancel_requested_flag);
|
||||||
}
|
}
|
||||||
|
@@ -285,7 +285,7 @@ void PathTraceWorkCPU::cryptomatte_postproces()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_PATH_GUIDING
|
#ifdef WITH_PATH_GUIDING
|
||||||
/* NOTE: It seems that this is called before every rendering iteration/progression and not once per
|
/* Note: It seems that this is called before every rendering iteration/progression and not once per
|
||||||
* rendering. May be we find a way to call it only once per rendering. */
|
* rendering. May be we find a way to call it only once per rendering. */
|
||||||
void PathTraceWorkCPU::guiding_init_kernel_globals(void *guiding_field,
|
void PathTraceWorkCPU::guiding_init_kernel_globals(void *guiding_field,
|
||||||
void *sample_data_storage,
|
void *sample_data_storage,
|
||||||
|
@@ -17,9 +17,6 @@ void work_balance_do_initial(vector<WorkBalanceInfo> &work_balance_infos)
|
|||||||
work_balance_infos[0].weight = 1.0;
|
work_balance_infos[0].weight = 1.0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (num_infos == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* There is no statistics available, so start with an equal distribution. */
|
/* There is no statistics available, so start with an equal distribution. */
|
||||||
const double weight = 1.0 / num_infos;
|
const double weight = 1.0 / num_infos;
|
||||||
|
@@ -716,7 +716,7 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/cycles_kernel_oneapi.dll)
|
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/cycles_kernel_oneapi.dll)
|
||||||
else()
|
else()
|
||||||
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/libcycles_kernel_oneapi.so)
|
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/cycles_kernel_oneapi.so)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(cycles_oneapi_kernel_sources
|
set(cycles_oneapi_kernel_sources
|
||||||
@@ -727,20 +727,14 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
${SRC_UTIL_HEADERS}
|
${SRC_UTIL_HEADERS}
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SYCL_OFFLINE_COMPILER_PARALLEL_JOBS 1 CACHE STRING "Number of parallel compiler instances to use for device binaries compilation (expect ~8GB peak memory usage per instance).")
|
|
||||||
if (WITH_CYCLES_ONEAPI_BINARIES)
|
|
||||||
message(STATUS "${SYCL_OFFLINE_COMPILER_PARALLEL_JOBS} instance(s) of oneAPI offline compiler will be used.")
|
|
||||||
endif()
|
|
||||||
# SYCL_CPP_FLAGS is a variable that the user can set to pass extra compiler options
|
# SYCL_CPP_FLAGS is a variable that the user can set to pass extra compiler options
|
||||||
set(sycl_compiler_flags
|
set(sycl_compiler_flags
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/${SRC_KERNEL_DEVICE_ONEAPI}
|
${CMAKE_CURRENT_SOURCE_DIR}/${SRC_KERNEL_DEVICE_ONEAPI}
|
||||||
-fsycl
|
-fsycl
|
||||||
-fsycl-unnamed-lambda
|
-fsycl-unnamed-lambda
|
||||||
-fdelayed-template-parsing
|
-fdelayed-template-parsing
|
||||||
-mllvm -inlinedefault-threshold=250
|
-mllvm -inlinedefault-threshold=300
|
||||||
-mllvm -inlinehint-threshold=350
|
-mllvm -inlinehint-threshold=400
|
||||||
-fsycl-device-code-split=per_kernel
|
|
||||||
-fsycl-max-parallel-link-jobs=${SYCL_OFFLINE_COMPILER_PARALLEL_JOBS}
|
|
||||||
-shared
|
-shared
|
||||||
-DWITH_ONEAPI
|
-DWITH_ONEAPI
|
||||||
-ffast-math
|
-ffast-math
|
||||||
@@ -751,6 +745,7 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
${SYCL_CPP_FLAGS}
|
${SYCL_CPP_FLAGS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if (WITH_CYCLES_ONEAPI_SYCL_HOST_ENABLED)
|
if (WITH_CYCLES_ONEAPI_SYCL_HOST_ENABLED)
|
||||||
list(APPEND sycl_compiler_flags -DWITH_ONEAPI_SYCL_HOST_ENABLED)
|
list(APPEND sycl_compiler_flags -DWITH_ONEAPI_SYCL_HOST_ENABLED)
|
||||||
endif()
|
endif()
|
||||||
@@ -807,7 +802,6 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
list(APPEND sycl_compiler_flags
|
list(APPEND sycl_compiler_flags
|
||||||
-fuse-ld=link
|
|
||||||
-fms-extensions
|
-fms-extensions
|
||||||
-fms-compatibility
|
-fms-compatibility
|
||||||
-D_WINDLL
|
-D_WINDLL
|
||||||
@@ -818,43 +812,36 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
-D_CRT_SECURE_NO_DEPRECATE
|
-D_CRT_SECURE_NO_DEPRECATE
|
||||||
-DONEAPI_EXPORT)
|
-DONEAPI_EXPORT)
|
||||||
|
|
||||||
string(REPLACE /Redist/ /Tools/ MSVC_TOOLS_DIR ${MSVC_REDIST_DIR})
|
if(sycl_compiler_compiler_name MATCHES "dpcpp")
|
||||||
if(NOT CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) # case for Ninja on Windows
|
# The oneAPI distribution calls the compiler "dpcpp" and comes with a script that sets environment variables.
|
||||||
get_filename_component(cmake_mt_dir ${CMAKE_MT} DIRECTORY)
|
add_custom_command(
|
||||||
string(REPLACE /bin/ /Lib/ WINDOWS_KIT_DIR ${cmake_mt_dir})
|
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||||
get_filename_component(WINDOWS_KIT_DIR "${WINDOWS_KIT_DIR}/../" ABSOLUTE)
|
COMMAND "${sycl_compiler_root}/../../env/vars.bat"
|
||||||
|
COMMAND ${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}
|
||||||
|
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||||
else()
|
else()
|
||||||
set(WINDOWS_KIT_DIR ${WINDOWS_KITS_DIR}/Lib/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})
|
# The open source SYCL compiler just goes by clang++ and does not have such a script.
|
||||||
|
# Set the variables manually.
|
||||||
|
string(REPLACE /Redist/ /Tools/ MSVC_TOOLS_DIR ${MSVC_REDIST_DIR})
|
||||||
|
if(NOT CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) # case for Ninja on Windows
|
||||||
|
get_filename_component(cmake_mt_dir ${CMAKE_MT} DIRECTORY)
|
||||||
|
string(REPLACE /bin/ /Lib/ WINDOWS_KIT_DIR ${cmake_mt_dir})
|
||||||
|
get_filename_component(WINDOWS_KIT_DIR "${WINDOWS_KIT_DIR}/../" ABSOLUTE)
|
||||||
|
else()
|
||||||
|
set(WINDOWS_KIT_DIR ${WINDOWS_KITS_DIR}/Lib/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})
|
||||||
|
endif()
|
||||||
|
list(APPEND sycl_compiler_flags
|
||||||
|
-L "${MSVC_TOOLS_DIR}/lib/x64"
|
||||||
|
-L "${WINDOWS_KIT_DIR}/um/x64"
|
||||||
|
-L "${WINDOWS_KIT_DIR}/ucrt/x64")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env
|
||||||
|
"LIB=${sycl_compiler_root}/../lib" # for compiler to find sycl.lib
|
||||||
|
"PATH=${OCLOC_INSTALL_DIR};${sycl_compiler_root}"
|
||||||
|
${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}
|
||||||
|
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||||
endif()
|
endif()
|
||||||
list(APPEND sycl_compiler_flags
|
|
||||||
-L "${MSVC_TOOLS_DIR}/lib/x64"
|
|
||||||
-L "${WINDOWS_KIT_DIR}/um/x64"
|
|
||||||
-L "${WINDOWS_KIT_DIR}/ucrt/x64")
|
|
||||||
|
|
||||||
set(sycl_compiler_flags_Release ${sycl_compiler_flags})
|
|
||||||
set(sycl_compiler_flags_Debug ${sycl_compiler_flags})
|
|
||||||
set(sycl_compiler_flags_RelWithDebInfo ${sycl_compiler_flags})
|
|
||||||
set(sycl_compiler_flags_MinSizeRel ${sycl_compiler_flags})
|
|
||||||
list(APPEND sycl_compiler_flags_RelWithDebInfo -g)
|
|
||||||
get_filename_component(sycl_library_debug_name ${SYCL_LIBRARY_DEBUG} NAME_WE)
|
|
||||||
list(APPEND sycl_compiler_flags_Debug
|
|
||||||
-g
|
|
||||||
-D_DEBUG
|
|
||||||
-nostdlib -Xclang --dependent-lib=msvcrtd
|
|
||||||
-Xclang --dependent-lib=${sycl_library_debug_name})
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${cycles_kernel_oneapi_lib}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E env
|
|
||||||
"LIB=${sycl_compiler_root}/../lib" # for compiler to find sycl.lib
|
|
||||||
"PATH=${OCLOC_INSTALL_DIR}\;${sycl_compiler_root}"
|
|
||||||
${SYCL_COMPILER}
|
|
||||||
"$<$<CONFIG:Release>:${sycl_compiler_flags_Release}>"
|
|
||||||
"$<$<CONFIG:RelWithDebInfo>:${sycl_compiler_flags_RelWithDebInfo}>"
|
|
||||||
"$<$<CONFIG:Debug>:${sycl_compiler_flags_Debug}>"
|
|
||||||
"$<$<CONFIG:MinSizeRel>:${sycl_compiler_flags_Release}>"
|
|
||||||
COMMAND_EXPAND_LISTS
|
|
||||||
DEPENDS ${cycles_oneapi_kernel_sources})
|
|
||||||
else()
|
else()
|
||||||
list(APPEND sycl_compiler_flags -fPIC)
|
list(APPEND sycl_compiler_flags -fPIC)
|
||||||
|
|
||||||
@@ -866,36 +853,55 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
# libpi_level_zero.so can be placed next to it and get found.
|
# libpi_level_zero.so can be placed next to it and get found.
|
||||||
list(APPEND sycl_compiler_flags -Wl,-rpath,'$$ORIGIN')
|
list(APPEND sycl_compiler_flags -Wl,-rpath,'$$ORIGIN')
|
||||||
|
|
||||||
if(NOT IGC_INSTALL_DIR)
|
# The oneAPI distribution calls the compiler "dpcpp" and comes with a script that sets environment variables.
|
||||||
get_filename_component(IGC_INSTALL_DIR "${sycl_compiler_root}/../lib/igc" ABSOLUTE)
|
if(sycl_compiler_compiler_name MATCHES "dpcpp")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||||
|
COMMAND bash -c \"source ${sycl_compiler_root}/../../env/vars.sh&&${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}\"
|
||||||
|
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||||
|
else()
|
||||||
|
# The open source SYCL compiler just goes by clang++ and does not have such a script.
|
||||||
|
# Set the variables manually.
|
||||||
|
if(NOT IGC_INSTALL_DIR)
|
||||||
|
get_filename_component(IGC_INSTALL_DIR "${sycl_compiler_root}/../lib/igc" ABSOLUTE)
|
||||||
|
endif()
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env
|
||||||
|
"LD_LIBRARY_PATH=${sycl_compiler_root}/../lib:${OCLOC_INSTALL_DIR}/lib:${IGC_INSTALL_DIR}/lib"
|
||||||
|
"PATH=${OCLOC_INSTALL_DIR}/bin:${sycl_compiler_root}:$ENV{PATH}" # env PATH is for compiler to find ld
|
||||||
|
${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}
|
||||||
|
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||||
endif()
|
endif()
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${cycles_kernel_oneapi_lib}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E env
|
|
||||||
"LD_LIBRARY_PATH=${sycl_compiler_root}/../lib:${OCLOC_INSTALL_DIR}/lib:${IGC_INSTALL_DIR}/lib"
|
|
||||||
"PATH=${OCLOC_INSTALL_DIR}/bin:${sycl_compiler_root}:$ENV{PATH}" # env PATH is for compiler to find ld
|
|
||||||
${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}
|
|
||||||
DEPENDS ${cycles_oneapi_kernel_sources})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT WITH_BLENDER)
|
|
||||||
# For the Cycles standalone put libraries next to the Cycles application.
|
|
||||||
set(cycles_oneapi_target_path ${CYCLES_INSTALL_PATH})
|
|
||||||
else()
|
|
||||||
# For Blender put the libraries next to the Blender executable.
|
|
||||||
#
|
|
||||||
# Note that the installation path in the delayed_install is relative to the versioned folder,
|
|
||||||
# which means we need to go one level up.
|
|
||||||
set(cycles_oneapi_target_path "../")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# install dynamic libraries required at runtime
|
# install dynamic libraries required at runtime
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
delayed_install("" "${cycles_kernel_oneapi_lib}" ${cycles_oneapi_target_path})
|
set(SYCL_RUNTIME_DEPENDENCIES
|
||||||
|
sycl.dll
|
||||||
|
pi_level_zero.dll
|
||||||
|
)
|
||||||
|
if(NOT WITH_BLENDER)
|
||||||
|
# For the Cycles standalone put libraries next to the Cycles application.
|
||||||
|
delayed_install("${sycl_compiler_root}" "${SYCL_RUNTIME_DEPENDENCIES}" ${CYCLES_INSTALL_PATH})
|
||||||
|
else()
|
||||||
|
# For Blender put the libraries next to the Blender executable.
|
||||||
|
#
|
||||||
|
# Note that the installation path in the delayed_install is relative to the versioned folder,
|
||||||
|
# which means we need to go one level up.
|
||||||
|
delayed_install("${sycl_compiler_root}" "${SYCL_RUNTIME_DEPENDENCIES}" "../")
|
||||||
|
endif()
|
||||||
elseif(UNIX AND NOT APPLE)
|
elseif(UNIX AND NOT APPLE)
|
||||||
delayed_install("" "${cycles_kernel_oneapi_lib}" ${cycles_oneapi_target_path}/lib)
|
file(GLOB SYCL_RUNTIME_DEPENDENCIES
|
||||||
|
${sycl_compiler_root}/../lib/libsycl.so
|
||||||
|
${sycl_compiler_root}/../lib/libsycl.so.[0-9]
|
||||||
|
${sycl_compiler_root}/../lib/libsycl.so.[0-9].[0-9].[0-9]-[0-9]
|
||||||
|
)
|
||||||
|
list(APPEND SYCL_RUNTIME_DEPENDENCIES ${sycl_compiler_root}/../lib/libpi_level_zero.so)
|
||||||
|
delayed_install("" "${SYCL_RUNTIME_DEPENDENCIES}" ${CYCLES_INSTALL_PATH}/lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cycles_kernel_oneapi_lib}" ${CYCLES_INSTALL_PATH}/lib)
|
||||||
add_custom_target(cycles_kernel_oneapi ALL DEPENDS ${cycles_kernel_oneapi_lib})
|
add_custom_target(cycles_kernel_oneapi ALL DEPENDS ${cycles_kernel_oneapi_lib})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
54
intern/cycles/kernel/device/oneapi/dll_interface_template.h
Normal file
54
intern/cycles/kernel/device/oneapi/dll_interface_template.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/* SPDX-License-Identifier: Apache-2.0
|
||||||
|
* Copyright 2022 Intel Corporation */
|
||||||
|
|
||||||
|
/* device_capabilities() returns a C string that must be free'd with oneapi_free(). */
|
||||||
|
DLL_INTERFACE_CALL(oneapi_device_capabilities, char *)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_free, void, void *)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_get_memcapacity, size_t, SyclQueue *queue)
|
||||||
|
|
||||||
|
DLL_INTERFACE_CALL(oneapi_get_num_multiprocessors, int, SyclQueue *queue)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_get_max_num_threads_per_multiprocessor, int, SyclQueue *queue)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_iterate_devices, void, OneAPIDeviceIteratorCallback cb, void *user_ptr)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_set_error_cb, void, OneAPIErrorCallback, void *user_ptr)
|
||||||
|
|
||||||
|
DLL_INTERFACE_CALL(oneapi_create_queue, bool, SyclQueue *&external_queue, int device_index)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_free_queue, void, SyclQueue *queue)
|
||||||
|
DLL_INTERFACE_CALL(
|
||||||
|
oneapi_usm_aligned_alloc_host, void *, SyclQueue *queue, size_t memory_size, size_t alignment)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_usm_alloc_device, void *, SyclQueue *queue, size_t memory_size)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_usm_free, void, SyclQueue *queue, void *usm_ptr)
|
||||||
|
|
||||||
|
DLL_INTERFACE_CALL(
|
||||||
|
oneapi_usm_memcpy, bool, SyclQueue *queue, void *dest, void *src, size_t num_bytes)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_queue_synchronize, bool, SyclQueue *queue)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_usm_memset,
|
||||||
|
bool,
|
||||||
|
SyclQueue *queue,
|
||||||
|
void *usm_ptr,
|
||||||
|
unsigned char value,
|
||||||
|
size_t num_bytes)
|
||||||
|
|
||||||
|
DLL_INTERFACE_CALL(oneapi_run_test_kernel, bool, SyclQueue *queue)
|
||||||
|
|
||||||
|
/* Operation with Kernel globals structure - map of global/constant allocation - filled before
|
||||||
|
* render/kernel execution As we don't know in cycles `sizeof` this - Cycles will manage just as
|
||||||
|
* pointer. */
|
||||||
|
DLL_INTERFACE_CALL(oneapi_kernel_globals_size, bool, SyclQueue *queue, size_t &kernel_global_size)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_set_global_memory,
|
||||||
|
void,
|
||||||
|
SyclQueue *queue,
|
||||||
|
void *kernel_globals,
|
||||||
|
const char *memory_name,
|
||||||
|
void *memory_device_pointer)
|
||||||
|
|
||||||
|
DLL_INTERFACE_CALL(oneapi_kernel_preferred_local_size,
|
||||||
|
size_t,
|
||||||
|
SyclQueue *queue,
|
||||||
|
const DeviceKernel kernel,
|
||||||
|
const size_t kernel_global_size)
|
||||||
|
DLL_INTERFACE_CALL(oneapi_enqueue_kernel,
|
||||||
|
bool,
|
||||||
|
KernelContext *context,
|
||||||
|
int kernel,
|
||||||
|
size_t global_size,
|
||||||
|
void **args)
|
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#ifdef WITH_ONEAPI
|
#ifdef WITH_ONEAPI
|
||||||
|
|
||||||
|
/* clang-format off */
|
||||||
# include "kernel.h"
|
# include "kernel.h"
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <map>
|
# include <map>
|
||||||
@@ -15,67 +16,195 @@
|
|||||||
# include "kernel/device/oneapi/kernel_templates.h"
|
# include "kernel/device/oneapi/kernel_templates.h"
|
||||||
|
|
||||||
# include "kernel/device/gpu/kernel.h"
|
# include "kernel/device/gpu/kernel.h"
|
||||||
|
/* clang-format on */
|
||||||
|
|
||||||
static OneAPIErrorCallback s_error_cb = nullptr;
|
static OneAPIErrorCallback s_error_cb = nullptr;
|
||||||
static void *s_error_user_ptr = nullptr;
|
static void *s_error_user_ptr = nullptr;
|
||||||
|
|
||||||
|
static std::vector<sycl::device> oneapi_available_devices();
|
||||||
|
|
||||||
void oneapi_set_error_cb(OneAPIErrorCallback cb, void *user_ptr)
|
void oneapi_set_error_cb(OneAPIErrorCallback cb, void *user_ptr)
|
||||||
{
|
{
|
||||||
s_error_cb = cb;
|
s_error_cb = cb;
|
||||||
s_error_user_ptr = user_ptr;
|
s_error_user_ptr = user_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE(@nsirgien): Execution of this simple kernel will check basic functionality like
|
void oneapi_check_usm(SyclQueue *queue_, const void *usm_ptr, bool allow_host = false)
|
||||||
* memory allocations, memory transfers and execution of kernel with USM memory. */
|
{
|
||||||
|
# ifdef _DEBUG
|
||||||
|
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||||
|
sycl::info::device_type device_type =
|
||||||
|
queue->get_device().get_info<sycl::info::device::device_type>();
|
||||||
|
sycl::usm::alloc usm_type = get_pointer_type(usm_ptr, queue->get_context());
|
||||||
|
(void)usm_type;
|
||||||
|
assert(usm_type == sycl::usm::alloc::device ||
|
||||||
|
((device_type == sycl::info::device_type::host ||
|
||||||
|
device_type == sycl::info::device_type::is_cpu || allow_host) &&
|
||||||
|
usm_type == sycl::usm::alloc::host));
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool oneapi_create_queue(SyclQueue *&external_queue, int device_index)
|
||||||
|
{
|
||||||
|
bool finished_correct = true;
|
||||||
|
try {
|
||||||
|
std::vector<sycl::device> devices = oneapi_available_devices();
|
||||||
|
if (device_index < 0 || device_index >= devices.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sycl::queue *created_queue = new sycl::queue(devices[device_index],
|
||||||
|
sycl::property::queue::in_order());
|
||||||
|
external_queue = reinterpret_cast<SyclQueue *>(created_queue);
|
||||||
|
}
|
||||||
|
catch (sycl::exception const &e) {
|
||||||
|
finished_correct = false;
|
||||||
|
if (s_error_cb) {
|
||||||
|
s_error_cb(e.what(), s_error_user_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return finished_correct;
|
||||||
|
}
|
||||||
|
|
||||||
|
void oneapi_free_queue(SyclQueue *queue_)
|
||||||
|
{
|
||||||
|
assert(queue_);
|
||||||
|
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||||
|
delete queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *oneapi_usm_aligned_alloc_host(SyclQueue *queue_, size_t memory_size, size_t alignment)
|
||||||
|
{
|
||||||
|
assert(queue_);
|
||||||
|
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||||
|
return sycl::aligned_alloc_host(alignment, memory_size, *queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *oneapi_usm_alloc_device(SyclQueue *queue_, size_t memory_size)
|
||||||
|
{
|
||||||
|
assert(queue_);
|
||||||
|
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||||
|
return sycl::malloc_device(memory_size, *queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void oneapi_usm_free(SyclQueue *queue_, void *usm_ptr)
|
||||||
|
{
|
||||||
|
assert(queue_);
|
||||||
|
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||||
|
oneapi_check_usm(queue_, usm_ptr, true);
|
||||||
|
sycl::free(usm_ptr, *queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool oneapi_usm_memcpy(SyclQueue *queue_, void *dest, void *src, size_t num_bytes)
|
||||||
|
{
|
||||||
|
assert(queue_);
|
||||||
|
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||||
|
oneapi_check_usm(queue_, dest, true);
|
||||||
|
oneapi_check_usm(queue_, src, true);
|
||||||
|
sycl::event mem_event = queue->memcpy(dest, src, num_bytes);
|
||||||
|
# ifdef WITH_CYCLES_DEBUG
|
||||||
|
try {
|
||||||
|
/* NOTE(@nsirgien) Waiting on memory operation may give more precise error
|
||||||
|
* messages. Due to impact on occupancy, it makes sense to enable it only during Cycles debug.
|
||||||
|
*/
|
||||||
|
mem_event.wait_and_throw();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (sycl::exception const &e) {
|
||||||
|
if (s_error_cb) {
|
||||||
|
s_error_cb(e.what(), s_error_user_ptr);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
# else
|
||||||
|
sycl::usm::alloc dest_type = get_pointer_type(dest, queue->get_context());
|
||||||
|
sycl::usm::alloc src_type = get_pointer_type(src, queue->get_context());
|
||||||
|
bool from_device_to_host = dest_type == sycl::usm::alloc::host &&
|
||||||
|
src_type == sycl::usm::alloc::device;
|
||||||
|
bool host_or_device_memop_with_offset = dest_type == sycl::usm::alloc::unknown ||
|
||||||
|
src_type == sycl::usm::alloc::unknown;
|
||||||
|
/* NOTE(@sirgienko) Host-side blocking wait on this operation is mandatory, otherwise the host
|
||||||
|
* may not wait until the end of the transfer before using the memory.
|
||||||
|
*/
|
||||||
|
if (from_device_to_host || host_or_device_memop_with_offset)
|
||||||
|
mem_event.wait();
|
||||||
|
return true;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool oneapi_usm_memset(SyclQueue *queue_, void *usm_ptr, unsigned char value, size_t num_bytes)
|
||||||
|
{
|
||||||
|
assert(queue_);
|
||||||
|
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||||
|
oneapi_check_usm(queue_, usm_ptr, true);
|
||||||
|
sycl::event mem_event = queue->memset(usm_ptr, value, num_bytes);
|
||||||
|
# ifdef WITH_CYCLES_DEBUG
|
||||||
|
try {
|
||||||
|
/* NOTE(@nsirgien) Waiting on memory operation may give more precise error
|
||||||
|
* messages. Due to impact on occupancy, it makes sense to enable it only during Cycles debug.
|
||||||
|
*/
|
||||||
|
mem_event.wait_and_throw();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (sycl::exception const &e) {
|
||||||
|
if (s_error_cb) {
|
||||||
|
s_error_cb(e.what(), s_error_user_ptr);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
# else
|
||||||
|
(void)mem_event;
|
||||||
|
return true;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool oneapi_queue_synchronize(SyclQueue *queue_)
|
||||||
|
{
|
||||||
|
assert(queue_);
|
||||||
|
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||||
|
try {
|
||||||
|
queue->wait_and_throw();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (sycl::exception const &e) {
|
||||||
|
if (s_error_cb) {
|
||||||
|
s_error_cb(e.what(), s_error_user_ptr);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NOTE(@nsirgien): Execution of this simple kernel will check basic functionality and
|
||||||
|
* also trigger runtime compilation of all existing oneAPI kernels */
|
||||||
bool oneapi_run_test_kernel(SyclQueue *queue_)
|
bool oneapi_run_test_kernel(SyclQueue *queue_)
|
||||||
{
|
{
|
||||||
assert(queue_);
|
assert(queue_);
|
||||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||||
const size_t N = 8;
|
size_t N = 8;
|
||||||
const size_t memory_byte_size = sizeof(int) * N;
|
sycl::buffer<float, 1> A(N);
|
||||||
|
sycl::buffer<float, 1> B(N);
|
||||||
|
|
||||||
|
{
|
||||||
|
sycl::host_accessor A_host_acc(A, sycl::write_only);
|
||||||
|
for (size_t i = (size_t)0; i < N; i++)
|
||||||
|
A_host_acc[i] = rand() % 32;
|
||||||
|
}
|
||||||
|
|
||||||
bool is_computation_correct = true;
|
|
||||||
try {
|
try {
|
||||||
int *A_host = (int *)sycl::aligned_alloc_host(16, memory_byte_size, *queue);
|
|
||||||
|
|
||||||
for (size_t i = (size_t)0; i < N; i++) {
|
|
||||||
A_host[i] = rand() % 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
int *A_device = (int *)sycl::malloc_device(memory_byte_size, *queue);
|
|
||||||
int *B_device = (int *)sycl::malloc_device(memory_byte_size, *queue);
|
|
||||||
|
|
||||||
queue->memcpy(A_device, A_host, memory_byte_size);
|
|
||||||
queue->wait_and_throw();
|
|
||||||
|
|
||||||
queue->submit([&](sycl::handler &cgh) {
|
queue->submit([&](sycl::handler &cgh) {
|
||||||
cgh.parallel_for(N, [=](sycl::id<1> idx) { B_device[idx] = A_device[idx] + idx.get(0); });
|
sycl::accessor A_acc(A, cgh, sycl::read_only);
|
||||||
|
sycl::accessor B_acc(B, cgh, sycl::write_only, sycl::no_init);
|
||||||
|
|
||||||
|
cgh.parallel_for(N, [=](sycl::id<1> idx) { B_acc[idx] = A_acc[idx] + idx.get(0); });
|
||||||
});
|
});
|
||||||
queue->wait_and_throw();
|
queue->wait_and_throw();
|
||||||
|
|
||||||
int *B_host = (int *)sycl::aligned_alloc_host(16, memory_byte_size, *queue);
|
sycl::host_accessor A_host_acc(A, sycl::read_only);
|
||||||
|
sycl::host_accessor B_host_acc(B, sycl::read_only);
|
||||||
queue->memcpy(B_host, B_device, memory_byte_size);
|
|
||||||
queue->wait_and_throw();
|
|
||||||
|
|
||||||
for (size_t i = (size_t)0; i < N; i++) {
|
for (size_t i = (size_t)0; i < N; i++) {
|
||||||
const int expected_result = i + A_host[i];
|
float result = A_host_acc[i] + B_host_acc[i];
|
||||||
if (B_host[i] != expected_result) {
|
(void)result;
|
||||||
is_computation_correct = false;
|
|
||||||
if (s_error_cb) {
|
|
||||||
s_error_cb(("Incorrect result in test kernel execution - expected " +
|
|
||||||
std::to_string(expected_result) + ", got " + std::to_string(B_host[i]))
|
|
||||||
.c_str(),
|
|
||||||
s_error_user_ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sycl::free(A_host, *queue);
|
|
||||||
sycl::free(B_host, *queue);
|
|
||||||
sycl::free(A_device, *queue);
|
|
||||||
sycl::free(B_device, *queue);
|
|
||||||
queue->wait_and_throw();
|
|
||||||
}
|
}
|
||||||
catch (sycl::exception const &e) {
|
catch (sycl::exception const &e) {
|
||||||
if (s_error_cb) {
|
if (s_error_cb) {
|
||||||
@@ -84,16 +213,63 @@ bool oneapi_run_test_kernel(SyclQueue *queue_)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return is_computation_correct;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool oneapi_kernel_globals_size(SyclQueue *queue_, size_t &kernel_global_size)
|
||||||
|
{
|
||||||
|
kernel_global_size = sizeof(KernelGlobalsGPU);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void oneapi_set_global_memory(SyclQueue *queue_,
|
||||||
|
void *kernel_globals,
|
||||||
|
const char *memory_name,
|
||||||
|
void *memory_device_pointer)
|
||||||
|
{
|
||||||
|
assert(queue_);
|
||||||
|
assert(kernel_globals);
|
||||||
|
assert(memory_name);
|
||||||
|
assert(memory_device_pointer);
|
||||||
|
KernelGlobalsGPU *globals = (KernelGlobalsGPU *)kernel_globals;
|
||||||
|
oneapi_check_usm(queue_, memory_device_pointer);
|
||||||
|
oneapi_check_usm(queue_, kernel_globals, true);
|
||||||
|
|
||||||
|
std::string matched_name(memory_name);
|
||||||
|
|
||||||
|
/* This macro will change global ptr of KernelGlobals via name matching. */
|
||||||
|
# define KERNEL_DATA_ARRAY(type, name) \
|
||||||
|
else if (#name == matched_name) \
|
||||||
|
{ \
|
||||||
|
globals->__##name = (type *)memory_device_pointer; \
|
||||||
|
return; \
|
||||||
|
}
|
||||||
|
if (false) {
|
||||||
|
}
|
||||||
|
else if ("integrator_state" == matched_name) {
|
||||||
|
globals->integrator_state = (IntegratorStateGPU *)memory_device_pointer;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
KERNEL_DATA_ARRAY(KernelData, data)
|
||||||
|
# include "kernel/data_arrays.h"
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Can't found global/constant memory with name \"" << matched_name << "\"!"
|
||||||
|
<< std::endl;
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
# undef KERNEL_DATA_ARRAY
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Move device information to OneapiDevice initialized on creation and use it. */
|
/* TODO: Move device information to OneapiDevice initialized on creation and use it. */
|
||||||
/* TODO: Move below function to oneapi/queue.cpp. */
|
/* TODO: Move below function to oneapi/queue.cpp. */
|
||||||
size_t oneapi_kernel_preferred_local_size(SyclQueue *queue,
|
size_t oneapi_kernel_preferred_local_size(SyclQueue *queue_,
|
||||||
const DeviceKernel kernel,
|
const DeviceKernel kernel,
|
||||||
const size_t kernel_global_size)
|
const size_t kernel_global_size)
|
||||||
{
|
{
|
||||||
assert(queue);
|
assert(queue_);
|
||||||
|
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||||
(void)kernel_global_size;
|
(void)kernel_global_size;
|
||||||
const static size_t preferred_work_group_size_intersect_shading = 32;
|
const static size_t preferred_work_group_size_intersect_shading = 32;
|
||||||
const static size_t preferred_work_group_size_technical = 1024;
|
const static size_t preferred_work_group_size_technical = 1024;
|
||||||
@@ -135,59 +311,11 @@ size_t oneapi_kernel_preferred_local_size(SyclQueue *queue,
|
|||||||
preferred_work_group_size = 512;
|
preferred_work_group_size = 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t limit_work_group_size = reinterpret_cast<sycl::queue *>(queue)
|
const size_t limit_work_group_size =
|
||||||
->get_device()
|
queue->get_device().get_info<sycl::info::device::max_work_group_size>();
|
||||||
.get_info<sycl::info::device::max_work_group_size>();
|
|
||||||
|
|
||||||
return std::min(limit_work_group_size, preferred_work_group_size);
|
return std::min(limit_work_group_size, preferred_work_group_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oneapi_load_kernels(SyclQueue *queue_, const uint requested_features)
|
|
||||||
{
|
|
||||||
assert(queue_);
|
|
||||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
|
||||||
|
|
||||||
try {
|
|
||||||
sycl::kernel_bundle<sycl::bundle_state::input> all_kernels_bundle =
|
|
||||||
sycl::get_kernel_bundle<sycl::bundle_state::input>(queue->get_context(),
|
|
||||||
{queue->get_device()});
|
|
||||||
|
|
||||||
for (const sycl::kernel_id &kernel_id : all_kernels_bundle.get_kernel_ids()) {
|
|
||||||
const std::string &kernel_name = kernel_id.get_name();
|
|
||||||
|
|
||||||
/* NOTE(@nsirgien): Names in this conditions below should match names from
|
|
||||||
* oneapi_call macro in oneapi_enqueue_kernel below */
|
|
||||||
if (((requested_features & KERNEL_FEATURE_VOLUME) == 0) &&
|
|
||||||
kernel_name.find("oneapi_kernel_integrator_shade_volume") != std::string::npos) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((requested_features & KERNEL_FEATURE_MNEE) == 0) &&
|
|
||||||
kernel_name.find("oneapi_kernel_integrator_shade_surface_mnee") != std::string::npos) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((requested_features & KERNEL_FEATURE_NODE_RAYTRACE) == 0) &&
|
|
||||||
kernel_name.find("oneapi_kernel_integrator_shade_surface_raytrace") !=
|
|
||||||
std::string::npos) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
sycl::kernel_bundle<sycl::bundle_state::input> one_kernel_bundle =
|
|
||||||
sycl::get_kernel_bundle<sycl::bundle_state::input>(queue->get_context(), {kernel_id});
|
|
||||||
sycl::build(one_kernel_bundle, {queue->get_device()}, sycl::property::queue::in_order());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (sycl::exception const &e) {
|
|
||||||
if (s_error_cb) {
|
|
||||||
s_error_cb(e.what(), s_error_user_ptr);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool oneapi_enqueue_kernel(KernelContext *kernel_context,
|
bool oneapi_enqueue_kernel(KernelContext *kernel_context,
|
||||||
int kernel,
|
int kernel,
|
||||||
size_t global_size,
|
size_t global_size,
|
||||||
@@ -536,4 +664,266 @@ bool oneapi_enqueue_kernel(KernelContext *kernel_context,
|
|||||||
# endif
|
# endif
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Compute-runtime (ie. NEO) version is what gets returned by sycl/L0 on Windows
|
||||||
|
* since Windows driver 101.3268. */
|
||||||
|
/* The same min compute-runtime version is currently required across Windows and Linux.
|
||||||
|
* For Windows driver 101.3430, compute-runtime version is 23904. */
|
||||||
|
static const int lowest_supported_driver_version_win = 1013430;
|
||||||
|
static const int lowest_supported_driver_version_neo = 23904;
|
||||||
|
|
||||||
|
static int parse_driver_build_version(const sycl::device &device)
|
||||||
|
{
|
||||||
|
const std::string &driver_version = device.get_info<sycl::info::device::driver_version>();
|
||||||
|
int driver_build_version = 0;
|
||||||
|
|
||||||
|
size_t second_dot_position = driver_version.find('.', driver_version.find('.') + 1);
|
||||||
|
if (second_dot_position == std::string::npos) {
|
||||||
|
std::cerr << "Unable to parse unknown Intel GPU driver version \"" << driver_version
|
||||||
|
<< "\" does not match xx.xx.xxxxx (Linux), x.x.xxxx (L0),"
|
||||||
|
<< " xx.xx.xxx.xxxx (Windows) for device \""
|
||||||
|
<< device.get_info<sycl::info::device::name>() << "\"." << std::endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
size_t third_dot_position = driver_version.find('.', second_dot_position + 1);
|
||||||
|
if (third_dot_position != std::string::npos) {
|
||||||
|
const std::string &third_number_substr = driver_version.substr(
|
||||||
|
second_dot_position + 1, third_dot_position - second_dot_position - 1);
|
||||||
|
const std::string &forth_number_substr = driver_version.substr(third_dot_position + 1);
|
||||||
|
if (third_number_substr.length() == 3 && forth_number_substr.length() == 4)
|
||||||
|
driver_build_version = std::stoi(third_number_substr) * 10000 +
|
||||||
|
std::stoi(forth_number_substr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const std::string &third_number_substr = driver_version.substr(second_dot_position + 1);
|
||||||
|
driver_build_version = std::stoi(third_number_substr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << "Unable to parse unknown Intel GPU driver version \"" << driver_version
|
||||||
|
<< "\" does not match xx.xx.xxxxx (Linux), x.x.xxxx (L0),"
|
||||||
|
<< " xx.xx.xxx.xxxx (Windows) for device \""
|
||||||
|
<< device.get_info<sycl::info::device::name>() << "\"." << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return driver_build_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::vector<sycl::device> oneapi_available_devices()
|
||||||
|
{
|
||||||
|
bool allow_all_devices = false;
|
||||||
|
if (getenv("CYCLES_ONEAPI_ALL_DEVICES") != nullptr)
|
||||||
|
allow_all_devices = true;
|
||||||
|
|
||||||
|
/* Host device is useful only for debugging at the moment
|
||||||
|
* so we hide this device with default build settings. */
|
||||||
|
# ifdef WITH_ONEAPI_SYCL_HOST_ENABLED
|
||||||
|
bool allow_host = true;
|
||||||
|
# else
|
||||||
|
bool allow_host = false;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
const std::vector<sycl::platform> &oneapi_platforms = sycl::platform::get_platforms();
|
||||||
|
|
||||||
|
std::vector<sycl::device> available_devices;
|
||||||
|
for (const sycl::platform &platform : oneapi_platforms) {
|
||||||
|
/* ignore OpenCL platforms to avoid using the same devices through both Level-Zero and OpenCL.
|
||||||
|
*/
|
||||||
|
if (platform.get_backend() == sycl::backend::opencl) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<sycl::device> &oneapi_devices =
|
||||||
|
(allow_all_devices || allow_host) ? platform.get_devices(sycl::info::device_type::all) :
|
||||||
|
platform.get_devices(sycl::info::device_type::gpu);
|
||||||
|
|
||||||
|
for (const sycl::device &device : oneapi_devices) {
|
||||||
|
if (allow_all_devices) {
|
||||||
|
/* still filter out host device if build doesn't support it. */
|
||||||
|
if (allow_host || !device.is_host()) {
|
||||||
|
available_devices.push_back(device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bool filter_out = false;
|
||||||
|
|
||||||
|
/* For now we support all Intel(R) Arc(TM) devices and likely any future GPU,
|
||||||
|
* assuming they have either more than 96 Execution Units or not 7 threads per EU.
|
||||||
|
* Official support can be broaden to older and smaller GPUs once ready. */
|
||||||
|
if (device.is_gpu() && platform.get_backend() == sycl::backend::ext_oneapi_level_zero) {
|
||||||
|
/* Filtered-out defaults in-case these values aren't available through too old L0
|
||||||
|
* runtime. */
|
||||||
|
int number_of_eus = 96;
|
||||||
|
int threads_per_eu = 7;
|
||||||
|
if (device.has(sycl::aspect::ext_intel_gpu_eu_count)) {
|
||||||
|
number_of_eus = device.get_info<sycl::info::device::ext_intel_gpu_eu_count>();
|
||||||
|
}
|
||||||
|
if (device.has(sycl::aspect::ext_intel_gpu_hw_threads_per_eu)) {
|
||||||
|
threads_per_eu =
|
||||||
|
device.get_info<sycl::info::device::ext_intel_gpu_hw_threads_per_eu>();
|
||||||
|
}
|
||||||
|
/* This filters out all Level-Zero supported GPUs from older generation than Arc. */
|
||||||
|
if (number_of_eus <= 96 && threads_per_eu == 7) {
|
||||||
|
filter_out = true;
|
||||||
|
}
|
||||||
|
/* if not already filtered out, check driver version. */
|
||||||
|
if (!filter_out) {
|
||||||
|
int driver_build_version = parse_driver_build_version(device);
|
||||||
|
if ((driver_build_version > 100000 &&
|
||||||
|
driver_build_version < lowest_supported_driver_version_win) ||
|
||||||
|
driver_build_version < lowest_supported_driver_version_neo) {
|
||||||
|
filter_out = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!allow_host && device.is_host()) {
|
||||||
|
filter_out = true;
|
||||||
|
}
|
||||||
|
else if (!allow_all_devices) {
|
||||||
|
filter_out = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!filter_out) {
|
||||||
|
available_devices.push_back(device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return available_devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *oneapi_device_capabilities()
|
||||||
|
{
|
||||||
|
std::stringstream capabilities;
|
||||||
|
|
||||||
|
const std::vector<sycl::device> &oneapi_devices = oneapi_available_devices();
|
||||||
|
for (const sycl::device &device : oneapi_devices) {
|
||||||
|
const std::string &name = device.get_info<sycl::info::device::name>();
|
||||||
|
|
||||||
|
capabilities << std::string("\t") << name << "\n";
|
||||||
|
# define WRITE_ATTR(attribute_name, attribute_variable) \
|
||||||
|
capabilities << "\t\tsycl::info::device::" #attribute_name "\t\t\t" << attribute_variable \
|
||||||
|
<< "\n";
|
||||||
|
# define GET_NUM_ATTR(attribute) \
|
||||||
|
{ \
|
||||||
|
size_t attribute = (size_t)device.get_info<sycl::info::device ::attribute>(); \
|
||||||
|
capabilities << "\t\tsycl::info::device::" #attribute "\t\t\t" << attribute << "\n"; \
|
||||||
|
}
|
||||||
|
|
||||||
|
GET_NUM_ATTR(vendor_id)
|
||||||
|
GET_NUM_ATTR(max_compute_units)
|
||||||
|
GET_NUM_ATTR(max_work_item_dimensions)
|
||||||
|
|
||||||
|
sycl::id<3> max_work_item_sizes =
|
||||||
|
device.get_info<sycl::info::device::max_work_item_sizes<3>>();
|
||||||
|
WRITE_ATTR("max_work_item_sizes_dim0", ((size_t)max_work_item_sizes.get(0)))
|
||||||
|
WRITE_ATTR("max_work_item_sizes_dim1", ((size_t)max_work_item_sizes.get(1)))
|
||||||
|
WRITE_ATTR("max_work_item_sizes_dim2", ((size_t)max_work_item_sizes.get(2)))
|
||||||
|
|
||||||
|
GET_NUM_ATTR(max_work_group_size)
|
||||||
|
GET_NUM_ATTR(max_num_sub_groups)
|
||||||
|
GET_NUM_ATTR(sub_group_independent_forward_progress)
|
||||||
|
|
||||||
|
GET_NUM_ATTR(preferred_vector_width_char)
|
||||||
|
GET_NUM_ATTR(preferred_vector_width_short)
|
||||||
|
GET_NUM_ATTR(preferred_vector_width_int)
|
||||||
|
GET_NUM_ATTR(preferred_vector_width_long)
|
||||||
|
GET_NUM_ATTR(preferred_vector_width_float)
|
||||||
|
GET_NUM_ATTR(preferred_vector_width_double)
|
||||||
|
GET_NUM_ATTR(preferred_vector_width_half)
|
||||||
|
|
||||||
|
GET_NUM_ATTR(native_vector_width_char)
|
||||||
|
GET_NUM_ATTR(native_vector_width_short)
|
||||||
|
GET_NUM_ATTR(native_vector_width_int)
|
||||||
|
GET_NUM_ATTR(native_vector_width_long)
|
||||||
|
GET_NUM_ATTR(native_vector_width_float)
|
||||||
|
GET_NUM_ATTR(native_vector_width_double)
|
||||||
|
GET_NUM_ATTR(native_vector_width_half)
|
||||||
|
|
||||||
|
size_t max_clock_frequency =
|
||||||
|
(size_t)(device.is_host() ? (size_t)0 :
|
||||||
|
device.get_info<sycl::info::device::max_clock_frequency>());
|
||||||
|
WRITE_ATTR("max_clock_frequency", max_clock_frequency)
|
||||||
|
|
||||||
|
GET_NUM_ATTR(address_bits)
|
||||||
|
GET_NUM_ATTR(max_mem_alloc_size)
|
||||||
|
|
||||||
|
/* NOTE(@nsirgien): Implementation doesn't use image support as bindless images aren't
|
||||||
|
* supported so we always return false, even if device supports HW texture usage acceleration.
|
||||||
|
*/
|
||||||
|
bool image_support = false;
|
||||||
|
WRITE_ATTR("image_support", (size_t)image_support)
|
||||||
|
|
||||||
|
GET_NUM_ATTR(max_parameter_size)
|
||||||
|
GET_NUM_ATTR(mem_base_addr_align)
|
||||||
|
GET_NUM_ATTR(global_mem_size)
|
||||||
|
GET_NUM_ATTR(local_mem_size)
|
||||||
|
GET_NUM_ATTR(error_correction_support)
|
||||||
|
GET_NUM_ATTR(profiling_timer_resolution)
|
||||||
|
GET_NUM_ATTR(is_available)
|
||||||
|
|
||||||
|
# undef GET_NUM_ATTR
|
||||||
|
# undef WRITE_ATTR
|
||||||
|
capabilities << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return ::strdup(capabilities.str().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void oneapi_free(void *p)
|
||||||
|
{
|
||||||
|
if (p) {
|
||||||
|
::free(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void oneapi_iterate_devices(OneAPIDeviceIteratorCallback cb, void *user_ptr)
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
std::vector<sycl::device> devices = oneapi_available_devices();
|
||||||
|
for (sycl::device &device : devices) {
|
||||||
|
const std::string &platform_name =
|
||||||
|
device.get_platform().get_info<sycl::info::platform::name>();
|
||||||
|
std::string name = device.get_info<sycl::info::device::name>();
|
||||||
|
std::string id = "ONEAPI_" + platform_name + "_" + name;
|
||||||
|
if (device.has(sycl::aspect::ext_intel_pci_address)) {
|
||||||
|
id.append("_" + device.get_info<sycl::info::device::ext_intel_pci_address>());
|
||||||
|
}
|
||||||
|
(cb)(id.c_str(), name.c_str(), num, user_ptr);
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t oneapi_get_memcapacity(SyclQueue *queue)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<sycl::queue *>(queue)
|
||||||
|
->get_device()
|
||||||
|
.get_info<sycl::info::device::global_mem_size>();
|
||||||
|
}
|
||||||
|
|
||||||
|
int oneapi_get_num_multiprocessors(SyclQueue *queue)
|
||||||
|
{
|
||||||
|
const sycl::device &device = reinterpret_cast<sycl::queue *>(queue)->get_device();
|
||||||
|
if (device.has(sycl::aspect::ext_intel_gpu_eu_count)) {
|
||||||
|
return device.get_info<sycl::info::device::ext_intel_gpu_eu_count>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int oneapi_get_max_num_threads_per_multiprocessor(SyclQueue *queue)
|
||||||
|
{
|
||||||
|
const sycl::device &device = reinterpret_cast<sycl::queue *>(queue)->get_device();
|
||||||
|
if (device.has(sycl::aspect::ext_intel_gpu_eu_simd_width) &&
|
||||||
|
device.has(sycl::aspect::ext_intel_gpu_hw_threads_per_eu)) {
|
||||||
|
return device.get_info<sycl::info::device::ext_intel_gpu_eu_simd_width>() *
|
||||||
|
device.get_info<sycl::info::device::ext_intel_gpu_hw_threads_per_eu>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* WITH_ONEAPI */
|
#endif /* WITH_ONEAPI */
|
||||||
|
@@ -25,6 +25,11 @@ enum DeviceKernel : int;
|
|||||||
|
|
||||||
class SyclQueue;
|
class SyclQueue;
|
||||||
|
|
||||||
|
typedef void (*OneAPIDeviceIteratorCallback)(const char *id,
|
||||||
|
const char *name,
|
||||||
|
int num,
|
||||||
|
void *user_ptr);
|
||||||
|
|
||||||
typedef void (*OneAPIErrorCallback)(const char *error, void *user_ptr);
|
typedef void (*OneAPIErrorCallback)(const char *error, void *user_ptr);
|
||||||
|
|
||||||
struct KernelContext {
|
struct KernelContext {
|
||||||
@@ -40,17 +45,13 @@ struct KernelContext {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
CYCLES_KERNEL_ONEAPI_EXPORT bool oneapi_run_test_kernel(SyclQueue *queue_);
|
# define DLL_INTERFACE_CALL(function, return_type, ...) \
|
||||||
CYCLES_KERNEL_ONEAPI_EXPORT void oneapi_set_error_cb(OneAPIErrorCallback cb, void *user_ptr);
|
CYCLES_KERNEL_ONEAPI_EXPORT return_type function(__VA_ARGS__);
|
||||||
CYCLES_KERNEL_ONEAPI_EXPORT size_t oneapi_kernel_preferred_local_size(
|
# include "kernel/device/oneapi/dll_interface_template.h"
|
||||||
SyclQueue *queue, const DeviceKernel kernel, const size_t kernel_global_size);
|
# undef DLL_INTERFACE_CALL
|
||||||
CYCLES_KERNEL_ONEAPI_EXPORT bool oneapi_enqueue_kernel(KernelContext *context,
|
|
||||||
int kernel,
|
|
||||||
size_t global_size,
|
|
||||||
void **args);
|
|
||||||
CYCLES_KERNEL_ONEAPI_EXPORT bool oneapi_load_kernels(SyclQueue *queue,
|
|
||||||
const unsigned int requested_features);
|
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif /* WITH_ONEAPI */
|
#endif /* WITH_ONEAPI */
|
||||||
|
@@ -501,11 +501,6 @@ ccl_device_forceinline bool guiding_phase_init(KernelGlobals kg,
|
|||||||
ccl_private float &rand)
|
ccl_private float &rand)
|
||||||
{
|
{
|
||||||
#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
|
#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
|
||||||
/* we do not need to guide almost delta phase functions */
|
|
||||||
if (fabsf(g) >= 0.99f) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kg->opgl_volume_sampling_distribution->Init(
|
if (kg->opgl_volume_sampling_distribution->Init(
|
||||||
kg->opgl_guiding_field, guiding_point3f(P), rand, true)) {
|
kg->opgl_guiding_field, guiding_point3f(P), rand, true)) {
|
||||||
kg->opgl_volume_sampling_distribution->ApplySingleLobeHenyeyGreensteinProduct(guiding_vec3f(D),
|
kg->opgl_volume_sampling_distribution->ApplySingleLobeHenyeyGreensteinProduct(guiding_vec3f(D),
|
||||||
|
@@ -210,51 +210,8 @@ ccl_device bool integrator_init_from_bake(KernelGlobals kg,
|
|||||||
|
|
||||||
/* Setup ray. */
|
/* Setup ray. */
|
||||||
Ray ray ccl_optional_struct_init;
|
Ray ray ccl_optional_struct_init;
|
||||||
|
ray.P = P + N;
|
||||||
if (kernel_data.bake.use_camera) {
|
ray.D = -N;
|
||||||
float3 D = camera_direction_from_point(kg, P);
|
|
||||||
|
|
||||||
const float DN = dot(D, N);
|
|
||||||
|
|
||||||
/* Nudge camera direction, so that the faces facing away from the camera still have
|
|
||||||
* somewhat usable shading. (Otherwise, glossy faces would be simply black.)
|
|
||||||
*
|
|
||||||
* The surface normal offset affects smooth surfaces. Lower values will make
|
|
||||||
* smooth surfaces more faceted, but higher values may show up from the camera
|
|
||||||
* at grazing angles.
|
|
||||||
*
|
|
||||||
* This value can actually be pretty high before it's noticeably wrong. */
|
|
||||||
const float surface_normal_offset = 0.2f;
|
|
||||||
|
|
||||||
/* Keep the ray direction at least `surface_normal_offset` "above" the smooth normal. */
|
|
||||||
if (DN <= surface_normal_offset) {
|
|
||||||
D -= N * (DN - surface_normal_offset);
|
|
||||||
D = normalize(D);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On the backside, just lerp towards the surface normal for the ray direction,
|
|
||||||
* as DN goes from 0.0 to -1.0. */
|
|
||||||
if (DN <= 0.0f) {
|
|
||||||
D = normalize(mix(D, N, -DN));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We don't want to bake the back face, so make sure the ray direction never
|
|
||||||
* goes behind the geometry (flat) normal. This is a fail-safe, and should rarely happen. */
|
|
||||||
const float true_normal_epsilon = 0.00001f;
|
|
||||||
|
|
||||||
if (dot(D, Ng) <= true_normal_epsilon) {
|
|
||||||
D -= Ng * (dot(D, Ng) - true_normal_epsilon);
|
|
||||||
D = normalize(D);
|
|
||||||
}
|
|
||||||
|
|
||||||
ray.P = P + D;
|
|
||||||
ray.D = -D;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ray.P = P + N;
|
|
||||||
ray.D = -N;
|
|
||||||
}
|
|
||||||
|
|
||||||
ray.tmin = 0.0f;
|
ray.tmin = 0.0f;
|
||||||
ray.tmax = FLT_MAX;
|
ray.tmax = FLT_MAX;
|
||||||
ray.time = 0.5f;
|
ray.time = 0.5f;
|
||||||
|
@@ -279,15 +279,7 @@ ccl_device_forceinline void mnee_setup_manifold_vertex(KernelGlobals kg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Compute constraint derivatives. */
|
/* Compute constraint derivatives. */
|
||||||
|
ccl_device_forceinline bool mnee_compute_constraint_derivatives(
|
||||||
# if defined(__KERNEL_METAL__)
|
|
||||||
/* Temporary workaround for front-end compilation bug (incorrect MNEE rendering when this is
|
|
||||||
* inlined). */
|
|
||||||
__attribute__((noinline))
|
|
||||||
# else
|
|
||||||
ccl_device_forceinline
|
|
||||||
# endif
|
|
||||||
bool mnee_compute_constraint_derivatives(
|
|
||||||
int vertex_count,
|
int vertex_count,
|
||||||
ccl_private ManifoldVertex *vertices,
|
ccl_private ManifoldVertex *vertices,
|
||||||
ccl_private const float3 &surface_sample_pos,
|
ccl_private const float3 &surface_sample_pos,
|
||||||
|
@@ -59,13 +59,6 @@ ccl_device_inline void path_state_init_integrator(KernelGlobals kg,
|
|||||||
#ifdef __PATH_GUIDING__
|
#ifdef __PATH_GUIDING__
|
||||||
INTEGRATOR_STATE_WRITE(state, path, unguided_throughput) = 1.0f;
|
INTEGRATOR_STATE_WRITE(state, path, unguided_throughput) = 1.0f;
|
||||||
INTEGRATOR_STATE_WRITE(state, guiding, path_segment) = nullptr;
|
INTEGRATOR_STATE_WRITE(state, guiding, path_segment) = nullptr;
|
||||||
INTEGRATOR_STATE_WRITE(state, guiding, use_surface_guiding) = false;
|
|
||||||
INTEGRATOR_STATE_WRITE(state, guiding, sample_surface_guiding_rand) = 0.5f;
|
|
||||||
INTEGRATOR_STATE_WRITE(state, guiding, surface_guiding_sampling_prob) = 0.0f;
|
|
||||||
INTEGRATOR_STATE_WRITE(state, guiding, bssrdf_sampling_prob) = 0.0f;
|
|
||||||
INTEGRATOR_STATE_WRITE(state, guiding, use_volume_guiding) = false;
|
|
||||||
INTEGRATOR_STATE_WRITE(state, guiding, sample_volume_guiding_rand) = 0.5f;
|
|
||||||
INTEGRATOR_STATE_WRITE(state, guiding, volume_guiding_sampling_prob) = 0.0f;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __MNEE__
|
#ifdef __MNEE__
|
||||||
|
@@ -76,9 +76,6 @@ ccl_device_forceinline IntegratorShadowState integrator_shadow_path_init(
|
|||||||
&kernel_integrator_state.next_shadow_path_index[0], 1);
|
&kernel_integrator_state.next_shadow_path_index[0], 1);
|
||||||
atomic_fetch_and_add_uint32(&kernel_integrator_state.queue_counter->num_queued[next_kernel], 1);
|
atomic_fetch_and_add_uint32(&kernel_integrator_state.queue_counter->num_queued[next_kernel], 1);
|
||||||
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, queued_kernel) = next_kernel;
|
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, queued_kernel) = next_kernel;
|
||||||
# ifdef __PATH_GUIDING__
|
|
||||||
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, path_segment) = nullptr;
|
|
||||||
# endif
|
|
||||||
return shadow_state;
|
return shadow_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,9 +181,6 @@ ccl_device_forceinline IntegratorShadowState integrator_shadow_path_init(
|
|||||||
{
|
{
|
||||||
IntegratorShadowState shadow_state = (is_ao) ? &state->ao : &state->shadow;
|
IntegratorShadowState shadow_state = (is_ao) ? &state->ao : &state->shadow;
|
||||||
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, queued_kernel) = next_kernel;
|
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, queued_kernel) = next_kernel;
|
||||||
# ifdef __PATH_GUIDING__
|
|
||||||
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, path_segment) = nullptr;
|
|
||||||
# endif
|
|
||||||
return shadow_state;
|
return shadow_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -100,7 +100,7 @@ ccl_device_inline bool sample_is_class_A(int pattern, int sample)
|
|||||||
if (!(pattern == SAMPLING_PATTERN_PMJ || pattern == SAMPLING_PATTERN_SOBOL_BURLEY)) {
|
if (!(pattern == SAMPLING_PATTERN_PMJ || pattern == SAMPLING_PATTERN_SOBOL_BURLEY)) {
|
||||||
/* Fallback: assign samples randomly.
|
/* Fallback: assign samples randomly.
|
||||||
* This is guaranteed to work "okay" for any sampler, but isn't good.
|
* This is guaranteed to work "okay" for any sampler, but isn't good.
|
||||||
* (NOTE: the seed constant is just a random number to guard against
|
* (Note: the seed constant is just a random number to guard against
|
||||||
* possible interactions with other uses of the hash. There's nothing
|
* possible interactions with other uses of the hash. There's nothing
|
||||||
* special about it.)
|
* special about it.)
|
||||||
*/
|
*/
|
||||||
|
@@ -85,9 +85,9 @@ CCL_NAMESPACE_BEGIN
|
|||||||
# define __VOLUME_RECORD_ALL__
|
# define __VOLUME_RECORD_ALL__
|
||||||
#endif /* !__KERNEL_GPU__ */
|
#endif /* !__KERNEL_GPU__ */
|
||||||
|
|
||||||
/* MNEE caused "Compute function exceeds available temporary registers" in macOS < 13 due to a bug
|
/* MNEE currently causes "Compute function exceeds available temporary registers"
|
||||||
* in spill buffer allocation sizing. */
|
* on Metal, disabled for now. */
|
||||||
#if !defined(__KERNEL_METAL__) || (__KERNEL_METAL_MACOS__ >= 13)
|
#ifndef __KERNEL_METAL__
|
||||||
# define __MNEE__
|
# define __MNEE__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1160,7 +1160,7 @@ typedef struct KernelBake {
|
|||||||
int use;
|
int use;
|
||||||
int object_index;
|
int object_index;
|
||||||
int tri_offset;
|
int tri_offset;
|
||||||
int use_camera;
|
int pad1;
|
||||||
} KernelBake;
|
} KernelBake;
|
||||||
static_assert_align(KernelBake, 16);
|
static_assert_align(KernelBake, 16);
|
||||||
|
|
||||||
|
@@ -16,7 +16,6 @@ CCL_NAMESPACE_BEGIN
|
|||||||
BakeManager::BakeManager()
|
BakeManager::BakeManager()
|
||||||
{
|
{
|
||||||
need_update_ = true;
|
need_update_ = true;
|
||||||
use_camera_ = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BakeManager::~BakeManager()
|
BakeManager::~BakeManager()
|
||||||
@@ -39,14 +38,6 @@ void BakeManager::set(Scene *scene, const std::string &object_name_)
|
|||||||
need_update_ = true;
|
need_update_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BakeManager::set_use_camera(const bool use_camera)
|
|
||||||
{
|
|
||||||
if (use_camera_ != use_camera) {
|
|
||||||
use_camera_ = use_camera;
|
|
||||||
need_update_ = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BakeManager::device_update(Device * /*device*/,
|
void BakeManager::device_update(Device * /*device*/,
|
||||||
DeviceScene *dscene,
|
DeviceScene *dscene,
|
||||||
Scene *scene,
|
Scene *scene,
|
||||||
@@ -58,8 +49,6 @@ void BakeManager::device_update(Device * /*device*/,
|
|||||||
KernelBake *kbake = &dscene->data.bake;
|
KernelBake *kbake = &dscene->data.bake;
|
||||||
memset(kbake, 0, sizeof(*kbake));
|
memset(kbake, 0, sizeof(*kbake));
|
||||||
|
|
||||||
kbake->use_camera = use_camera_;
|
|
||||||
|
|
||||||
if (!object_name.empty()) {
|
if (!object_name.empty()) {
|
||||||
scoped_callback_timer timer([scene](double time) {
|
scoped_callback_timer timer([scene](double time) {
|
||||||
if (scene->update_stats) {
|
if (scene->update_stats) {
|
||||||
|
@@ -20,8 +20,6 @@ class BakeManager {
|
|||||||
void set(Scene *scene, const std::string &object_name);
|
void set(Scene *scene, const std::string &object_name);
|
||||||
bool get_baking() const;
|
bool get_baking() const;
|
||||||
|
|
||||||
void set_use_camera(bool use_camera);
|
|
||||||
|
|
||||||
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress);
|
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress);
|
||||||
void device_free(Device *device, DeviceScene *dscene);
|
void device_free(Device *device, DeviceScene *dscene);
|
||||||
|
|
||||||
@@ -32,7 +30,6 @@ class BakeManager {
|
|||||||
private:
|
private:
|
||||||
bool need_update_;
|
bool need_update_;
|
||||||
std::string object_name;
|
std::string object_name;
|
||||||
bool use_camera_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
@@ -192,22 +192,8 @@ bool OIIOImageLoader::load_pixels(const ImageMetaData &metadata,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool do_associate_alpha = false;
|
const bool do_associate_alpha = associate_alpha &&
|
||||||
if (associate_alpha) {
|
spec.get_int_attribute("oiio:UnassociatedAlpha", 0);
|
||||||
do_associate_alpha = spec.get_int_attribute("oiio:UnassociatedAlpha", 0);
|
|
||||||
|
|
||||||
if (!do_associate_alpha && spec.alpha_channel != -1) {
|
|
||||||
/* Workaround OIIO not detecting TGA file alpha the same as Blender (since #3019).
|
|
||||||
* We want anything not marked as premultiplied alpha to get associated. */
|
|
||||||
if (strcmp(in->format_name(), "targa") == 0) {
|
|
||||||
do_associate_alpha = spec.get_int_attribute("targa:alpha_type", -1) != 4;
|
|
||||||
}
|
|
||||||
/* OIIO DDS reader never sets UnassociatedAlpha attribute. */
|
|
||||||
if (strcmp(in->format_name(), "dds") == 0) {
|
|
||||||
do_associate_alpha = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (metadata.type) {
|
switch (metadata.type) {
|
||||||
case IMAGE_DATA_TYPE_BYTE:
|
case IMAGE_DATA_TYPE_BYTE:
|
||||||
|
@@ -43,10 +43,6 @@ Session::Session(const SessionParams ¶ms_, const SceneParams &scene_params)
|
|||||||
|
|
||||||
device = Device::create(params.device, stats, profiler);
|
device = Device::create(params.device, stats, profiler);
|
||||||
|
|
||||||
if (device->have_error()) {
|
|
||||||
progress.set_error(device->error_message());
|
|
||||||
}
|
|
||||||
|
|
||||||
scene = new Scene(scene_params, device);
|
scene = new Scene(scene_params, device);
|
||||||
|
|
||||||
/* Configure path tracer. */
|
/* Configure path tracer. */
|
||||||
|
@@ -417,11 +417,15 @@ ccl_device_inline int floor_to_int(float f)
|
|||||||
return float_to_int(floorf(f));
|
return float_to_int(floorf(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ccl_device_inline int quick_floor_to_int(float x)
|
||||||
|
{
|
||||||
|
return float_to_int(x) - ((x < 0) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
ccl_device_inline float floorfrac(float x, ccl_private int *i)
|
ccl_device_inline float floorfrac(float x, ccl_private int *i)
|
||||||
{
|
{
|
||||||
float f = floorf(x);
|
*i = quick_floor_to_int(x);
|
||||||
*i = float_to_int(f);
|
return x - *i;
|
||||||
return x - f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_inline int ceil_to_int(float f)
|
ccl_device_inline int ceil_to_int(float f)
|
||||||
|
@@ -589,7 +589,7 @@ ccl_device_inline float fast_erfcf(float x)
|
|||||||
ccl_device_inline float fast_ierff(float x)
|
ccl_device_inline float fast_ierff(float x)
|
||||||
{
|
{
|
||||||
/* From: Approximating the `erfinv` function by Mike Giles. */
|
/* From: Approximating the `erfinv` function by Mike Giles. */
|
||||||
/* To avoid trouble at the limit, clamp input to 1-epsilon. */
|
/* To avoid trouble at the limit, clamp input to 1-eps. */
|
||||||
float a = fabsf(x);
|
float a = fabsf(x);
|
||||||
if (a > 0.99999994f) {
|
if (a > 0.99999994f) {
|
||||||
a = 0.99999994f;
|
a = 0.99999994f;
|
||||||
|
@@ -535,6 +535,18 @@ ccl_device_inline float3 pow(float3 v, float e)
|
|||||||
return make_float3(powf(v.x, e), powf(v.y, e), powf(v.z, e));
|
return make_float3(powf(v.x, e), powf(v.y, e), powf(v.z, e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ccl_device_inline int3 quick_floor_to_int3(const float3 a)
|
||||||
|
{
|
||||||
|
#ifdef __KERNEL_SSE__
|
||||||
|
int3 b = int3(_mm_cvttps_epi32(a.m128));
|
||||||
|
int3 isneg = int3(_mm_castps_si128(_mm_cmplt_ps(a.m128, _mm_set_ps1(0.0f))));
|
||||||
|
/* Unsaturated add 0xffffffff is the same as subtract -1. */
|
||||||
|
return b + isneg;
|
||||||
|
#else
|
||||||
|
return make_int3(quick_floor_to_int(a.x), quick_floor_to_int(a.y), quick_floor_to_int(a.z));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
ccl_device_inline bool isfinite_safe(float3 v)
|
ccl_device_inline bool isfinite_safe(float3 v)
|
||||||
{
|
{
|
||||||
return isfinite_safe(v.x) && isfinite_safe(v.y) && isfinite_safe(v.z);
|
return isfinite_safe(v.x) && isfinite_safe(v.y) && isfinite_safe(v.z);
|
||||||
|
@@ -5,8 +5,6 @@
|
|||||||
#ifndef __UTIL_SSEF_H__
|
#ifndef __UTIL_SSEF_H__
|
||||||
#define __UTIL_SSEF_H__
|
#define __UTIL_SSEF_H__
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include "util/ssei.h"
|
#include "util/ssei.h"
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
@@ -523,7 +521,7 @@ __forceinline const ssef round_zero(const ssef &a)
|
|||||||
__forceinline const ssef floor(const ssef &a)
|
__forceinline const ssef floor(const ssef &a)
|
||||||
{
|
{
|
||||||
# ifdef __KERNEL_NEON__
|
# ifdef __KERNEL_NEON__
|
||||||
return vrndmq_f32(a);
|
return vrndnq_f32(a);
|
||||||
# else
|
# else
|
||||||
return _mm_round_ps(a, _MM_FROUND_TO_NEG_INF);
|
return _mm_round_ps(a, _MM_FROUND_TO_NEG_INF);
|
||||||
# endif
|
# endif
|
||||||
@@ -536,12 +534,6 @@ __forceinline const ssef ceil(const ssef &a)
|
|||||||
return _mm_round_ps(a, _MM_FROUND_TO_POS_INF);
|
return _mm_round_ps(a, _MM_FROUND_TO_POS_INF);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
# else
|
|
||||||
/* Non-SSE4.1 fallback, needed for floorfrac. */
|
|
||||||
__forceinline const ssef floor(const ssef &a)
|
|
||||||
{
|
|
||||||
return _mm_set_ps(floorf(a.f[3]), floorf(a.f[2]), floorf(a.f[1]), floorf(a.f[0]));
|
|
||||||
}
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
__forceinline ssei truncatei(const ssef &a)
|
__forceinline ssei truncatei(const ssef &a)
|
||||||
@@ -549,11 +541,20 @@ __forceinline ssei truncatei(const ssef &a)
|
|||||||
return _mm_cvttps_epi32(a.m128);
|
return _mm_cvttps_epi32(a.m128);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is about 25% faster than straightforward floor to integer conversion
|
||||||
|
* due to better pipelining.
|
||||||
|
*
|
||||||
|
* Unsaturated add 0xffffffff (a < 0) is the same as subtract -1.
|
||||||
|
*/
|
||||||
|
__forceinline ssei floori(const ssef &a)
|
||||||
|
{
|
||||||
|
return truncatei(a) + cast((a < 0.0f).m128);
|
||||||
|
}
|
||||||
|
|
||||||
__forceinline ssef floorfrac(const ssef &x, ssei *i)
|
__forceinline ssef floorfrac(const ssef &x, ssei *i)
|
||||||
{
|
{
|
||||||
ssef f = floor(x);
|
*i = floori(x);
|
||||||
*i = truncatei(f);
|
return x - ssef(*i);
|
||||||
return x - f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@@ -31,7 +31,7 @@ ccl_device_forceinline float transform_inverse_dot(const float3 a, const float3
|
|||||||
return dot(a, b);
|
return dot(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_forceinline Transform transform_inverse_impl(const Transform tfm)
|
ccl_device_inline Transform transform_inverse_impl(const Transform tfm)
|
||||||
{
|
{
|
||||||
/* This implementation matches the one in Embree exactly, to ensure consistent
|
/* This implementation matches the one in Embree exactly, to ensure consistent
|
||||||
* results with the ray intersection of instances. */
|
* results with the ray intersection of instances. */
|
||||||
|
@@ -262,9 +262,6 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
|
|||||||
${xkbcommon_INCLUDE_DIRS}
|
${xkbcommon_INCLUDE_DIRS}
|
||||||
${wayland-cursor_INCLUDE_DIRS}
|
${wayland-cursor_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
list(APPEND LIB
|
|
||||||
${xkbcommon_LINK_LIBRARIES}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(WITH_GHOST_WAYLAND_DYNLOAD)
|
if(WITH_GHOST_WAYLAND_DYNLOAD)
|
||||||
list(APPEND INC_SYS
|
list(APPEND INC_SYS
|
||||||
@@ -274,32 +271,18 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
|
|||||||
bf_intern_wayland_dynload
|
bf_intern_wayland_dynload
|
||||||
)
|
)
|
||||||
add_definitions(-DWITH_GHOST_WAYLAND_DYNLOAD)
|
add_definitions(-DWITH_GHOST_WAYLAND_DYNLOAD)
|
||||||
else()
|
|
||||||
list(APPEND LIB
|
|
||||||
${wayland-client_LINK_LIBRARIES}
|
|
||||||
${wayland-egl_LINK_LIBRARIES}
|
|
||||||
${wayland-cursor_LINK_LIBRARIES}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_GHOST_WAYLAND_DBUS)
|
if(WITH_GHOST_WAYLAND_DBUS)
|
||||||
list(APPEND INC_SYS
|
list(APPEND INC_SYS
|
||||||
${dbus_INCLUDE_DIRS}
|
${dbus_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
list(APPEND LIB
|
|
||||||
${dbus_LINK_LIBRARIES}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||||
list(APPEND INC_SYS
|
list(APPEND INC_SYS
|
||||||
${libdecor_INCLUDE_DIRS}
|
${libdecor_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
|
|
||||||
list(APPEND LIB
|
|
||||||
${libdecor_LIBRARIES}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
@@ -349,16 +332,16 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
|
|||||||
${INC_DST}
|
${INC_DST}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Used when: LIBDECOR is not needed.
|
if(NOT WITH_GHOST_WAYLAND_LIBDECOR)
|
||||||
# `xdg-shell`.
|
# `xdg-shell`.
|
||||||
generate_protocol_bindings(
|
generate_protocol_bindings(
|
||||||
"${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml"
|
"${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml"
|
||||||
)
|
)
|
||||||
# `xdg-decoration`.
|
# `xdg-decoration`.
|
||||||
generate_protocol_bindings(
|
generate_protocol_bindings(
|
||||||
"${WAYLAND_PROTOCOLS_DIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
|
"${WAYLAND_PROTOCOLS_DIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
|
||||||
)
|
)
|
||||||
# End LIBDECOR alternative.
|
endif()
|
||||||
|
|
||||||
# `xdg-output`.
|
# `xdg-output`.
|
||||||
generate_protocol_bindings(
|
generate_protocol_bindings(
|
||||||
|
@@ -36,10 +36,6 @@ extern GHOST_SystemHandle GHOST_CreateSystemBackground(void);
|
|||||||
*/
|
*/
|
||||||
extern void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, GHOST_Debug debug);
|
extern void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, GHOST_Debug debug);
|
||||||
|
|
||||||
#if !(defined(WIN32) || defined(__APPLE__))
|
|
||||||
extern const char *GHOST_SystemBackend(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disposes the one and only system.
|
* Disposes the one and only system.
|
||||||
* \param systemhandle: The handle to the system.
|
* \param systemhandle: The handle to the system.
|
||||||
@@ -162,6 +158,7 @@ extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
|
|||||||
* \param height: The height the window.
|
* \param height: The height the window.
|
||||||
* \param state: The state of the window when opened.
|
* \param state: The state of the window when opened.
|
||||||
* \param is_dialog: Stay on top of parent window, no icon in taskbar, can't be minimized.
|
* \param is_dialog: Stay on top of parent window, no icon in taskbar, can't be minimized.
|
||||||
|
* \param type: The type of drawing context installed in this window.
|
||||||
* \param glSettings: Misc OpenGL options.
|
* \param glSettings: Misc OpenGL options.
|
||||||
* \return A handle to the new window ( == NULL if creation failed).
|
* \return A handle to the new window ( == NULL if creation failed).
|
||||||
*/
|
*/
|
||||||
@@ -174,6 +171,7 @@ extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
|||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
bool is_dialog,
|
bool is_dialog,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings);
|
GHOST_GLSettings glSettings);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -134,15 +134,6 @@ class GHOST_ISystem {
|
|||||||
* \return A pointer to the system.
|
* \return A pointer to the system.
|
||||||
*/
|
*/
|
||||||
static GHOST_ISystem *getSystem();
|
static GHOST_ISystem *getSystem();
|
||||||
/**
|
|
||||||
* Return an identifier for the one and only system.
|
|
||||||
* \warning while it may be tempting this should never be used to check for supported features,
|
|
||||||
* in that case, the GHOST API should be extended to query capabilities.
|
|
||||||
* This is needed for X11/WAYLAND on Unix, without this - there is no convenient way for users to
|
|
||||||
* check if WAYLAND or XWAYLAND are in use since they are dynamically selected at startup.
|
|
||||||
* When dynamically switching between X11/WAYLAND is removed, this function can go too.
|
|
||||||
*/
|
|
||||||
static const char *getSystemBackend();
|
|
||||||
|
|
||||||
static GHOST_TBacktraceFn getBacktraceFn();
|
static GHOST_TBacktraceFn getBacktraceFn();
|
||||||
static void setBacktraceFn(GHOST_TBacktraceFn backtrace_fn);
|
static void setBacktraceFn(GHOST_TBacktraceFn backtrace_fn);
|
||||||
@@ -232,6 +223,7 @@ class GHOST_ISystem {
|
|||||||
* \param width: The width the window.
|
* \param width: The width the window.
|
||||||
* \param height: The height the window.
|
* \param height: The height the window.
|
||||||
* \param state: The state of the window when opened.
|
* \param state: The state of the window when opened.
|
||||||
|
* \param type: The type of drawing context installed in this window.
|
||||||
* \param glSettings: Misc OpenGL settings.
|
* \param glSettings: Misc OpenGL settings.
|
||||||
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
|
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
|
||||||
* \param is_dialog: Stay on top of parent window, no icon in taskbar, can't be minimized.
|
* \param is_dialog: Stay on top of parent window, no icon in taskbar, can't be minimized.
|
||||||
@@ -244,6 +236,7 @@ class GHOST_ISystem {
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool exclusive = false,
|
const bool exclusive = false,
|
||||||
const bool is_dialog = false,
|
const bool is_dialog = false,
|
||||||
@@ -522,7 +515,6 @@ class GHOST_ISystem {
|
|||||||
|
|
||||||
/** The one and only system */
|
/** The one and only system */
|
||||||
static GHOST_ISystem *m_system;
|
static GHOST_ISystem *m_system;
|
||||||
static const char *m_system_backend_id;
|
|
||||||
|
|
||||||
/** Function to call that sets the back-trace. */
|
/** Function to call that sets the back-trace. */
|
||||||
static GHOST_TBacktraceFn m_backtrace_fn;
|
static GHOST_TBacktraceFn m_backtrace_fn;
|
||||||
|
@@ -30,19 +30,13 @@ extern GHOST_TSuccess GHOST_DisposeSystemPaths(void);
|
|||||||
/**
|
/**
|
||||||
* Determine the base dir in which shared resources are located. It will first try to use
|
* Determine the base dir in which shared resources are located. It will first try to use
|
||||||
* "unpack and run" path, then look for properly installed path, including versioning.
|
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||||
* \return Unsigned char string pointing to system dir (eg `/usr/share/blender/`).
|
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
||||||
*
|
|
||||||
* \note typically: `BKE_appdir_resource_path_id(BLENDER_RESOURCE_PATH_SYSTEM, false)` should be
|
|
||||||
* used instead of this function directly as it ensures environment variable overrides are used.
|
|
||||||
*/
|
*/
|
||||||
extern const char *GHOST_getSystemDir(int version, const char *versionstr);
|
extern const char *GHOST_getSystemDir(int version, const char *versionstr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which user configuration is stored, including versioning.
|
* Determine the base dir in which user configuration is stored, including versioning.
|
||||||
* \return Unsigned char string pointing to user dir (eg ~).
|
* \return Unsigned char string pointing to user dir (eg ~).
|
||||||
*
|
|
||||||
* \note typically: `BKE_appdir_resource_path_id(BLENDER_RESOURCE_PATH_USER, false)` should be
|
|
||||||
* used instead of this function directly as it ensures environment variable overrides are used.
|
|
||||||
*/
|
*/
|
||||||
extern const char *GHOST_getUserDir(int version, const char *versionstr);
|
extern const char *GHOST_getUserDir(int version, const char *versionstr);
|
||||||
|
|
||||||
|
@@ -60,6 +60,10 @@ typedef struct {
|
|||||||
int hot_spot[2];
|
int hot_spot[2];
|
||||||
} GHOST_CursorBitmapRef;
|
} GHOST_CursorBitmapRef;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int flags;
|
||||||
|
} GHOST_GLSettings;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GHOST_glStereoVisual = (1 << 0),
|
GHOST_glStereoVisual = (1 << 0),
|
||||||
GHOST_glDebugContext = (1 << 1),
|
GHOST_glDebugContext = (1 << 1),
|
||||||
@@ -153,9 +157,6 @@ typedef enum {
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
GHOST_kDrawingContextTypeD3D,
|
GHOST_kDrawingContextTypeD3D,
|
||||||
#endif
|
#endif
|
||||||
#ifdef __APPLE__
|
|
||||||
GHOST_kDrawingContextTypeMetal,
|
|
||||||
#endif
|
|
||||||
} GHOST_TDrawingContextType;
|
} GHOST_TDrawingContextType;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -525,7 +526,7 @@ typedef struct {
|
|||||||
} GHOST_TStringArray;
|
} GHOST_TStringArray;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GHOST_kNotStarted = 0,
|
GHOST_kNotStarted,
|
||||||
GHOST_kStarting,
|
GHOST_kStarting,
|
||||||
GHOST_kInProgress,
|
GHOST_kInProgress,
|
||||||
GHOST_kFinishing,
|
GHOST_kFinishing,
|
||||||
@@ -597,11 +598,6 @@ typedef struct {
|
|||||||
uint32_t frequency;
|
uint32_t frequency;
|
||||||
} GHOST_DisplaySetting;
|
} GHOST_DisplaySetting;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int flags;
|
|
||||||
GHOST_TDrawingContextType context_type;
|
|
||||||
} GHOST_GLSettings;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/** Axis that cursor grab will wrap. */
|
/** Axis that cursor grab will wrap. */
|
||||||
GHOST_kDebugDefault = (1 << 1),
|
GHOST_kDebugDefault = (1 << 1),
|
||||||
|
@@ -52,13 +52,6 @@ GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
|
|||||||
return system->disposeSystem();
|
return system->disposeSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(defined(WIN32) || defined(__APPLE__))
|
|
||||||
const char *GHOST_SystemBackend()
|
|
||||||
{
|
|
||||||
return GHOST_ISystem::getSystemBackend();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle,
|
void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle,
|
||||||
const char *title,
|
const char *title,
|
||||||
const char *message,
|
const char *message,
|
||||||
@@ -161,6 +154,7 @@ GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
|||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
bool is_dialog,
|
bool is_dialog,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings)
|
GHOST_GLSettings glSettings)
|
||||||
{
|
{
|
||||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||||
@@ -171,6 +165,7 @@ GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
state,
|
state,
|
||||||
|
type,
|
||||||
glSettings,
|
glSettings,
|
||||||
false,
|
false,
|
||||||
is_dialog,
|
is_dialog,
|
||||||
|
@@ -30,8 +30,7 @@ class GHOST_ContextCGL : public GHOST_Context {
|
|||||||
GHOST_ContextCGL(bool stereoVisual,
|
GHOST_ContextCGL(bool stereoVisual,
|
||||||
NSView *metalView,
|
NSView *metalView,
|
||||||
CAMetalLayer *metalLayer,
|
CAMetalLayer *metalLayer,
|
||||||
NSOpenGLView *openglView,
|
NSOpenGLView *openglView);
|
||||||
GHOST_TDrawingContextType type);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
|
@@ -46,10 +46,8 @@ int GHOST_ContextCGL::s_sharedCount = 0;
|
|||||||
GHOST_ContextCGL::GHOST_ContextCGL(bool stereoVisual,
|
GHOST_ContextCGL::GHOST_ContextCGL(bool stereoVisual,
|
||||||
NSView *metalView,
|
NSView *metalView,
|
||||||
CAMetalLayer *metalLayer,
|
CAMetalLayer *metalLayer,
|
||||||
NSOpenGLView *openGLView,
|
NSOpenGLView *openGLView)
|
||||||
GHOST_TDrawingContextType type)
|
|
||||||
: GHOST_Context(stereoVisual),
|
: GHOST_Context(stereoVisual),
|
||||||
m_useMetalForRendering(type == GHOST_kDrawingContextTypeMetal),
|
|
||||||
m_metalView(metalView),
|
m_metalView(metalView),
|
||||||
m_metalLayer(metalLayer),
|
m_metalLayer(metalLayer),
|
||||||
m_metalCmdQueue(nil),
|
m_metalCmdQueue(nil),
|
||||||
|
@@ -306,7 +306,7 @@ GHOST_TSuccess GHOST_ContextGLX::releaseNativeHandles()
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_ContextGLX::setSwapInterval(int interval)
|
GHOST_TSuccess GHOST_ContextGLX::setSwapInterval(int interval)
|
||||||
{
|
{
|
||||||
if (epoxy_has_glx_extension(m_display, DefaultScreen(m_display), "GLX_EXT_swap_control")) {
|
if (!epoxy_has_glx_extension(m_display, DefaultScreen(m_display), "GLX_EXT_swap_control")) {
|
||||||
::glXSwapIntervalEXT(m_display, m_window, interval);
|
::glXSwapIntervalEXT(m_display, m_window, interval);
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GHOST_ISystem *GHOST_ISystem::m_system = nullptr;
|
GHOST_ISystem *GHOST_ISystem::m_system = nullptr;
|
||||||
const char *GHOST_ISystem::m_system_backend_id = nullptr;
|
|
||||||
|
|
||||||
GHOST_TBacktraceFn GHOST_ISystem::m_backtrace_fn = nullptr;
|
GHOST_TBacktraceFn GHOST_ISystem::m_backtrace_fn = nullptr;
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@ GHOST_TSuccess GHOST_ISystem::createSystem(bool verbose)
|
|||||||
/* Pass. */
|
/* Pass. */
|
||||||
#elif defined(WITH_GHOST_WAYLAND)
|
#elif defined(WITH_GHOST_WAYLAND)
|
||||||
# if defined(WITH_GHOST_WAYLAND_DYNLOAD)
|
# if defined(WITH_GHOST_WAYLAND_DYNLOAD)
|
||||||
const bool has_wayland_libraries = ghost_wl_dynload_libraries_init();
|
const bool has_wayland_libraries = ghost_wl_dynload_libraries();
|
||||||
# else
|
# else
|
||||||
const bool has_wayland_libraries = true;
|
const bool has_wayland_libraries = true;
|
||||||
# endif
|
# endif
|
||||||
@@ -66,9 +65,6 @@ GHOST_TSuccess GHOST_ISystem::createSystem(bool verbose)
|
|||||||
catch (const std::runtime_error &) {
|
catch (const std::runtime_error &) {
|
||||||
delete m_system;
|
delete m_system;
|
||||||
m_system = nullptr;
|
m_system = nullptr;
|
||||||
# ifdef WITH_GHOST_WAYLAND_DYNLOAD
|
|
||||||
ghost_wl_dynload_libraries_exit();
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -104,9 +100,6 @@ GHOST_TSuccess GHOST_ISystem::createSystem(bool verbose)
|
|||||||
catch (const std::runtime_error &) {
|
catch (const std::runtime_error &) {
|
||||||
delete m_system;
|
delete m_system;
|
||||||
m_system = nullptr;
|
m_system = nullptr;
|
||||||
# ifdef WITH_GHOST_WAYLAND_DYNLOAD
|
|
||||||
ghost_wl_dynload_libraries_exit();
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -129,10 +122,7 @@ GHOST_TSuccess GHOST_ISystem::createSystem(bool verbose)
|
|||||||
m_system = new GHOST_SystemCocoa();
|
m_system = new GHOST_SystemCocoa();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_system) {
|
if ((m_system == nullptr) && verbose) {
|
||||||
m_system_backend_id = backends_attempted[backends_attempted_num - 1];
|
|
||||||
}
|
|
||||||
else if (verbose) {
|
|
||||||
fprintf(stderr, "GHOST: failed to initialize display for back-end(s): [");
|
fprintf(stderr, "GHOST: failed to initialize display for back-end(s): [");
|
||||||
for (int i = 0; i < backends_attempted_num; i++) {
|
for (int i = 0; i < backends_attempted_num; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
@@ -196,11 +186,6 @@ GHOST_ISystem *GHOST_ISystem::getSystem()
|
|||||||
return m_system;
|
return m_system;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GHOST_ISystem::getSystemBackend()
|
|
||||||
{
|
|
||||||
return m_system_backend_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
GHOST_TBacktraceFn GHOST_ISystem::getBacktraceFn()
|
GHOST_TBacktraceFn GHOST_ISystem::getBacktraceFn()
|
||||||
{
|
{
|
||||||
return GHOST_ISystem::m_backtrace_fn;
|
return GHOST_ISystem::m_backtrace_fn;
|
||||||
|
@@ -7,50 +7,53 @@
|
|||||||
#include "GHOST_WindowManager.h"
|
#include "GHOST_WindowManager.h"
|
||||||
#include "GHOST_utildefines.h"
|
#include "GHOST_utildefines.h"
|
||||||
|
|
||||||
/* Logging, use `ghost.ndof.*` prefix. */
|
|
||||||
#include "CLG_log.h"
|
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdio> /* For error/info reporting. */
|
||||||
#include <cstring> /* For memory functions. */
|
#include <cstring> /* For memory functions. */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
#ifdef DEBUG_NDOF_MOTION
|
||||||
/** \name NDOF Enum Strings
|
/* Printable version of each GHOST_TProgress value. */
|
||||||
* \{ */
|
static const char *progress_string[] = {
|
||||||
|
"not started", "starting", "in progress", "finishing", "finished"};
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Printable values for #GHOST_TProgress enum (keep aligned). */
|
#ifdef DEBUG_NDOF_BUTTONS
|
||||||
static const char *ndof_progress_string[] = {
|
|
||||||
"not started",
|
|
||||||
"starting",
|
|
||||||
"in progress",
|
|
||||||
"finishing",
|
|
||||||
"finished",
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Printable values for #NDOF_ButtonT enum (keep aligned) */
|
|
||||||
static const char *ndof_button_names[] = {
|
static const char *ndof_button_names[] = {
|
||||||
/* Exclude `NDOF_BUTTON_NONE` (-1). */
|
/* used internally, never sent */
|
||||||
|
"NDOF_BUTTON_NONE",
|
||||||
|
/* these two are available from any 3Dconnexion device */
|
||||||
"NDOF_BUTTON_MENU",
|
"NDOF_BUTTON_MENU",
|
||||||
"NDOF_BUTTON_FIT",
|
"NDOF_BUTTON_FIT",
|
||||||
|
/* standard views */
|
||||||
"NDOF_BUTTON_TOP",
|
"NDOF_BUTTON_TOP",
|
||||||
"NDOF_BUTTON_BOTTOM",
|
"NDOF_BUTTON_BOTTOM",
|
||||||
"NDOF_BUTTON_LEFT",
|
"NDOF_BUTTON_LEFT",
|
||||||
"NDOF_BUTTON_RIGHT",
|
"NDOF_BUTTON_RIGHT",
|
||||||
"NDOF_BUTTON_FRONT",
|
"NDOF_BUTTON_FRONT",
|
||||||
"NDOF_BUTTON_BACK",
|
"NDOF_BUTTON_BACK",
|
||||||
|
/* more views */
|
||||||
"NDOF_BUTTON_ISO1",
|
"NDOF_BUTTON_ISO1",
|
||||||
"NDOF_BUTTON_ISO2",
|
"NDOF_BUTTON_ISO2",
|
||||||
|
/* 90 degree rotations */
|
||||||
"NDOF_BUTTON_ROLL_CW",
|
"NDOF_BUTTON_ROLL_CW",
|
||||||
"NDOF_BUTTON_ROLL_CCW",
|
"NDOF_BUTTON_ROLL_CCW",
|
||||||
"NDOF_BUTTON_SPIN_CW",
|
"NDOF_BUTTON_SPIN_CW",
|
||||||
"NDOF_BUTTON_SPIN_CCW",
|
"NDOF_BUTTON_SPIN_CCW",
|
||||||
"NDOF_BUTTON_TILT_CW",
|
"NDOF_BUTTON_TILT_CW",
|
||||||
"NDOF_BUTTON_TILT_CCW",
|
"NDOF_BUTTON_TILT_CCW",
|
||||||
|
/* device control */
|
||||||
"NDOF_BUTTON_ROTATE",
|
"NDOF_BUTTON_ROTATE",
|
||||||
"NDOF_BUTTON_PANZOOM",
|
"NDOF_BUTTON_PANZOOM",
|
||||||
"NDOF_BUTTON_DOMINANT",
|
"NDOF_BUTTON_DOMINANT",
|
||||||
"NDOF_BUTTON_PLUS",
|
"NDOF_BUTTON_PLUS",
|
||||||
"NDOF_BUTTON_MINUS",
|
"NDOF_BUTTON_MINUS",
|
||||||
|
/* keyboard emulation */
|
||||||
|
"NDOF_BUTTON_ESC",
|
||||||
|
"NDOF_BUTTON_ALT",
|
||||||
|
"NDOF_BUTTON_SHIFT",
|
||||||
|
"NDOF_BUTTON_CTRL",
|
||||||
|
/* general-purpose buttons */
|
||||||
"NDOF_BUTTON_1",
|
"NDOF_BUTTON_1",
|
||||||
"NDOF_BUTTON_2",
|
"NDOF_BUTTON_2",
|
||||||
"NDOF_BUTTON_3",
|
"NDOF_BUTTON_3",
|
||||||
@@ -61,47 +64,18 @@ static const char *ndof_button_names[] = {
|
|||||||
"NDOF_BUTTON_8",
|
"NDOF_BUTTON_8",
|
||||||
"NDOF_BUTTON_9",
|
"NDOF_BUTTON_9",
|
||||||
"NDOF_BUTTON_10",
|
"NDOF_BUTTON_10",
|
||||||
|
/* more general-purpose buttons */
|
||||||
"NDOF_BUTTON_A",
|
"NDOF_BUTTON_A",
|
||||||
"NDOF_BUTTON_B",
|
"NDOF_BUTTON_B",
|
||||||
"NDOF_BUTTON_C",
|
"NDOF_BUTTON_C",
|
||||||
"NDOF_BUTTON_V1",
|
/* the end */
|
||||||
"NDOF_BUTTON_V2",
|
"NDOF_BUTTON_LAST"};
|
||||||
"NDOF_BUTTON_V3",
|
#endif
|
||||||
/* Keyboard emulation. */
|
|
||||||
"NDOF_BUTTON_ESC",
|
|
||||||
"NDOF_BUTTON_ENTER",
|
|
||||||
"NDOF_BUTTON_DELETE",
|
|
||||||
"NDOF_BUTTON_TAB",
|
|
||||||
"NDOF_BUTTON_SPACE",
|
|
||||||
"NDOF_BUTTON_ALT",
|
|
||||||
"NDOF_BUTTON_SHIFT",
|
|
||||||
"NDOF_BUTTON_CTRL",
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *ndof_device_names[] = {
|
|
||||||
"UnknownDevice",
|
|
||||||
"SpaceNavigator",
|
|
||||||
"SpaceExplorer",
|
|
||||||
"SpacePilotPro",
|
|
||||||
"SpaceMousePro",
|
|
||||||
"SpaceMouseWireless",
|
|
||||||
"SpaceMouseProWireless",
|
|
||||||
"SpaceMouseEnterprise",
|
|
||||||
"SpacePilot",
|
|
||||||
"Spaceball5000",
|
|
||||||
"SpaceTraveler",
|
|
||||||
};
|
|
||||||
|
|
||||||
/** \} */
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
|
||||||
/** \name NDOF Button Maps
|
|
||||||
* \{ */
|
|
||||||
|
|
||||||
/* Shared by the latest 3Dconnexion hardware
|
/* Shared by the latest 3Dconnexion hardware
|
||||||
* SpacePilotPro uses all of these
|
* SpacePilotPro uses all of these
|
||||||
* smaller devices use only some, based on button mask. */
|
* smaller devices use only some, based on button mask. */
|
||||||
static const NDOF_ButtonT ndof_HID_map_Modern3Dx[] = {
|
static const NDOF_ButtonT Modern3Dx_HID_map[] = {
|
||||||
NDOF_BUTTON_MENU, NDOF_BUTTON_FIT, NDOF_BUTTON_TOP, NDOF_BUTTON_LEFT,
|
NDOF_BUTTON_MENU, NDOF_BUTTON_FIT, NDOF_BUTTON_TOP, NDOF_BUTTON_LEFT,
|
||||||
NDOF_BUTTON_RIGHT, NDOF_BUTTON_FRONT, NDOF_BUTTON_BOTTOM, NDOF_BUTTON_BACK,
|
NDOF_BUTTON_RIGHT, NDOF_BUTTON_FRONT, NDOF_BUTTON_BOTTOM, NDOF_BUTTON_BACK,
|
||||||
NDOF_BUTTON_ROLL_CW, NDOF_BUTTON_ROLL_CCW, NDOF_BUTTON_ISO1, NDOF_BUTTON_ISO2,
|
NDOF_BUTTON_ROLL_CW, NDOF_BUTTON_ROLL_CCW, NDOF_BUTTON_ISO1, NDOF_BUTTON_ISO2,
|
||||||
@@ -111,7 +85,7 @@ static const NDOF_ButtonT ndof_HID_map_Modern3Dx[] = {
|
|||||||
NDOF_BUTTON_SHIFT, NDOF_BUTTON_CTRL, NDOF_BUTTON_ROTATE, NDOF_BUTTON_PANZOOM,
|
NDOF_BUTTON_SHIFT, NDOF_BUTTON_CTRL, NDOF_BUTTON_ROTATE, NDOF_BUTTON_PANZOOM,
|
||||||
NDOF_BUTTON_DOMINANT, NDOF_BUTTON_PLUS, NDOF_BUTTON_MINUS};
|
NDOF_BUTTON_DOMINANT, NDOF_BUTTON_PLUS, NDOF_BUTTON_MINUS};
|
||||||
|
|
||||||
static const NDOF_ButtonT ndof_HID_map_SpaceExplorer[] = {
|
static const NDOF_ButtonT SpaceExplorer_HID_map[] = {
|
||||||
NDOF_BUTTON_1,
|
NDOF_BUTTON_1,
|
||||||
NDOF_BUTTON_2,
|
NDOF_BUTTON_2,
|
||||||
NDOF_BUTTON_TOP,
|
NDOF_BUTTON_TOP,
|
||||||
@@ -129,8 +103,9 @@ static const NDOF_ButtonT ndof_HID_map_SpaceExplorer[] = {
|
|||||||
NDOF_BUTTON_ROTATE,
|
NDOF_BUTTON_ROTATE,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This is the older SpacePilot (sans Pro). */
|
/* This is the older SpacePilot (sans Pro)
|
||||||
static const NDOF_ButtonT ndof_HID_map_SpacePilot[] = {
|
* thanks to polosson for info about this device. */
|
||||||
|
static const NDOF_ButtonT SpacePilot_HID_map[] = {
|
||||||
NDOF_BUTTON_1, NDOF_BUTTON_2, NDOF_BUTTON_3, NDOF_BUTTON_4,
|
NDOF_BUTTON_1, NDOF_BUTTON_2, NDOF_BUTTON_3, NDOF_BUTTON_4,
|
||||||
NDOF_BUTTON_5, NDOF_BUTTON_6, NDOF_BUTTON_TOP, NDOF_BUTTON_LEFT,
|
NDOF_BUTTON_5, NDOF_BUTTON_6, NDOF_BUTTON_TOP, NDOF_BUTTON_LEFT,
|
||||||
NDOF_BUTTON_RIGHT, NDOF_BUTTON_FRONT, NDOF_BUTTON_ESC, NDOF_BUTTON_ALT,
|
NDOF_BUTTON_RIGHT, NDOF_BUTTON_FRONT, NDOF_BUTTON_ESC, NDOF_BUTTON_ALT,
|
||||||
@@ -139,7 +114,7 @@ static const NDOF_ButtonT ndof_HID_map_SpacePilot[] = {
|
|||||||
NDOF_BUTTON_NONE /* the CONFIG button -- what does it do? */
|
NDOF_BUTTON_NONE /* the CONFIG button -- what does it do? */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NDOF_ButtonT ndof_HID_map_Generic[] = {
|
static const NDOF_ButtonT Generic_HID_map[] = {
|
||||||
NDOF_BUTTON_1,
|
NDOF_BUTTON_1,
|
||||||
NDOF_BUTTON_2,
|
NDOF_BUTTON_2,
|
||||||
NDOF_BUTTON_3,
|
NDOF_BUTTON_3,
|
||||||
@@ -154,91 +129,41 @@ static const NDOF_ButtonT ndof_HID_map_Generic[] = {
|
|||||||
NDOF_BUTTON_C,
|
NDOF_BUTTON_C,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Values taken from: https://github.com/FreeSpacenav/spacenavd/wiki/Device-button-names */
|
static const int genericButtonCount = ARRAY_SIZE(Generic_HID_map);
|
||||||
static const NDOF_ButtonT ndof_HID_map_SpaceMouseEnterprise[] = {
|
|
||||||
NDOF_BUTTON_1, /* (0) */
|
|
||||||
NDOF_BUTTON_2, /* (1) */
|
|
||||||
NDOF_BUTTON_3, /* (2) */
|
|
||||||
NDOF_BUTTON_4, /* (3) */
|
|
||||||
NDOF_BUTTON_5, /* (4) */
|
|
||||||
NDOF_BUTTON_6, /* (5) */
|
|
||||||
NDOF_BUTTON_7, /* (6) */
|
|
||||||
NDOF_BUTTON_8, /* (7) */
|
|
||||||
NDOF_BUTTON_9, /* (8) */
|
|
||||||
NDOF_BUTTON_A, /* Labeled "10" (9). */
|
|
||||||
NDOF_BUTTON_B, /* Labeled "11" (10). */
|
|
||||||
NDOF_BUTTON_C, /* Labeled "12" (11). */
|
|
||||||
NDOF_BUTTON_MENU, /* (12). */
|
|
||||||
NDOF_BUTTON_FIT, /* (13). */
|
|
||||||
NDOF_BUTTON_TOP, /* (14). */
|
|
||||||
NDOF_BUTTON_RIGHT, /* (15). */
|
|
||||||
NDOF_BUTTON_FRONT, /* (16). */
|
|
||||||
NDOF_BUTTON_ROLL_CW, /* (17). */
|
|
||||||
NDOF_BUTTON_ESC, /* (18). */
|
|
||||||
NDOF_BUTTON_ALT, /* (19). */
|
|
||||||
NDOF_BUTTON_SHIFT, /* (20). */
|
|
||||||
NDOF_BUTTON_CTRL, /* (21). */
|
|
||||||
NDOF_BUTTON_ROTATE, /* Labeled "Lock Rotate" (22). */
|
|
||||||
NDOF_BUTTON_ENTER, /* Labeled "Enter" (23). */
|
|
||||||
NDOF_BUTTON_DELETE, /* (24). */
|
|
||||||
NDOF_BUTTON_TAB, /* (25). */
|
|
||||||
NDOF_BUTTON_SPACE, /* (26). */
|
|
||||||
NDOF_BUTTON_V1, /* Labeled "V1" (27). */
|
|
||||||
NDOF_BUTTON_V2, /* Labeled "V2" (28). */
|
|
||||||
NDOF_BUTTON_V3, /* Labeled "V3" (29). */
|
|
||||||
NDOF_BUTTON_ISO1, /* Labeled "ISO1" (30). */
|
|
||||||
};
|
|
||||||
|
|
||||||
/** \} */
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
|
||||||
/** \name NDOF Manager Class
|
|
||||||
* \{ */
|
|
||||||
|
|
||||||
static const int genericButtonCount = ARRAY_SIZE(ndof_HID_map_Generic);
|
|
||||||
|
|
||||||
GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System &sys)
|
GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System &sys)
|
||||||
: system_(sys),
|
: m_system(sys),
|
||||||
device_type_(NDOF_UnknownDevice), /* Each platform has its own device detection code. */
|
m_deviceType(NDOF_UnknownDevice), /* Each platform has its own device detection code. */
|
||||||
hid_map_button_num_(genericButtonCount),
|
m_buttonCount(genericButtonCount),
|
||||||
hid_map_button_mask_(0),
|
m_buttonMask(0),
|
||||||
hid_map_(ndof_HID_map_Generic),
|
m_hidMap(Generic_HID_map),
|
||||||
button_depressed_(0),
|
m_buttons(0),
|
||||||
motion_time_(0),
|
m_motionTime(0),
|
||||||
motion_time_prev_(0),
|
m_prevMotionTime(0),
|
||||||
motion_state_(GHOST_kNotStarted),
|
m_motionState(GHOST_kNotStarted),
|
||||||
motion_event_pending_(false),
|
m_motionEventPending(false),
|
||||||
motion_dead_zone_(0.0f)
|
m_deadZone(0.0f)
|
||||||
{
|
{
|
||||||
/* To avoid the rare situation where one triple is updated and
|
/* To avoid the rare situation where one triple is updated and
|
||||||
* the other is not, initialize them both here: */
|
* the other is not, initialize them both here: */
|
||||||
memset(translation_, 0, sizeof(translation_));
|
memset(m_translation, 0, sizeof(m_translation));
|
||||||
memset(rotation_, 0, sizeof(rotation_));
|
memset(m_rotation, 0, sizeof(m_rotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
|
||||||
/** \name NDOF Device Setup
|
|
||||||
* \{ */
|
|
||||||
|
|
||||||
static CLG_LogRef LOG_NDOF_DEVICE = {"ghost.ndof.device"};
|
|
||||||
#define LOG (&LOG_NDOF_DEVICE)
|
|
||||||
|
|
||||||
bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id)
|
bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id)
|
||||||
{
|
{
|
||||||
/* Call this function until it returns true
|
/* Call this function until it returns true
|
||||||
* it's a good idea to stop calling it after that, as it will "forget"
|
* it's a good idea to stop calling it after that, as it will "forget"
|
||||||
* whichever device it already found. */
|
* whichever device it already found */
|
||||||
|
|
||||||
/* Default to safe generic behavior for "unknown" devices
|
/* Default to safe generic behavior for "unknown" devices
|
||||||
* unidentified devices will emit motion events like normal
|
* unidentified devices will emit motion events like normal
|
||||||
* rogue buttons do nothing by default, but can be customized by the user. */
|
* rogue buttons do nothing by default, but can be customized by the user. */
|
||||||
|
|
||||||
device_type_ = NDOF_UnknownDevice;
|
m_deviceType = NDOF_UnknownDevice;
|
||||||
hid_map_ = ndof_HID_map_Generic;
|
m_hidMap = Generic_HID_map;
|
||||||
hid_map_button_num_ = genericButtonCount;
|
m_buttonCount = genericButtonCount;
|
||||||
hid_map_button_mask_ = 0;
|
m_buttonMask = 0;
|
||||||
|
|
||||||
/* "mystery device" owners can help build a HID_map for their hardware
|
/* "mystery device" owners can help build a HID_map for their hardware
|
||||||
* A few users have already contributed information about several older devices
|
* A few users have already contributed information about several older devices
|
||||||
@@ -248,165 +173,112 @@ bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id)
|
|||||||
case 0x046D: /* Logitech (3Dconnexion was a subsidiary). */
|
case 0x046D: /* Logitech (3Dconnexion was a subsidiary). */
|
||||||
switch (product_id) {
|
switch (product_id) {
|
||||||
/* -- current devices -- */
|
/* -- current devices -- */
|
||||||
case 0xC626: /* Full-size SpaceNavigator. */
|
case 0xC626: /* full-size SpaceNavigator */
|
||||||
case 0xC628: /* The "for Notebooks" one. */
|
case 0xC628: /* the "for Notebooks" one */
|
||||||
{
|
puts("ndof: using SpaceNavigator");
|
||||||
device_type_ = NDOF_SpaceNavigator;
|
m_deviceType = NDOF_SpaceNavigator;
|
||||||
hid_map_button_num_ = 2;
|
m_buttonCount = 2;
|
||||||
hid_map_ = ndof_HID_map_Modern3Dx;
|
m_hidMap = Modern3Dx_HID_map;
|
||||||
break;
|
break;
|
||||||
}
|
case 0xC627:
|
||||||
case 0xC627: {
|
puts("ndof: using SpaceExplorer");
|
||||||
device_type_ = NDOF_SpaceExplorer;
|
m_deviceType = NDOF_SpaceExplorer;
|
||||||
hid_map_button_num_ = 15;
|
m_buttonCount = 15;
|
||||||
hid_map_ = ndof_HID_map_SpaceExplorer;
|
m_hidMap = SpaceExplorer_HID_map;
|
||||||
break;
|
break;
|
||||||
}
|
case 0xC629:
|
||||||
case 0xC629: {
|
puts("ndof: using SpacePilot Pro");
|
||||||
device_type_ = NDOF_SpacePilotPro;
|
m_deviceType = NDOF_SpacePilotPro;
|
||||||
hid_map_button_num_ = 31;
|
m_buttonCount = 31;
|
||||||
hid_map_ = ndof_HID_map_Modern3Dx;
|
m_hidMap = Modern3Dx_HID_map;
|
||||||
break;
|
break;
|
||||||
}
|
case 0xC62B:
|
||||||
case 0xC62B: {
|
puts("ndof: using SpaceMouse Pro");
|
||||||
device_type_ = NDOF_SpaceMousePro;
|
m_deviceType = NDOF_SpaceMousePro;
|
||||||
hid_map_button_num_ = 27; /* 15 physical buttons, but HID codes range from 0 to 26. */
|
m_buttonCount = 27;
|
||||||
hid_map_button_mask_ = 0x07C0F137;
|
/* ^^ actually has 15 buttons, but their HID codes range from 0 to 26 */
|
||||||
hid_map_ = ndof_HID_map_Modern3Dx;
|
m_buttonMask = 0x07C0F137;
|
||||||
|
m_hidMap = Modern3Dx_HID_map;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
/* -- older devices -- */
|
/* -- older devices -- */
|
||||||
case 0xC625: {
|
case 0xC625:
|
||||||
device_type_ = NDOF_SpacePilot;
|
puts("ndof: using SpacePilot");
|
||||||
hid_map_button_num_ = 21;
|
m_deviceType = NDOF_SpacePilot;
|
||||||
hid_map_ = ndof_HID_map_SpacePilot;
|
m_buttonCount = 21;
|
||||||
|
m_hidMap = SpacePilot_HID_map;
|
||||||
break;
|
break;
|
||||||
}
|
case 0xC621:
|
||||||
case 0xC621: {
|
puts("ndof: using Spaceball 5000");
|
||||||
device_type_ = NDOF_Spaceball5000;
|
m_deviceType = NDOF_Spaceball5000;
|
||||||
hid_map_button_num_ = 12;
|
m_buttonCount = 12;
|
||||||
break;
|
break;
|
||||||
}
|
case 0xC623:
|
||||||
case 0xC623: {
|
puts("ndof: using SpaceTraveler");
|
||||||
device_type_ = NDOF_SpaceTraveler;
|
m_deviceType = NDOF_SpaceTraveler;
|
||||||
hid_map_button_num_ = 8;
|
m_buttonCount = 8;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default: {
|
default:
|
||||||
CLOG_INFO(LOG, 2, "unknown Logitech product %04hx", product_id);
|
printf("ndof: unknown Logitech product %04hx\n", product_id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x256F: /* 3Dconnexion. */
|
case 0x256F: /* 3Dconnexion */
|
||||||
switch (product_id) {
|
switch (product_id) {
|
||||||
case 0xC62E: /* Plugged in. */
|
case 0xC62E: /* Plugged in. */
|
||||||
case 0xC62F: /* Wireless. */
|
case 0xC62F: /* Wireless. */
|
||||||
{
|
puts("ndof: using SpaceMouse Wireless");
|
||||||
device_type_ = NDOF_SpaceMouseWireless;
|
m_deviceType = NDOF_SpaceMouseWireless;
|
||||||
hid_map_button_num_ = 2;
|
m_buttonCount = 2;
|
||||||
hid_map_ = ndof_HID_map_Modern3Dx;
|
m_hidMap = Modern3Dx_HID_map;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 0xC631: /* Plugged in. */
|
case 0xC631: /* Plugged in. */
|
||||||
case 0xC632: /* Wireless. */
|
case 0xC632: /* Wireless. */
|
||||||
{
|
puts("ndof: using SpaceMouse Pro Wireless");
|
||||||
device_type_ = NDOF_SpaceMouseProWireless;
|
m_deviceType = NDOF_SpaceMouseProWireless;
|
||||||
hid_map_button_num_ = 27; /* 15 physical buttons, but HID codes range from 0 to 26. */
|
m_buttonCount = 27;
|
||||||
hid_map_button_mask_ = 0x07C0F137;
|
/* ^^ actually has 15 buttons, but their HID codes range from 0 to 26. */
|
||||||
hid_map_ = ndof_HID_map_Modern3Dx;
|
m_buttonMask = 0x07C0F137;
|
||||||
|
m_hidMap = Modern3Dx_HID_map;
|
||||||
break;
|
break;
|
||||||
}
|
case 0xC633:
|
||||||
case 0xC633: {
|
puts("ndof: using SpaceMouse Enterprise");
|
||||||
device_type_ = NDOF_SpaceMouseEnterprise;
|
m_deviceType = NDOF_SpaceMouseEnterprise;
|
||||||
hid_map_button_num_ = 31;
|
m_buttonCount = 31;
|
||||||
hid_map_ = ndof_HID_map_SpaceMouseEnterprise;
|
m_hidMap = Modern3Dx_HID_map;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default: {
|
default:
|
||||||
CLOG_INFO(LOG, 2, "unknown 3Dconnexion product %04hx", product_id);
|
printf("ndof: unknown 3Dconnexion product %04hx\n", product_id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CLOG_INFO(LOG, 2, "unknown device %04hx:%04hx", vendor_id, product_id);
|
printf("ndof: unknown device %04hx:%04hx\n", vendor_id, product_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_type_ != NDOF_UnknownDevice) {
|
if (m_buttonMask == 0) {
|
||||||
CLOG_INFO(LOG, 2, "using %s", ndof_device_names[device_type_]);
|
m_buttonMask = int(~(UINT_MAX << m_buttonCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hid_map_button_mask_ == 0) {
|
#ifdef DEBUG_NDOF_BUTTONS
|
||||||
hid_map_button_mask_ = int(~(UINT_MAX << hid_map_button_num_));
|
printf("ndof: %d buttons -> hex:%X\n", m_buttonCount, m_buttonMask);
|
||||||
}
|
#endif
|
||||||
|
|
||||||
CLOG_INFO(LOG, 2, "%d buttons -> hex:%X", hid_map_button_num_, (uint)hid_map_button_mask_);
|
return m_deviceType != NDOF_UnknownDevice;
|
||||||
|
|
||||||
return device_type_ != NDOF_UnknownDevice;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef LOG
|
|
||||||
|
|
||||||
/** \} */
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
|
||||||
/** \name NDOF Update State
|
|
||||||
* \{ */
|
|
||||||
|
|
||||||
void GHOST_NDOFManager::updateTranslation(const int t[3], uint64_t time)
|
void GHOST_NDOFManager::updateTranslation(const int t[3], uint64_t time)
|
||||||
{
|
{
|
||||||
memcpy(translation_, t, sizeof(translation_));
|
memcpy(m_translation, t, sizeof(m_translation));
|
||||||
motion_time_ = time;
|
m_motionTime = time;
|
||||||
motion_event_pending_ = true;
|
m_motionEventPending = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::updateRotation(const int r[3], uint64_t time)
|
void GHOST_NDOFManager::updateRotation(const int r[3], uint64_t time)
|
||||||
{
|
{
|
||||||
memcpy(rotation_, r, sizeof(rotation_));
|
memcpy(m_rotation, r, sizeof(m_rotation));
|
||||||
motion_time_ = time;
|
m_motionTime = time;
|
||||||
motion_event_pending_ = true;
|
m_motionEventPending = true;
|
||||||
}
|
|
||||||
|
|
||||||
/** \} */
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
|
||||||
/** \name NDOF Buttons
|
|
||||||
* \{ */
|
|
||||||
|
|
||||||
static CLG_LogRef LOG_NDOF_BUTTONS = {"ghost.ndof.buttons"};
|
|
||||||
#define LOG (&LOG_NDOF_BUTTONS)
|
|
||||||
|
|
||||||
static GHOST_TKey ghost_map_keyboard_from_ndof_buttom(const NDOF_ButtonT button)
|
|
||||||
{
|
|
||||||
switch (button) {
|
|
||||||
case NDOF_BUTTON_ESC: {
|
|
||||||
return GHOST_kKeyEsc;
|
|
||||||
}
|
|
||||||
case NDOF_BUTTON_ENTER: {
|
|
||||||
return GHOST_kKeyEnter;
|
|
||||||
}
|
|
||||||
case NDOF_BUTTON_DELETE: {
|
|
||||||
return GHOST_kKeyDelete;
|
|
||||||
}
|
|
||||||
case NDOF_BUTTON_TAB: {
|
|
||||||
return GHOST_kKeyTab;
|
|
||||||
}
|
|
||||||
case NDOF_BUTTON_SPACE: {
|
|
||||||
return GHOST_kKeySpace;
|
|
||||||
}
|
|
||||||
case NDOF_BUTTON_ALT: {
|
|
||||||
return GHOST_kKeyLeftAlt;
|
|
||||||
}
|
|
||||||
case NDOF_BUTTON_SHIFT: {
|
|
||||||
return GHOST_kKeyLeftShift;
|
|
||||||
}
|
|
||||||
case NDOF_BUTTON_CTRL: {
|
|
||||||
return GHOST_kKeyLeftControl;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return GHOST_kKeyUnknown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
|
void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
|
||||||
@@ -414,7 +286,7 @@ void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
|
|||||||
uint64_t time,
|
uint64_t time,
|
||||||
GHOST_IWindow *window)
|
GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
GHOST_ASSERT(button > NDOF_BUTTON_NONE && button < NDOF_BUTTON_NUM,
|
GHOST_ASSERT(button > NDOF_BUTTON_NONE && button < NDOF_BUTTON_LAST,
|
||||||
"rogue button trying to escape NDOF manager");
|
"rogue button trying to escape NDOF manager");
|
||||||
|
|
||||||
GHOST_EventNDOFButton *event = new GHOST_EventNDOFButton(time, window);
|
GHOST_EventNDOFButton *event = new GHOST_EventNDOFButton(time, window);
|
||||||
@@ -423,7 +295,11 @@ void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
|
|||||||
data->action = press ? GHOST_kPress : GHOST_kRelease;
|
data->action = press ? GHOST_kPress : GHOST_kRelease;
|
||||||
data->button = button;
|
data->button = button;
|
||||||
|
|
||||||
system_.pushEvent(event);
|
#ifdef DEBUG_NDOF_BUTTONS
|
||||||
|
printf("%s %s\n", ndof_button_names[button], press ? "pressed" : "released");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_system.pushEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key,
|
void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key,
|
||||||
@@ -434,59 +310,62 @@ void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key,
|
|||||||
GHOST_TEventType type = press ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
|
GHOST_TEventType type = press ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
|
||||||
GHOST_EventKey *event = new GHOST_EventKey(time, type, window, key, false);
|
GHOST_EventKey *event = new GHOST_EventKey(time, type, window, key, false);
|
||||||
|
|
||||||
system_.pushEvent(event);
|
#ifdef DEBUG_NDOF_BUTTONS
|
||||||
|
printf("keyboard %s\n", press ? "down" : "up");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_system.pushEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t time)
|
void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t time)
|
||||||
{
|
{
|
||||||
if (button_number >= hid_map_button_num_) {
|
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
|
||||||
CLOG_INFO(LOG,
|
|
||||||
2,
|
|
||||||
"button=%d, press=%d (out of range %d, ignoring!)",
|
|
||||||
button_number,
|
|
||||||
(int)press,
|
|
||||||
hid_map_button_num_);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const NDOF_ButtonT button = hid_map_[button_number];
|
|
||||||
if (button == NDOF_BUTTON_NONE) {
|
|
||||||
CLOG_INFO(
|
|
||||||
LOG, 2, "button=%d, press=%d (mapped to none, ignoring!)", button_number, (int)press);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLOG_INFO(LOG,
|
#ifdef DEBUG_NDOF_BUTTONS
|
||||||
2,
|
printf("ndof: button %d -> ", button_number);
|
||||||
"button=%d, press=%d, name=%s",
|
#endif
|
||||||
button_number,
|
|
||||||
(int)press,
|
|
||||||
ndof_button_names[button]);
|
|
||||||
|
|
||||||
GHOST_IWindow *window = system_.getWindowManager()->getActiveWindow();
|
NDOF_ButtonT button = (button_number < m_buttonCount) ? m_hidMap[button_number] :
|
||||||
const GHOST_TKey key = ghost_map_keyboard_from_ndof_buttom(button);
|
NDOF_BUTTON_NONE;
|
||||||
if (key != GHOST_kKeyUnknown) {
|
|
||||||
sendKeyEvent(key, press, time, window);
|
switch (button) {
|
||||||
}
|
case NDOF_BUTTON_NONE:
|
||||||
else {
|
#ifdef DEBUG_NDOF_BUTTONS
|
||||||
sendButtonEvent(button, press, time, window);
|
printf("discarded\n");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case NDOF_BUTTON_ESC:
|
||||||
|
sendKeyEvent(GHOST_kKeyEsc, press, time, window);
|
||||||
|
break;
|
||||||
|
case NDOF_BUTTON_ALT:
|
||||||
|
sendKeyEvent(GHOST_kKeyLeftAlt, press, time, window);
|
||||||
|
break;
|
||||||
|
case NDOF_BUTTON_SHIFT:
|
||||||
|
sendKeyEvent(GHOST_kKeyLeftShift, press, time, window);
|
||||||
|
break;
|
||||||
|
case NDOF_BUTTON_CTRL:
|
||||||
|
sendKeyEvent(GHOST_kKeyLeftControl, press, time, window);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sendButtonEvent(button, press, time, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mask = 1 << button_number;
|
int mask = 1 << button_number;
|
||||||
if (press) {
|
if (press) {
|
||||||
button_depressed_ |= mask; /* Set this button's bit. */
|
m_buttons |= mask; /* Set this button's bit. */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
button_depressed_ &= ~mask; /* Clear this button's bit. */
|
m_buttons &= ~mask; /* Clear this button's bit. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::updateButtons(int button_bits, uint64_t time)
|
void GHOST_NDOFManager::updateButtons(int button_bits, uint64_t time)
|
||||||
{
|
{
|
||||||
button_bits &= hid_map_button_mask_; /* Discard any "garbage" bits. */
|
button_bits &= m_buttonMask; /* Discard any "garbage" bits. */
|
||||||
|
|
||||||
int diff = button_depressed_ ^ button_bits;
|
int diff = m_buttons ^ button_bits;
|
||||||
|
|
||||||
for (int button_number = 0; button_number < hid_map_button_num_; ++button_number) {
|
for (int button_number = 0; button_number < m_buttonCount; ++button_number) {
|
||||||
int mask = 1 << button_number;
|
int mask = 1 << button_number;
|
||||||
|
|
||||||
if (diff & mask) {
|
if (diff & mask) {
|
||||||
@@ -496,27 +375,19 @@ void GHOST_NDOFManager::updateButtons(int button_bits, uint64_t time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef LOG
|
|
||||||
|
|
||||||
/** \} */
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
|
||||||
/** \name NDOF Motion
|
|
||||||
* \{ */
|
|
||||||
|
|
||||||
static CLG_LogRef LOG_NDOF_MOTION = {"ghost.ndof.motion"};
|
|
||||||
#define LOG (&LOG_NDOF_MOTION)
|
|
||||||
|
|
||||||
void GHOST_NDOFManager::setDeadZone(float dz)
|
void GHOST_NDOFManager::setDeadZone(float dz)
|
||||||
{
|
{
|
||||||
if (dz < 0.0f) {
|
if (dz < 0.0f) {
|
||||||
/* Negative values don't make sense, so clamp at zero. */
|
/* Negative values don't make sense, so clamp at zero. */
|
||||||
dz = 0.0f;
|
dz = 0.0f;
|
||||||
}
|
}
|
||||||
motion_dead_zone_ = dz;
|
else if (dz > 0.5f) {
|
||||||
|
/* Warn the rogue user/developer, but allow it. */
|
||||||
|
GHOST_PRINTF("ndof: dead zone of %.2f is rather high...\n", dz);
|
||||||
|
}
|
||||||
|
m_deadZone = dz;
|
||||||
|
|
||||||
/* Warn the rogue user/developer about high dead-zone, but allow it. */
|
GHOST_PRINTF("ndof: dead zone set to %.2f\n", dz);
|
||||||
CLOG_INFO(LOG, 2, "dead zone set to %.2f%s", dz, (dz > 0.5f) ? " (unexpectedly high)" : "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool atHomePosition(GHOST_TEventNDOFMotionData *ndof)
|
static bool atHomePosition(GHOST_TEventNDOFMotionData *ndof)
|
||||||
@@ -531,27 +402,29 @@ static bool nearHomePosition(GHOST_TEventNDOFMotionData *ndof, float threshold)
|
|||||||
if (threshold == 0.0f) {
|
if (threshold == 0.0f) {
|
||||||
return atHomePosition(ndof);
|
return atHomePosition(ndof);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
#define HOME(foo) (fabsf(ndof->foo) < threshold)
|
#define HOME(foo) (fabsf(ndof->foo) < threshold)
|
||||||
return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz);
|
return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz);
|
||||||
#undef HOME
|
#undef HOME
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GHOST_NDOFManager::sendMotionEvent()
|
bool GHOST_NDOFManager::sendMotionEvent()
|
||||||
{
|
{
|
||||||
if (!motion_event_pending_) {
|
if (!m_motionEventPending) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
motion_event_pending_ = false; /* Any pending motion is handled right now. */
|
m_motionEventPending = false; /* Any pending motion is handled right now. */
|
||||||
|
|
||||||
GHOST_IWindow *window = system_.getWindowManager()->getActiveWindow();
|
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
|
||||||
|
|
||||||
if (window == nullptr) {
|
if (window == NULL) {
|
||||||
motion_state_ = GHOST_kNotStarted; /* Avoid large `dt` times when changing windows. */
|
m_motionState = GHOST_kNotStarted; /* Avoid large `dt` times when changing windows. */
|
||||||
return false; /* Delivery will fail, so don't bother sending. */
|
return false; /* Delivery will fail, so don't bother sending. */
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_EventNDOFMotion *event = new GHOST_EventNDOFMotion(motion_time_, window);
|
GHOST_EventNDOFMotion *event = new GHOST_EventNDOFMotion(m_motionTime, window);
|
||||||
GHOST_TEventNDOFMotionData *data = (GHOST_TEventNDOFMotionData *)event->getData();
|
GHOST_TEventNDOFMotionData *data = (GHOST_TEventNDOFMotionData *)event->getData();
|
||||||
|
|
||||||
/* Scale axis values here to normalize them to around +/- 1
|
/* Scale axis values here to normalize them to around +/- 1
|
||||||
@@ -559,82 +432,76 @@ bool GHOST_NDOFManager::sendMotionEvent()
|
|||||||
|
|
||||||
const float scale = 1.0f / 350.0f; /* 3Dconnexion devices send +/- 350 usually */
|
const float scale = 1.0f / 350.0f; /* 3Dconnexion devices send +/- 350 usually */
|
||||||
|
|
||||||
data->tx = scale * translation_[0];
|
data->tx = scale * m_translation[0];
|
||||||
data->ty = scale * translation_[1];
|
data->ty = scale * m_translation[1];
|
||||||
data->tz = scale * translation_[2];
|
data->tz = scale * m_translation[2];
|
||||||
|
|
||||||
data->rx = scale * rotation_[0];
|
data->rx = scale * m_rotation[0];
|
||||||
data->ry = scale * rotation_[1];
|
data->ry = scale * m_rotation[1];
|
||||||
data->rz = scale * rotation_[2];
|
data->rz = scale * m_rotation[2];
|
||||||
data->dt = 0.001f * (motion_time_ - motion_time_prev_); /* In seconds. */
|
|
||||||
motion_time_prev_ = motion_time_;
|
|
||||||
|
|
||||||
bool weHaveMotion = !nearHomePosition(data, motion_dead_zone_);
|
data->dt = 0.001f * (m_motionTime - m_prevMotionTime); /* In seconds. */
|
||||||
|
m_prevMotionTime = m_motionTime;
|
||||||
|
|
||||||
|
bool weHaveMotion = !nearHomePosition(data, m_deadZone);
|
||||||
|
|
||||||
/* Determine what kind of motion event to send `(Starting, InProgress, Finishing)`
|
/* Determine what kind of motion event to send `(Starting, InProgress, Finishing)`
|
||||||
* and where that leaves this NDOF manager `(NotStarted, InProgress, Finished)`. */
|
* and where that leaves this NDOF manager `(NotStarted, InProgress, Finished)`. */
|
||||||
switch (motion_state_) {
|
switch (m_motionState) {
|
||||||
case GHOST_kNotStarted:
|
case GHOST_kNotStarted:
|
||||||
case GHOST_kFinished: {
|
case GHOST_kFinished:
|
||||||
if (weHaveMotion) {
|
if (weHaveMotion) {
|
||||||
data->progress = GHOST_kStarting;
|
data->progress = GHOST_kStarting;
|
||||||
motion_state_ = GHOST_kInProgress;
|
m_motionState = GHOST_kInProgress;
|
||||||
/* Previous motion time will be ancient, so just make up a reasonable time delta. */
|
/* Previous motion time will be ancient, so just make up a reasonable time delta. */
|
||||||
data->dt = 0.0125f;
|
data->dt = 0.0125f;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Send no event and keep current state. */
|
/* Send no event and keep current state. */
|
||||||
CLOG_INFO(LOG, 2, "motion ignored");
|
#ifdef DEBUG_NDOF_MOTION
|
||||||
|
printf("ndof motion ignored -- %s\n", progress_string[data->progress]);
|
||||||
|
#endif
|
||||||
delete event;
|
delete event;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case GHOST_kInProgress:
|
||||||
case GHOST_kInProgress: {
|
|
||||||
if (weHaveMotion) {
|
if (weHaveMotion) {
|
||||||
data->progress = GHOST_kInProgress;
|
data->progress = GHOST_kInProgress;
|
||||||
/* Remain 'InProgress'. */
|
/* Remain 'InProgress'. */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data->progress = GHOST_kFinishing;
|
data->progress = GHOST_kFinishing;
|
||||||
motion_state_ = GHOST_kFinished;
|
m_motionState = GHOST_kFinished;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
default: {
|
|
||||||
/* Will always be one of the above. */
|
/* Will always be one of the above. */
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#ifdef DEBUG_NDOF_MOTION
|
||||||
CLOG_INFO(LOG,
|
printf("ndof motion sent -- %s\n", progress_string[data->progress]);
|
||||||
2,
|
|
||||||
"motion sent, T=(%.2f,%.2f,%.2f), R=(%.2f,%.2f,%.2f) dt=%.3f, status=%s",
|
/* Show details about this motion event. */
|
||||||
data->tx,
|
printf(" T=(%d,%d,%d) R=(%d,%d,%d) raw\n",
|
||||||
data->ty,
|
m_translation[0],
|
||||||
data->tz,
|
m_translation[1],
|
||||||
data->rx,
|
m_translation[2],
|
||||||
data->ry,
|
m_rotation[0],
|
||||||
data->rz,
|
m_rotation[1],
|
||||||
data->dt,
|
m_rotation[2]);
|
||||||
ndof_progress_string[data->progress]);
|
printf(" T=(%.2f,%.2f,%.2f) R=(%.2f,%.2f,%.2f) dt=%.3f\n",
|
||||||
#else
|
data->tx,
|
||||||
/* Raw values, may be useful for debugging. */
|
data->ty,
|
||||||
CLOG_INFO(LOG,
|
data->tz,
|
||||||
2,
|
data->rx,
|
||||||
"motion sent, T=(%d,%d,%d) R=(%d,%d,%d) status=%s",
|
data->ry,
|
||||||
translation_[0],
|
data->rz,
|
||||||
translation_[1],
|
data->dt);
|
||||||
translation_[2],
|
|
||||||
rotation_[0],
|
|
||||||
rotation_[1],
|
|
||||||
rotation_[2],
|
|
||||||
ndof_progress_string[data->progress]);
|
|
||||||
#endif
|
#endif
|
||||||
system_.pushEvent(event);
|
|
||||||
|
m_system.pushEvent(event);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
|
||||||
|
@@ -8,8 +8,11 @@
|
|||||||
|
|
||||||
#include "GHOST_System.h"
|
#include "GHOST_System.h"
|
||||||
|
|
||||||
|
// #define DEBUG_NDOF_MOTION
|
||||||
|
// #define DEBUG_NDOF_BUTTONS
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NDOF_UnknownDevice = 0,
|
NDOF_UnknownDevice,
|
||||||
|
|
||||||
/* Current devices. */
|
/* Current devices. */
|
||||||
NDOF_SpaceNavigator,
|
NDOF_SpaceNavigator,
|
||||||
@@ -29,8 +32,8 @@ typedef enum {
|
|||||||
|
|
||||||
/* NDOF device button event types */
|
/* NDOF device button event types */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* Used internally, never sent or used as an index. */
|
/* Used internally, never sent. */
|
||||||
NDOF_BUTTON_NONE = -1,
|
NDOF_BUTTON_NONE,
|
||||||
/* These two are available from any 3Dconnexion device. */
|
/* These two are available from any 3Dconnexion device. */
|
||||||
NDOF_BUTTON_MENU,
|
NDOF_BUTTON_MENU,
|
||||||
NDOF_BUTTON_FIT,
|
NDOF_BUTTON_FIT,
|
||||||
@@ -58,6 +61,11 @@ typedef enum {
|
|||||||
NDOF_BUTTON_DOMINANT,
|
NDOF_BUTTON_DOMINANT,
|
||||||
NDOF_BUTTON_PLUS,
|
NDOF_BUTTON_PLUS,
|
||||||
NDOF_BUTTON_MINUS,
|
NDOF_BUTTON_MINUS,
|
||||||
|
/* Keyboard emulation. */
|
||||||
|
NDOF_BUTTON_ESC,
|
||||||
|
NDOF_BUTTON_ALT,
|
||||||
|
NDOF_BUTTON_SHIFT,
|
||||||
|
NDOF_BUTTON_CTRL,
|
||||||
/* General-purpose buttons.
|
/* General-purpose buttons.
|
||||||
* Users can assign functions via keymap editor. */
|
* Users can assign functions via keymap editor. */
|
||||||
NDOF_BUTTON_1,
|
NDOF_BUTTON_1,
|
||||||
@@ -74,20 +82,8 @@ typedef enum {
|
|||||||
NDOF_BUTTON_A,
|
NDOF_BUTTON_A,
|
||||||
NDOF_BUTTON_B,
|
NDOF_BUTTON_B,
|
||||||
NDOF_BUTTON_C,
|
NDOF_BUTTON_C,
|
||||||
/* Store Views. */
|
/* The end. */
|
||||||
NDOF_BUTTON_V1,
|
NDOF_BUTTON_LAST
|
||||||
NDOF_BUTTON_V2,
|
|
||||||
NDOF_BUTTON_V3,
|
|
||||||
/* Keyboard emulation. */
|
|
||||||
NDOF_BUTTON_ESC,
|
|
||||||
NDOF_BUTTON_ENTER,
|
|
||||||
NDOF_BUTTON_DELETE,
|
|
||||||
NDOF_BUTTON_TAB,
|
|
||||||
NDOF_BUTTON_SPACE,
|
|
||||||
NDOF_BUTTON_ALT,
|
|
||||||
NDOF_BUTTON_SHIFT,
|
|
||||||
NDOF_BUTTON_CTRL,
|
|
||||||
#define NDOF_BUTTON_NUM (NDOF_BUTTON_CTRL + 1)
|
|
||||||
} NDOF_ButtonT;
|
} NDOF_ButtonT;
|
||||||
|
|
||||||
class GHOST_NDOFManager {
|
class GHOST_NDOFManager {
|
||||||
@@ -147,25 +143,25 @@ class GHOST_NDOFManager {
|
|||||||
bool sendMotionEvent();
|
bool sendMotionEvent();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GHOST_System &system_;
|
GHOST_System &m_system;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void sendButtonEvent(NDOF_ButtonT, bool press, uint64_t time, GHOST_IWindow *);
|
void sendButtonEvent(NDOF_ButtonT, bool press, uint64_t time, GHOST_IWindow *);
|
||||||
void sendKeyEvent(GHOST_TKey, bool press, uint64_t time, GHOST_IWindow *);
|
void sendKeyEvent(GHOST_TKey, bool press, uint64_t time, GHOST_IWindow *);
|
||||||
|
|
||||||
NDOF_DeviceT device_type_;
|
NDOF_DeviceT m_deviceType;
|
||||||
int hid_map_button_num_;
|
int m_buttonCount;
|
||||||
int hid_map_button_mask_;
|
int m_buttonMask;
|
||||||
const NDOF_ButtonT *hid_map_;
|
const NDOF_ButtonT *m_hidMap;
|
||||||
|
|
||||||
int translation_[3];
|
int m_translation[3];
|
||||||
int rotation_[3];
|
int m_rotation[3];
|
||||||
int button_depressed_; /* Bit field. */
|
int m_buttons; /* Bit field. */
|
||||||
|
|
||||||
uint64_t motion_time_; /* In milliseconds. */
|
uint64_t m_motionTime; /* In milliseconds. */
|
||||||
uint64_t motion_time_prev_; /* Time of most recent motion event sent. */
|
uint64_t m_prevMotionTime; /* Time of most recent motion event sent. */
|
||||||
|
|
||||||
GHOST_TProgress motion_state_;
|
GHOST_TProgress m_motionState;
|
||||||
bool motion_event_pending_;
|
bool m_motionEventPending;
|
||||||
float motion_dead_zone_; /* Discard motion with each component < this. */
|
float m_deadZone; /* Discard motion with each component < this. */
|
||||||
};
|
};
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#define SPNAV_SOCK_PATH "/var/run/spnav.sock"
|
#define SPNAV_SOCK_PATH "/var/run/spnav.sock"
|
||||||
|
|
||||||
GHOST_NDOFManagerUnix::GHOST_NDOFManagerUnix(GHOST_System &sys)
|
GHOST_NDOFManagerUnix::GHOST_NDOFManagerUnix(GHOST_System &sys)
|
||||||
: GHOST_NDOFManager(sys), available_(false)
|
: GHOST_NDOFManager(sys), m_available(false)
|
||||||
{
|
{
|
||||||
if (access(SPNAV_SOCK_PATH, F_OK) != 0) {
|
if (access(SPNAV_SOCK_PATH, F_OK) != 0) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -20,7 +20,7 @@ GHOST_NDOFManagerUnix::GHOST_NDOFManagerUnix(GHOST_System &sys)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (spnav_open() != -1) {
|
else if (spnav_open() != -1) {
|
||||||
available_ = true;
|
m_available = true;
|
||||||
|
|
||||||
/* determine exactly which device (if any) is plugged in */
|
/* determine exactly which device (if any) is plugged in */
|
||||||
|
|
||||||
@@ -45,14 +45,14 @@ GHOST_NDOFManagerUnix::GHOST_NDOFManagerUnix(GHOST_System &sys)
|
|||||||
|
|
||||||
GHOST_NDOFManagerUnix::~GHOST_NDOFManagerUnix()
|
GHOST_NDOFManagerUnix::~GHOST_NDOFManagerUnix()
|
||||||
{
|
{
|
||||||
if (available_) {
|
if (m_available) {
|
||||||
spnav_close();
|
spnav_close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GHOST_NDOFManagerUnix::available()
|
bool GHOST_NDOFManagerUnix::available()
|
||||||
{
|
{
|
||||||
return available_;
|
return m_available;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -74,7 +74,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
|
|||||||
{
|
{
|
||||||
bool anyProcessed = false;
|
bool anyProcessed = false;
|
||||||
|
|
||||||
if (available_) {
|
if (m_available) {
|
||||||
spnav_event e;
|
spnav_event e;
|
||||||
|
|
||||||
#ifdef USE_FINISH_GLITCH_WORKAROUND
|
#ifdef USE_FINISH_GLITCH_WORKAROUND
|
||||||
@@ -85,7 +85,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
|
|||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case SPNAV_EVENT_MOTION: {
|
case SPNAV_EVENT_MOTION: {
|
||||||
/* convert to blender view coords */
|
/* convert to blender view coords */
|
||||||
uint64_t now = system_.getMilliSeconds();
|
uint64_t now = m_system.getMilliSeconds();
|
||||||
const int t[3] = {int(e.motion.x), int(e.motion.y), int(-e.motion.z)};
|
const int t[3] = {int(e.motion.x), int(e.motion.y), int(-e.motion.z)};
|
||||||
const int r[3] = {int(-e.motion.rx), int(-e.motion.ry), int(e.motion.rz)};
|
const int r[3] = {int(-e.motion.rx), int(-e.motion.ry), int(e.motion.rz)};
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPNAV_EVENT_BUTTON:
|
case SPNAV_EVENT_BUTTON:
|
||||||
uint64_t now = system_.getMilliSeconds();
|
uint64_t now = m_system.getMilliSeconds();
|
||||||
updateButton(e.button.bnum, e.button.press, now);
|
updateButton(e.button.bnum, e.button.press, now);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
|
|||||||
|
|
||||||
#ifdef USE_FINISH_GLITCH_WORKAROUND
|
#ifdef USE_FINISH_GLITCH_WORKAROUND
|
||||||
if (motion_test_prev == true && motion_test == false) {
|
if (motion_test_prev == true && motion_test == false) {
|
||||||
uint64_t now = system_.getMilliSeconds();
|
uint64_t now = m_system.getMilliSeconds();
|
||||||
const int v[3] = {0, 0, 0};
|
const int v[3] = {0, 0, 0};
|
||||||
|
|
||||||
updateTranslation(v, now);
|
updateTranslation(v, now);
|
||||||
|
@@ -15,5 +15,5 @@ class GHOST_NDOFManagerUnix : public GHOST_NDOFManager {
|
|||||||
bool processEvents();
|
bool processEvents();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool available_;
|
bool m_available;
|
||||||
};
|
};
|
||||||
|
@@ -384,7 +384,6 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
|
|||||||
if (stereoVisual) {
|
if (stereoVisual) {
|
||||||
glSettings.flags |= GHOST_glStereoVisual;
|
glSettings.flags |= GHOST_glStereoVisual;
|
||||||
}
|
}
|
||||||
glSettings.context_type = GHOST_kDrawingContextTypeOpenGL;
|
|
||||||
/* NOTE: don't use #getCurrentDisplaySetting() because on X11 we may
|
/* NOTE: don't use #getCurrentDisplaySetting() because on X11 we may
|
||||||
* be zoomed in and the desktop may be bigger than the viewport. */
|
* be zoomed in and the desktop may be bigger than the viewport. */
|
||||||
GHOST_ASSERT(m_displayManager,
|
GHOST_ASSERT(m_displayManager,
|
||||||
@@ -396,6 +395,7 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
|
|||||||
settings.xPixels,
|
settings.xPixels,
|
||||||
settings.yPixels,
|
settings.yPixels,
|
||||||
GHOST_kWindowStateNormal,
|
GHOST_kWindowStateNormal,
|
||||||
|
GHOST_kDrawingContextTypeOpenGL,
|
||||||
glSettings,
|
glSettings,
|
||||||
true /* exclusive */);
|
true /* exclusive */);
|
||||||
return (*window == nullptr) ? GHOST_kFailure : GHOST_kSuccess;
|
return (*window == nullptr) ? GHOST_kFailure : GHOST_kSuccess;
|
||||||
|
@@ -77,6 +77,7 @@ class GHOST_SystemCocoa : public GHOST_System {
|
|||||||
* \param width: The width the window.
|
* \param width: The width the window.
|
||||||
* \param height: The height the window.
|
* \param height: The height the window.
|
||||||
* \param state: The state of the window when opened.
|
* \param state: The state of the window when opened.
|
||||||
|
* \param type: The type of drawing context installed in this window.
|
||||||
* \param glSettings: Misc OpenGL settings.
|
* \param glSettings: Misc OpenGL settings.
|
||||||
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
|
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
|
||||||
* \param parentWindow: Parent (embedder) window.
|
* \param parentWindow: Parent (embedder) window.
|
||||||
@@ -88,6 +89,7 @@ class GHOST_SystemCocoa : public GHOST_System {
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool exclusive = false,
|
const bool exclusive = false,
|
||||||
const bool is_dialog = false,
|
const bool is_dialog = false,
|
||||||
|
@@ -689,6 +689,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool exclusive,
|
const bool exclusive,
|
||||||
const bool is_dialog,
|
const bool is_dialog,
|
||||||
@@ -718,7 +719,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
state,
|
state,
|
||||||
glSettings.context_type,
|
type,
|
||||||
glSettings.flags & GHOST_glStereoVisual,
|
glSettings.flags & GHOST_glStereoVisual,
|
||||||
glSettings.flags & GHOST_glDebugContext,
|
glSettings.flags & GHOST_glDebugContext,
|
||||||
is_dialog,
|
is_dialog,
|
||||||
@@ -750,7 +751,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
|
|||||||
*/
|
*/
|
||||||
GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext(GHOST_GLSettings glSettings)
|
GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext(GHOST_GLSettings glSettings)
|
||||||
{
|
{
|
||||||
GHOST_Context *context = new GHOST_ContextCGL(false, NULL, NULL, NULL, glSettings.context_type);
|
GHOST_Context *context = new GHOST_ContextCGL(false, NULL, NULL, NULL);
|
||||||
if (context->initializeDrawingContext())
|
if (context->initializeDrawingContext())
|
||||||
return context;
|
return context;
|
||||||
else
|
else
|
||||||
|
@@ -142,6 +142,7 @@ class GHOST_SystemHeadless : public GHOST_System {
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool /*exclusive*/,
|
const bool /*exclusive*/,
|
||||||
const bool /*is_dialog*/,
|
const bool /*is_dialog*/,
|
||||||
@@ -154,7 +155,7 @@ class GHOST_SystemHeadless : public GHOST_System {
|
|||||||
height,
|
height,
|
||||||
state,
|
state,
|
||||||
parentWindow,
|
parentWindow,
|
||||||
glSettings.context_type,
|
type,
|
||||||
((glSettings.flags & GHOST_glStereoVisual) != 0));
|
((glSettings.flags & GHOST_glStereoVisual) != 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,6 +42,7 @@ GHOST_IWindow *GHOST_SystemSDL::createWindow(const char *title,
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool exclusive,
|
const bool exclusive,
|
||||||
const bool /* is_dialog */,
|
const bool /* is_dialog */,
|
||||||
@@ -56,7 +57,7 @@ GHOST_IWindow *GHOST_SystemSDL::createWindow(const char *title,
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
state,
|
state,
|
||||||
glSettings.context_type,
|
type,
|
||||||
((glSettings.flags & GHOST_glStereoVisual) != 0),
|
((glSettings.flags & GHOST_glStereoVisual) != 0),
|
||||||
exclusive,
|
exclusive,
|
||||||
parentWindow);
|
parentWindow);
|
||||||
|
@@ -71,6 +71,7 @@ class GHOST_SystemSDL : public GHOST_System {
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool exclusive = false,
|
const bool exclusive = false,
|
||||||
const bool is_dialog = false,
|
const bool is_dialog = false,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -21,12 +21,18 @@
|
|||||||
# include <wayland_dynload_libdecor.h>
|
# include <wayland_dynload_libdecor.h>
|
||||||
# endif
|
# endif
|
||||||
# include <libdecor.h>
|
# include <libdecor.h>
|
||||||
|
#else
|
||||||
|
/* Generated by `wayland-scanner`. */
|
||||||
|
# include <xdg-decoration-unstable-v1-client-protocol.h>
|
||||||
|
# include <xdg-shell-client-protocol.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class GHOST_WindowWayland;
|
class GHOST_WindowWayland;
|
||||||
|
|
||||||
|
struct GWL_Display;
|
||||||
|
|
||||||
bool ghost_wl_output_own(const struct wl_output *wl_output);
|
bool ghost_wl_output_own(const struct wl_output *wl_output);
|
||||||
void ghost_wl_output_tag(struct wl_output *wl_output);
|
void ghost_wl_output_tag(struct wl_output *wl_output);
|
||||||
struct GWL_Output *ghost_wl_output_user_data(struct wl_output *wl_output);
|
struct GWL_Output *ghost_wl_output_user_data(struct wl_output *wl_output);
|
||||||
@@ -46,8 +52,7 @@ void ghost_wl_surface_tag_cursor_tablet(struct wl_surface *surface);
|
|||||||
* Return true when all required WAYLAND libraries are present,
|
* Return true when all required WAYLAND libraries are present,
|
||||||
* Performs dynamic loading when `WITH_GHOST_WAYLAND_DYNLOAD` is in use.
|
* Performs dynamic loading when `WITH_GHOST_WAYLAND_DYNLOAD` is in use.
|
||||||
*/
|
*/
|
||||||
bool ghost_wl_dynload_libraries_init();
|
bool ghost_wl_dynload_libraries();
|
||||||
void ghost_wl_dynload_libraries_exit();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct GWL_Output {
|
struct GWL_Output {
|
||||||
@@ -128,6 +133,7 @@ class GHOST_SystemWayland : public GHOST_System {
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool exclusive,
|
const bool exclusive,
|
||||||
const bool is_dialog,
|
const bool is_dialog,
|
||||||
@@ -156,23 +162,24 @@ class GHOST_SystemWayland : public GHOST_System {
|
|||||||
|
|
||||||
/* WAYLAND direct-data access. */
|
/* WAYLAND direct-data access. */
|
||||||
|
|
||||||
struct wl_display *wl_display();
|
wl_display *display();
|
||||||
struct wl_compositor *wl_compositor();
|
|
||||||
|
wl_compositor *compositor();
|
||||||
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
libdecor *libdecor_context();
|
libdecor *decor_context();
|
||||||
|
#else
|
||||||
|
xdg_wm_base *xdg_shell();
|
||||||
|
zxdg_decoration_manager_v1 *xdg_decoration_manager();
|
||||||
#endif
|
#endif
|
||||||
struct xdg_wm_base *xdg_decor_shell();
|
|
||||||
struct zxdg_decoration_manager_v1 *xdg_decor_manager();
|
|
||||||
/* End `xdg_decor`. */
|
|
||||||
|
|
||||||
const std::vector<GWL_Output *> &outputs() const;
|
const std::vector<GWL_Output *> &outputs() const;
|
||||||
|
|
||||||
struct wl_shm *wl_shm() const;
|
wl_shm *shm() const;
|
||||||
|
|
||||||
/* WAYLAND utility functions. */
|
/* WAYLAND utility functions. */
|
||||||
|
|
||||||
void clipboard_set(const std::string &clipboard);
|
void selection_set(const std::string &selection);
|
||||||
|
|
||||||
/** Clear all references to this surface to prevent accessing NULL pointers. */
|
/** Clear all references to this surface to prevent accessing NULL pointers. */
|
||||||
void window_surface_unref(const wl_surface *wl_surface);
|
void window_surface_unref(const wl_surface *wl_surface);
|
||||||
@@ -185,11 +192,7 @@ class GHOST_SystemWayland : public GHOST_System {
|
|||||||
wl_surface *wl_surface,
|
wl_surface *wl_surface,
|
||||||
int scale);
|
int scale);
|
||||||
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
|
||||||
static bool use_libdecor_runtime();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct GWL_Display *display_;
|
struct GWL_Display *d;
|
||||||
std::string clipboard_;
|
std::string selection;
|
||||||
};
|
};
|
||||||
|
@@ -213,6 +213,7 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title,
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool exclusive,
|
const bool exclusive,
|
||||||
const bool is_dialog,
|
const bool is_dialog,
|
||||||
@@ -226,7 +227,7 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title,
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
state,
|
state,
|
||||||
glSettings.context_type,
|
type,
|
||||||
((glSettings.flags & GHOST_glStereoVisual) != 0),
|
((glSettings.flags & GHOST_glStereoVisual) != 0),
|
||||||
false,
|
false,
|
||||||
(GHOST_WindowWin32 *)parentWindow,
|
(GHOST_WindowWin32 *)parentWindow,
|
||||||
|
@@ -103,6 +103,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
|||||||
* \param width: The width the window.
|
* \param width: The width the window.
|
||||||
* \param height: The height the window.
|
* \param height: The height the window.
|
||||||
* \param state: The state of the window when opened.
|
* \param state: The state of the window when opened.
|
||||||
|
* \param type: The type of drawing context installed in this window.
|
||||||
* \param glSettings: Misc OpenGL settings.
|
* \param glSettings: Misc OpenGL settings.
|
||||||
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
|
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
|
||||||
* \param parentWindow: Parent window.
|
* \param parentWindow: Parent window.
|
||||||
@@ -114,6 +115,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool exclusive = false,
|
const bool exclusive = false,
|
||||||
const bool is_dialog = false,
|
const bool is_dialog = false,
|
||||||
|
@@ -308,6 +308,7 @@ void GHOST_SystemX11::getAllDisplayDimensions(uint32_t &width, uint32_t &height)
|
|||||||
* \param width: The width the window.
|
* \param width: The width the window.
|
||||||
* \param height: The height the window.
|
* \param height: The height the window.
|
||||||
* \param state: The state of the window when opened.
|
* \param state: The state of the window when opened.
|
||||||
|
* \param type: The type of drawing context installed in this window.
|
||||||
* \param glSettings: Misc OpenGL settings.
|
* \param glSettings: Misc OpenGL settings.
|
||||||
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
|
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
|
||||||
* \param parentWindow: Parent window.
|
* \param parentWindow: Parent window.
|
||||||
@@ -319,6 +320,7 @@ GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title,
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool exclusive,
|
const bool exclusive,
|
||||||
const bool is_dialog,
|
const bool is_dialog,
|
||||||
@@ -339,7 +341,7 @@ GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title,
|
|||||||
height,
|
height,
|
||||||
state,
|
state,
|
||||||
(GHOST_WindowX11 *)parentWindow,
|
(GHOST_WindowX11 *)parentWindow,
|
||||||
glSettings.context_type,
|
type,
|
||||||
is_dialog,
|
is_dialog,
|
||||||
((glSettings.flags & GHOST_glStereoVisual) != 0),
|
((glSettings.flags & GHOST_glStereoVisual) != 0),
|
||||||
exclusive,
|
exclusive,
|
||||||
@@ -2433,11 +2435,11 @@ GHOST_TSuccess GHOST_SystemX11::showMessageBox(const char *title,
|
|||||||
utf8Str,
|
utf8Str,
|
||||||
8,
|
8,
|
||||||
PropModeReplace,
|
PropModeReplace,
|
||||||
(const uchar *)title,
|
(const unsigned char *)title,
|
||||||
int(strlen(title)));
|
int(strlen(title)));
|
||||||
|
|
||||||
XChangeProperty(
|
XChangeProperty(
|
||||||
m_display, window, winType, XA_ATOM, 32, PropModeReplace, (uchar *)&typeDialog, 1);
|
m_display, window, winType, XA_ATOM, 32, PropModeReplace, (unsigned char *)&typeDialog, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create buttons GC */
|
/* Create buttons GC */
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
#include "../GHOST_Types.h"
|
#include "../GHOST_Types.h"
|
||||||
#include "GHOST_System.h"
|
#include "GHOST_System.h"
|
||||||
|
|
||||||
/* For tablets. */
|
// For tablets
|
||||||
#ifdef WITH_X11_XINPUT
|
#ifdef WITH_X11_XINPUT
|
||||||
# include <X11/extensions/XInput.h>
|
# include <X11/extensions/XInput.h>
|
||||||
|
|
||||||
@@ -113,6 +113,7 @@ class GHOST_SystemX11 : public GHOST_System {
|
|||||||
* \param width: The width the window.
|
* \param width: The width the window.
|
||||||
* \param height: The height the window.
|
* \param height: The height the window.
|
||||||
* \param state: The state of the window when opened.
|
* \param state: The state of the window when opened.
|
||||||
|
* \param type: The type of drawing context installed in this window.
|
||||||
* \param stereoVisual: Create a stereo visual for quad buffered stereo.
|
* \param stereoVisual: Create a stereo visual for quad buffered stereo.
|
||||||
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
|
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
|
||||||
* \param parentWindow: Parent (embedder) window.
|
* \param parentWindow: Parent (embedder) window.
|
||||||
@@ -124,6 +125,7 @@ class GHOST_SystemX11 : public GHOST_System {
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
const bool exclusive = false,
|
const bool exclusive = false,
|
||||||
const bool is_dialog = false,
|
const bool is_dialog = false,
|
||||||
|
@@ -803,10 +803,10 @@ GHOST_TSuccess GHOST_WindowCocoa::setOrder(GHOST_TWindowOrder order)
|
|||||||
|
|
||||||
GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType type)
|
GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType type)
|
||||||
{
|
{
|
||||||
if (type == GHOST_kDrawingContextTypeOpenGL || type == GHOST_kDrawingContextTypeMetal) {
|
if (type == GHOST_kDrawingContextTypeOpenGL) {
|
||||||
|
|
||||||
GHOST_Context *context = new GHOST_ContextCGL(
|
GHOST_Context *context = new GHOST_ContextCGL(
|
||||||
m_wantStereoVisual, m_metalView, m_metalLayer, m_openGLView, type);
|
m_wantStereoVisual, m_metalView, m_metalLayer, m_openGLView);
|
||||||
|
|
||||||
if (context->initializeDrawingContext())
|
if (context->initializeDrawingContext())
|
||||||
return context;
|
return context;
|
||||||
|
@@ -31,54 +31,15 @@
|
|||||||
# include <libdecor.h>
|
# include <libdecor.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Generated by `wayland-scanner`. */
|
|
||||||
#include <xdg-decoration-unstable-v1-client-protocol.h>
|
|
||||||
#include <xdg-shell-client-protocol.h>
|
|
||||||
|
|
||||||
/* Logging, use `ghost.wl.*` prefix. */
|
/* Logging, use `ghost.wl.*` prefix. */
|
||||||
#include "CLG_log.h"
|
#include "CLG_log.h"
|
||||||
|
|
||||||
static constexpr size_t base_dpi = 96;
|
static constexpr size_t base_dpi = 96;
|
||||||
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
|
||||||
/* Access `use_libdecor` in #GHOST_SystemWayland. */
|
|
||||||
# define use_libdecor GHOST_SystemWayland::use_libdecor_runtime()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static GHOST_WindowManager *window_manager = nullptr;
|
static GHOST_WindowManager *window_manager = nullptr;
|
||||||
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
|
||||||
struct WGL_LibDecor_Window {
|
|
||||||
struct libdecor_frame *frame = nullptr;
|
|
||||||
bool configured = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void wgl_libdecor_window_destroy(WGL_LibDecor_Window *decor)
|
|
||||||
{
|
|
||||||
libdecor_frame_unref(decor->frame);
|
|
||||||
delete decor;
|
|
||||||
}
|
|
||||||
#endif /* WITH_GHOST_WAYLAND_LIBDECOR */
|
|
||||||
|
|
||||||
struct WGL_XDG_Decor_Window {
|
|
||||||
struct xdg_surface *surface = nullptr;
|
|
||||||
struct zxdg_toplevel_decoration_v1 *toplevel_decor = nullptr;
|
|
||||||
struct xdg_toplevel *toplevel = nullptr;
|
|
||||||
enum zxdg_toplevel_decoration_v1_mode mode = (enum zxdg_toplevel_decoration_v1_mode)0;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void wgl_xdg_decor_window_destroy(WGL_XDG_Decor_Window *decor)
|
|
||||||
{
|
|
||||||
if (decor->toplevel_decor) {
|
|
||||||
zxdg_toplevel_decoration_v1_destroy(decor->toplevel_decor);
|
|
||||||
}
|
|
||||||
xdg_toplevel_destroy(decor->toplevel);
|
|
||||||
xdg_surface_destroy(decor->surface);
|
|
||||||
delete decor;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct GWL_Window {
|
struct GWL_Window {
|
||||||
GHOST_WindowWayland *ghost_window = nullptr;
|
GHOST_WindowWayland *w = nullptr;
|
||||||
struct wl_surface *wl_surface = nullptr;
|
struct wl_surface *wl_surface = nullptr;
|
||||||
/**
|
/**
|
||||||
* Outputs on which the window is currently shown on.
|
* Outputs on which the window is currently shown on.
|
||||||
@@ -99,9 +60,15 @@ struct GWL_Window {
|
|||||||
uint32_t dpi = 0;
|
uint32_t dpi = 0;
|
||||||
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
WGL_LibDecor_Window *libdecor = nullptr;
|
struct libdecor_frame *decor_frame = nullptr;
|
||||||
|
bool decor_configured = false;
|
||||||
|
#else
|
||||||
|
struct xdg_surface *xdg_surface = nullptr;
|
||||||
|
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration = nullptr;
|
||||||
|
struct xdg_toplevel *xdg_toplevel = nullptr;
|
||||||
|
|
||||||
|
enum zxdg_toplevel_decoration_v1_mode decoration_mode = (enum zxdg_toplevel_decoration_v1_mode)0;
|
||||||
#endif
|
#endif
|
||||||
WGL_XDG_Decor_Window *xdg_decor = nullptr;
|
|
||||||
|
|
||||||
wl_egl_window *egl_window = nullptr;
|
wl_egl_window *egl_window = nullptr;
|
||||||
bool is_maximised = false;
|
bool is_maximised = false;
|
||||||
@@ -179,8 +146,10 @@ static int outputs_max_scale_or_default(const std::vector<GWL_Output *> &outputs
|
|||||||
/** \name Listener (XDG Top Level), #xdg_toplevel_listener
|
/** \name Listener (XDG Top Level), #xdg_toplevel_listener
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
|
#ifndef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
|
|
||||||
static CLG_LogRef LOG_WL_XDG_TOPLEVEL = {"ghost.wl.handle.xdg_toplevel"};
|
static CLG_LogRef LOG_WL_XDG_TOPLEVEL = {"ghost.wl.handle.xdg_toplevel"};
|
||||||
#define LOG (&LOG_WL_XDG_TOPLEVEL)
|
# define LOG (&LOG_WL_XDG_TOPLEVEL)
|
||||||
|
|
||||||
static void xdg_toplevel_handle_configure(void *data,
|
static void xdg_toplevel_handle_configure(void *data,
|
||||||
xdg_toplevel * /*xdg_toplevel*/,
|
xdg_toplevel * /*xdg_toplevel*/,
|
||||||
@@ -220,7 +189,7 @@ static void xdg_toplevel_handle_configure(void *data,
|
|||||||
static void xdg_toplevel_handle_close(void *data, xdg_toplevel * /*xdg_toplevel*/)
|
static void xdg_toplevel_handle_close(void *data, xdg_toplevel * /*xdg_toplevel*/)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG, 2, "close");
|
CLOG_INFO(LOG, 2, "close");
|
||||||
static_cast<GWL_Window *>(data)->ghost_window->close();
|
static_cast<GWL_Window *>(data)->w->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const xdg_toplevel_listener toplevel_listener = {
|
static const xdg_toplevel_listener toplevel_listener = {
|
||||||
@@ -228,7 +197,9 @@ static const xdg_toplevel_listener toplevel_listener = {
|
|||||||
xdg_toplevel_handle_close,
|
xdg_toplevel_handle_close,
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef LOG
|
# undef LOG
|
||||||
|
|
||||||
|
#endif /* !WITH_GHOST_WAYLAND_LIBDECOR. */
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
@@ -263,7 +234,7 @@ static void frame_handle_configure(struct libdecor_frame *frame,
|
|||||||
win->size[1] = win->scale * size_next[1];
|
win->size[1] = win->scale * size_next[1];
|
||||||
|
|
||||||
wl_egl_window_resize(win->egl_window, UNPACK2(win->size), 0, 0);
|
wl_egl_window_resize(win->egl_window, UNPACK2(win->size), 0, 0);
|
||||||
win->ghost_window->notify_size();
|
win->w->notify_size();
|
||||||
|
|
||||||
if (!libdecor_configuration_get_window_state(configuration, &window_state)) {
|
if (!libdecor_configuration_get_window_state(configuration, &window_state)) {
|
||||||
window_state = LIBDECOR_WINDOW_STATE_NONE;
|
window_state = LIBDECOR_WINDOW_STATE_NONE;
|
||||||
@@ -273,20 +244,20 @@ static void frame_handle_configure(struct libdecor_frame *frame,
|
|||||||
win->is_fullscreen = window_state & LIBDECOR_WINDOW_STATE_FULLSCREEN;
|
win->is_fullscreen = window_state & LIBDECOR_WINDOW_STATE_FULLSCREEN;
|
||||||
win->is_active = window_state & LIBDECOR_WINDOW_STATE_ACTIVE;
|
win->is_active = window_state & LIBDECOR_WINDOW_STATE_ACTIVE;
|
||||||
|
|
||||||
win->is_active ? win->ghost_window->activate() : win->ghost_window->deactivate();
|
win->is_active ? win->w->activate() : win->w->deactivate();
|
||||||
|
|
||||||
state = libdecor_state_new(UNPACK2(size_next));
|
state = libdecor_state_new(UNPACK2(size_next));
|
||||||
libdecor_frame_commit(frame, state, configuration);
|
libdecor_frame_commit(frame, state, configuration);
|
||||||
libdecor_state_free(state);
|
libdecor_state_free(state);
|
||||||
|
|
||||||
win->libdecor->configured = true;
|
win->decor_configured = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void frame_handle_close(struct libdecor_frame * /*frame*/, void *data)
|
static void frame_handle_close(struct libdecor_frame * /*frame*/, void *data)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG, 2, "close");
|
CLOG_INFO(LOG, 2, "close");
|
||||||
|
|
||||||
static_cast<GWL_Window *>(data)->ghost_window->close();
|
static_cast<GWL_Window *>(data)->w->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void frame_handle_commit(struct libdecor_frame * /*frame*/, void *data)
|
static void frame_handle_commit(struct libdecor_frame * /*frame*/, void *data)
|
||||||
@@ -294,8 +265,8 @@ static void frame_handle_commit(struct libdecor_frame * /*frame*/, void *data)
|
|||||||
CLOG_INFO(LOG, 2, "commit");
|
CLOG_INFO(LOG, 2, "commit");
|
||||||
|
|
||||||
/* We have to swap twice to keep any pop-up menus alive. */
|
/* We have to swap twice to keep any pop-up menus alive. */
|
||||||
static_cast<GWL_Window *>(data)->ghost_window->swapBuffers();
|
static_cast<GWL_Window *>(data)->w->swapBuffers();
|
||||||
static_cast<GWL_Window *>(data)->ghost_window->swapBuffers();
|
static_cast<GWL_Window *>(data)->w->swapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct libdecor_frame_interface libdecor_frame_iface = {
|
static struct libdecor_frame_interface libdecor_frame_iface = {
|
||||||
@@ -314,8 +285,10 @@ static struct libdecor_frame_interface libdecor_frame_iface = {
|
|||||||
/** \name Listener (XDG Decoration Listener), #zxdg_toplevel_decoration_v1_listener
|
/** \name Listener (XDG Decoration Listener), #zxdg_toplevel_decoration_v1_listener
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
|
#ifndef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
|
|
||||||
static CLG_LogRef LOG_WL_XDG_TOPLEVEL_DECORATION = {"ghost.wl.handle.xdg_toplevel_decoration"};
|
static CLG_LogRef LOG_WL_XDG_TOPLEVEL_DECORATION = {"ghost.wl.handle.xdg_toplevel_decoration"};
|
||||||
#define LOG (&LOG_WL_XDG_TOPLEVEL_DECORATION)
|
# define LOG (&LOG_WL_XDG_TOPLEVEL_DECORATION)
|
||||||
|
|
||||||
static void xdg_toplevel_decoration_handle_configure(
|
static void xdg_toplevel_decoration_handle_configure(
|
||||||
void *data,
|
void *data,
|
||||||
@@ -323,14 +296,16 @@ static void xdg_toplevel_decoration_handle_configure(
|
|||||||
const uint32_t mode)
|
const uint32_t mode)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG, 2, "configure (mode=%u)", mode);
|
CLOG_INFO(LOG, 2, "configure (mode=%u)", mode);
|
||||||
static_cast<GWL_Window *>(data)->xdg_decor->mode = (zxdg_toplevel_decoration_v1_mode)mode;
|
static_cast<GWL_Window *>(data)->decoration_mode = (zxdg_toplevel_decoration_v1_mode)mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const zxdg_toplevel_decoration_v1_listener toplevel_decoration_v1_listener = {
|
static const zxdg_toplevel_decoration_v1_listener toplevel_decoration_v1_listener = {
|
||||||
xdg_toplevel_decoration_handle_configure,
|
xdg_toplevel_decoration_handle_configure,
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef LOG
|
# undef LOG
|
||||||
|
|
||||||
|
#endif /* !WITH_GHOST_WAYLAND_LIBDECOR. */
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
@@ -338,8 +313,10 @@ static const zxdg_toplevel_decoration_v1_listener toplevel_decoration_v1_listene
|
|||||||
/** \name Listener (XDG Surface Handle Configure), #xdg_surface_listener
|
/** \name Listener (XDG Surface Handle Configure), #xdg_surface_listener
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
|
#ifndef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
|
|
||||||
static CLG_LogRef LOG_WL_XDG_SURFACE = {"ghost.wl.handle.xdg_surface"};
|
static CLG_LogRef LOG_WL_XDG_SURFACE = {"ghost.wl.handle.xdg_surface"};
|
||||||
#define LOG (&LOG_WL_XDG_SURFACE)
|
# define LOG (&LOG_WL_XDG_SURFACE)
|
||||||
|
|
||||||
static void xdg_surface_handle_configure(void *data,
|
static void xdg_surface_handle_configure(void *data,
|
||||||
xdg_surface *xdg_surface,
|
xdg_surface *xdg_surface,
|
||||||
@@ -347,7 +324,7 @@ static void xdg_surface_handle_configure(void *data,
|
|||||||
{
|
{
|
||||||
GWL_Window *win = static_cast<GWL_Window *>(data);
|
GWL_Window *win = static_cast<GWL_Window *>(data);
|
||||||
|
|
||||||
if (win->xdg_decor->surface != xdg_surface) {
|
if (win->xdg_surface != xdg_surface) {
|
||||||
CLOG_INFO(LOG, 2, "configure (skipped)");
|
CLOG_INFO(LOG, 2, "configure (skipped)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -360,14 +337,14 @@ static void xdg_surface_handle_configure(void *data,
|
|||||||
wl_egl_window_resize(win->egl_window, UNPACK2(win->size), 0, 0);
|
wl_egl_window_resize(win->egl_window, UNPACK2(win->size), 0, 0);
|
||||||
win->size_pending[0] = 0;
|
win->size_pending[0] = 0;
|
||||||
win->size_pending[1] = 0;
|
win->size_pending[1] = 0;
|
||||||
win->ghost_window->notify_size();
|
win->w->notify_size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (win->is_active) {
|
if (win->is_active) {
|
||||||
win->ghost_window->activate();
|
win->w->activate();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
win->ghost_window->deactivate();
|
win->w->deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
xdg_surface_ack_configure(xdg_surface, serial);
|
xdg_surface_ack_configure(xdg_surface, serial);
|
||||||
@@ -377,7 +354,9 @@ static const xdg_surface_listener xdg_surface_listener = {
|
|||||||
xdg_surface_handle_configure,
|
xdg_surface_handle_configure,
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef LOG
|
# undef LOG
|
||||||
|
|
||||||
|
#endif /* !WITH_GHOST_WAYLAND_LIBDECOR. */
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
@@ -439,7 +418,7 @@ static struct wl_surface_listener wl_surface_listener = {
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::hasCursorShape(GHOST_TStandardCursor cursorShape)
|
GHOST_TSuccess GHOST_WindowWayland::hasCursorShape(GHOST_TStandardCursor cursorShape)
|
||||||
{
|
{
|
||||||
return system_->hasCursorShape(cursorShape);
|
return m_system->hasCursorShape(cursorShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
||||||
@@ -455,20 +434,20 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
|||||||
const bool stereoVisual,
|
const bool stereoVisual,
|
||||||
const bool exclusive)
|
const bool exclusive)
|
||||||
: GHOST_Window(width, height, state, stereoVisual, exclusive),
|
: GHOST_Window(width, height, state, stereoVisual, exclusive),
|
||||||
system_(system),
|
m_system(system),
|
||||||
window_(new GWL_Window)
|
w(new GWL_Window)
|
||||||
{
|
{
|
||||||
/* Globally store pointer to window manager. */
|
/* Globally store pointer to window manager. */
|
||||||
if (!window_manager) {
|
if (!window_manager) {
|
||||||
window_manager = system_->getWindowManager();
|
window_manager = m_system->getWindowManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
window_->ghost_window = this;
|
w->w = this;
|
||||||
|
|
||||||
window_->size[0] = int32_t(width);
|
w->size[0] = int32_t(width);
|
||||||
window_->size[1] = int32_t(height);
|
w->size[1] = int32_t(height);
|
||||||
|
|
||||||
window_->is_dialog = is_dialog;
|
w->is_dialog = is_dialog;
|
||||||
|
|
||||||
/* NOTE(@campbellbarton): The scale set here to avoid flickering on startup.
|
/* NOTE(@campbellbarton): The scale set here to avoid flickering on startup.
|
||||||
* When all monitors use the same scale (which is quite common) there aren't any problems.
|
* When all monitors use the same scale (which is quite common) there aren't any problems.
|
||||||
@@ -479,100 +458,75 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
|||||||
*
|
*
|
||||||
* Using the maximum scale is best as it results in the window first being smaller,
|
* Using the maximum scale is best as it results in the window first being smaller,
|
||||||
* avoiding a large window flashing before it's made smaller. */
|
* avoiding a large window flashing before it's made smaller. */
|
||||||
window_->scale = outputs_max_scale_or_default(system_->outputs(), 1, &window_->dpi);
|
w->scale = outputs_max_scale_or_default(this->m_system->outputs(), 1, &w->dpi);
|
||||||
|
|
||||||
/* Window surfaces. */
|
/* Window surfaces. */
|
||||||
window_->wl_surface = wl_compositor_create_surface(system_->wl_compositor());
|
w->wl_surface = wl_compositor_create_surface(m_system->compositor());
|
||||||
ghost_wl_surface_tag(window_->wl_surface);
|
ghost_wl_surface_tag(w->wl_surface);
|
||||||
|
|
||||||
wl_surface_set_buffer_scale(window_->wl_surface, window_->scale);
|
wl_surface_set_buffer_scale(w->wl_surface, w->scale);
|
||||||
|
|
||||||
wl_surface_add_listener(window_->wl_surface, &wl_surface_listener, this);
|
wl_surface_add_listener(w->wl_surface, &wl_surface_listener, this);
|
||||||
|
|
||||||
window_->egl_window = wl_egl_window_create(
|
w->egl_window = wl_egl_window_create(w->wl_surface, int(w->size[0]), int(w->size[1]));
|
||||||
window_->wl_surface, int(window_->size[0]), int(window_->size[1]));
|
|
||||||
|
|
||||||
/* NOTE: The limit is in points (not pixels) so Hi-DPI will limit to larger number of pixels.
|
/* NOTE: The limit is in points (not pixels) so Hi-DPI will limit to larger number of pixels.
|
||||||
* This has the advantage that the size limit is the same when moving the window between monitors
|
* This has the advantage that the size limit is the same when moving the window between monitors
|
||||||
* with different scales set. If it was important to limit in pixels it could be re-calculated
|
* with different scales set. If it was important to limit in pixels it could be re-calculated
|
||||||
* when the `window_->scale` changed. */
|
* when the `w->scale` changed. */
|
||||||
const int32_t size_min[2] = {320, 240};
|
const int32_t size_min[2] = {320, 240};
|
||||||
|
|
||||||
/* This value is expected to match the base name of the `.desktop` file. see T101805.
|
|
||||||
*
|
|
||||||
* NOTE: the XDG desktop-entry-spec defines that this should follow the "reverse DNS" convention.
|
|
||||||
* For e.g. `org.blender.Blender` - however the `.desktop` file distributed with Blender is
|
|
||||||
* simply called `blender.desktop`, so the it's important to follow that name.
|
|
||||||
* Other distributions such as SNAP & FLATPAK may need to change this value T101779.
|
|
||||||
* Currently there isn't a way to configure this, we may want to support that. */
|
|
||||||
const char *xdg_app_id = "blender";
|
|
||||||
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
/* create window decorations */
|
||||||
window_->libdecor = new WGL_LibDecor_Window;
|
w->decor_frame = libdecor_decorate(
|
||||||
WGL_LibDecor_Window &decor = *window_->libdecor;
|
m_system->decor_context(), w->wl_surface, &libdecor_frame_iface, w);
|
||||||
|
libdecor_frame_map(w->decor_frame);
|
||||||
|
|
||||||
/* create window decorations */
|
libdecor_frame_set_min_content_size(w->decor_frame, UNPACK2(size_min));
|
||||||
decor.frame = libdecor_decorate(
|
|
||||||
system_->libdecor_context(), window_->wl_surface, &libdecor_frame_iface, window_);
|
|
||||||
libdecor_frame_map(window_->libdecor->frame);
|
|
||||||
|
|
||||||
libdecor_frame_set_min_content_size(decor.frame, UNPACK2(size_min));
|
if (parentWindow) {
|
||||||
libdecor_frame_set_app_id(decor.frame, xdg_app_id);
|
libdecor_frame_set_parent(
|
||||||
|
w->decor_frame, dynamic_cast<const GHOST_WindowWayland *>(parentWindow)->w->decor_frame);
|
||||||
if (parentWindow) {
|
|
||||||
WGL_LibDecor_Window &decor_parent =
|
|
||||||
*dynamic_cast<const GHOST_WindowWayland *>(parentWindow)->window_->libdecor;
|
|
||||||
libdecor_frame_set_parent(decor.frame, decor_parent.frame);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
#endif
|
w->xdg_surface = xdg_wm_base_get_xdg_surface(m_system->xdg_shell(), w->wl_surface);
|
||||||
{
|
w->xdg_toplevel = xdg_surface_get_toplevel(w->xdg_surface);
|
||||||
window_->xdg_decor = new WGL_XDG_Decor_Window;
|
|
||||||
WGL_XDG_Decor_Window &decor = *window_->xdg_decor;
|
|
||||||
decor.surface = xdg_wm_base_get_xdg_surface(system_->xdg_decor_shell(), window_->wl_surface);
|
|
||||||
decor.toplevel = xdg_surface_get_toplevel(decor.surface);
|
|
||||||
|
|
||||||
xdg_toplevel_set_min_size(decor.toplevel, UNPACK2(size_min));
|
xdg_toplevel_set_min_size(w->xdg_toplevel, UNPACK2(size_min));
|
||||||
xdg_toplevel_set_app_id(decor.toplevel, xdg_app_id);
|
|
||||||
|
|
||||||
if (system_->xdg_decor_manager()) {
|
if (m_system->xdg_decoration_manager()) {
|
||||||
decor.toplevel_decor = zxdg_decoration_manager_v1_get_toplevel_decoration(
|
w->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(
|
||||||
system_->xdg_decor_manager(), decor.toplevel);
|
m_system->xdg_decoration_manager(), w->xdg_toplevel);
|
||||||
zxdg_toplevel_decoration_v1_add_listener(
|
zxdg_toplevel_decoration_v1_add_listener(
|
||||||
decor.toplevel_decor, &toplevel_decoration_v1_listener, window_);
|
w->xdg_toplevel_decoration, &toplevel_decoration_v1_listener, w);
|
||||||
zxdg_toplevel_decoration_v1_set_mode(decor.toplevel_decor,
|
zxdg_toplevel_decoration_v1_set_mode(w->xdg_toplevel_decoration,
|
||||||
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
||||||
}
|
|
||||||
|
|
||||||
xdg_surface_add_listener(decor.surface, &xdg_surface_listener, window_);
|
|
||||||
xdg_toplevel_add_listener(decor.toplevel, &toplevel_listener, window_);
|
|
||||||
|
|
||||||
if (parentWindow && is_dialog) {
|
|
||||||
WGL_XDG_Decor_Window &decor_parent =
|
|
||||||
*dynamic_cast<const GHOST_WindowWayland *>(parentWindow)->window_->xdg_decor;
|
|
||||||
xdg_toplevel_set_parent(decor.toplevel, decor_parent.toplevel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xdg_surface_add_listener(w->xdg_surface, &xdg_surface_listener, w);
|
||||||
|
xdg_toplevel_add_listener(w->xdg_toplevel, &toplevel_listener, w);
|
||||||
|
|
||||||
|
if (parentWindow && is_dialog) {
|
||||||
|
xdg_toplevel_set_parent(
|
||||||
|
w->xdg_toplevel, dynamic_cast<const GHOST_WindowWayland *>(parentWindow)->w->xdg_toplevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !WITH_GHOST_WAYLAND_LIBDECOR */
|
||||||
|
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
|
|
||||||
wl_surface_set_user_data(window_->wl_surface, this);
|
wl_surface_set_user_data(w->wl_surface, this);
|
||||||
|
|
||||||
/* Call top-level callbacks. */
|
/* Call top-level callbacks. */
|
||||||
wl_surface_commit(window_->wl_surface);
|
wl_surface_commit(w->wl_surface);
|
||||||
wl_display_roundtrip(system_->wl_display());
|
wl_display_roundtrip(m_system->display());
|
||||||
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
/* It's important not to return until the window is configured or
|
||||||
WGL_LibDecor_Window &decor = *window_->libdecor;
|
* calls to `setState` from Blender will crash `libdecor`. */
|
||||||
/* It's important not to return until the window is configured or
|
while (!w->decor_configured) {
|
||||||
* calls to `setState` from Blender will crash `libdecor`. */
|
if (libdecor_dispatch(m_system->decor_context(), 0) < 0) {
|
||||||
while (!decor.configured) {
|
break;
|
||||||
if (libdecor_dispatch(system_->libdecor_context(), 0) < 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -581,13 +535,9 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
|||||||
setOpaque();
|
setOpaque();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Causes a glitch with `libdecor` for some reason. */
|
#ifndef WITH_GHOST_WAYLAND_LIBDECOR /* Causes a glitch with `libdecor` for some reason. */
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
setState(state);
|
||||||
if (use_libdecor == false)
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
setState(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EGL context. */
|
/* EGL context. */
|
||||||
if (setDrawingContextType(type) == GHOST_kFailure) {
|
if (setDrawingContextType(type) == GHOST_kFailure) {
|
||||||
@@ -608,13 +558,13 @@ GHOST_TSuccess GHOST_WindowWayland::setWindowCursorGrab(GHOST_TGrabCursorMode mo
|
|||||||
}
|
}
|
||||||
bounds = &bounds_buf;
|
bounds = &bounds_buf;
|
||||||
}
|
}
|
||||||
if (system_->window_cursor_grab_set(mode,
|
if (m_system->window_cursor_grab_set(mode,
|
||||||
m_cursorGrab,
|
m_cursorGrab,
|
||||||
m_cursorGrabInitPos,
|
m_cursorGrabInitPos,
|
||||||
bounds,
|
bounds,
|
||||||
m_cursorGrabAxis,
|
m_cursorGrabAxis,
|
||||||
window_->wl_surface,
|
w->wl_surface,
|
||||||
window_->scale)) {
|
w->scale)) {
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
@@ -622,47 +572,43 @@ GHOST_TSuccess GHOST_WindowWayland::setWindowCursorGrab(GHOST_TGrabCursorMode mo
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::setWindowCursorShape(GHOST_TStandardCursor shape)
|
GHOST_TSuccess GHOST_WindowWayland::setWindowCursorShape(GHOST_TStandardCursor shape)
|
||||||
{
|
{
|
||||||
const GHOST_TSuccess ok = system_->setCursorShape(shape);
|
const GHOST_TSuccess ok = m_system->setCursorShape(shape);
|
||||||
m_cursorShape = (ok == GHOST_kSuccess) ? shape : GHOST_kStandardCursorDefault;
|
m_cursorShape = (ok == GHOST_kSuccess) ? shape : GHOST_kStandardCursorDefault;
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GHOST_WindowWayland::getCursorGrabUseSoftwareDisplay()
|
bool GHOST_WindowWayland::getCursorGrabUseSoftwareDisplay()
|
||||||
{
|
{
|
||||||
return system_->getCursorGrabUseSoftwareDisplay(m_cursorGrab);
|
return m_system->getCursorGrabUseSoftwareDisplay(m_cursorGrab);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::setWindowCustomCursorShape(
|
GHOST_TSuccess GHOST_WindowWayland::setWindowCustomCursorShape(
|
||||||
uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
|
uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
|
||||||
{
|
{
|
||||||
return system_->setCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, canInvertColor);
|
return m_system->setCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, canInvertColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::getCursorBitmap(GHOST_CursorBitmapRef *bitmap)
|
GHOST_TSuccess GHOST_WindowWayland::getCursorBitmap(GHOST_CursorBitmapRef *bitmap)
|
||||||
{
|
{
|
||||||
return system_->getCursorBitmap(bitmap);
|
return m_system->getCursorBitmap(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_WindowWayland::setTitle(const char *title)
|
void GHOST_WindowWayland::setTitle(const char *title)
|
||||||
{
|
{
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
libdecor_frame_set_app_id(w->decor_frame, title);
|
||||||
WGL_LibDecor_Window &decor = *window_->libdecor;
|
libdecor_frame_set_title(w->decor_frame, title);
|
||||||
libdecor_frame_set_title(decor.frame, title);
|
#else
|
||||||
}
|
xdg_toplevel_set_title(w->xdg_toplevel, title);
|
||||||
else
|
xdg_toplevel_set_app_id(w->xdg_toplevel, title);
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
WGL_XDG_Decor_Window &decor = *window_->xdg_decor;
|
|
||||||
xdg_toplevel_set_title(decor.toplevel, title);
|
|
||||||
}
|
|
||||||
|
|
||||||
title_ = title;
|
this->title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GHOST_WindowWayland::getTitle() const
|
std::string GHOST_WindowWayland::getTitle() const
|
||||||
{
|
{
|
||||||
return title_.empty() ? "untitled" : title_;
|
return this->title.empty() ? "untitled" : this->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_WindowWayland::getWindowBounds(GHOST_Rect &bounds) const
|
void GHOST_WindowWayland::getWindowBounds(GHOST_Rect &bounds) const
|
||||||
@@ -672,29 +618,29 @@ void GHOST_WindowWayland::getWindowBounds(GHOST_Rect &bounds) const
|
|||||||
|
|
||||||
void GHOST_WindowWayland::getClientBounds(GHOST_Rect &bounds) const
|
void GHOST_WindowWayland::getClientBounds(GHOST_Rect &bounds) const
|
||||||
{
|
{
|
||||||
bounds.set(0, 0, UNPACK2(window_->size));
|
bounds.set(0, 0, UNPACK2(w->size));
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::setClientWidth(const uint32_t width)
|
GHOST_TSuccess GHOST_WindowWayland::setClientWidth(const uint32_t width)
|
||||||
{
|
{
|
||||||
return setClientSize(width, uint32_t(window_->size[1]));
|
return setClientSize(width, uint32_t(w->size[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::setClientHeight(const uint32_t height)
|
GHOST_TSuccess GHOST_WindowWayland::setClientHeight(const uint32_t height)
|
||||||
{
|
{
|
||||||
return setClientSize(uint32_t(window_->size[0]), height);
|
return setClientSize(uint32_t(w->size[0]), height);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::setClientSize(const uint32_t width, const uint32_t height)
|
GHOST_TSuccess GHOST_WindowWayland::setClientSize(const uint32_t width, const uint32_t height)
|
||||||
{
|
{
|
||||||
wl_egl_window_resize(window_->egl_window, int(width), int(height), 0, 0);
|
wl_egl_window_resize(w->egl_window, int(width), int(height), 0, 0);
|
||||||
|
|
||||||
/* Override any pending size that may be set. */
|
/* Override any pending size that may be set. */
|
||||||
window_->size_pending[0] = 0;
|
w->size_pending[0] = 0;
|
||||||
window_->size_pending[1] = 0;
|
w->size_pending[1] = 0;
|
||||||
|
|
||||||
window_->size[0] = width;
|
w->size[0] = width;
|
||||||
window_->size[1] = height;
|
w->size[1] = height;
|
||||||
|
|
||||||
notify_size();
|
notify_size();
|
||||||
|
|
||||||
@@ -723,40 +669,40 @@ GHOST_WindowWayland::~GHOST_WindowWayland()
|
|||||||
{
|
{
|
||||||
releaseNativeHandles();
|
releaseNativeHandles();
|
||||||
|
|
||||||
wl_egl_window_destroy(window_->egl_window);
|
wl_egl_window_destroy(w->egl_window);
|
||||||
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
libdecor_frame_unref(w->decor_frame);
|
||||||
wgl_libdecor_window_destroy(window_->libdecor);
|
#else
|
||||||
|
if (w->xdg_toplevel_decoration) {
|
||||||
|
zxdg_toplevel_decoration_v1_destroy(w->xdg_toplevel_decoration);
|
||||||
}
|
}
|
||||||
else
|
xdg_toplevel_destroy(w->xdg_toplevel);
|
||||||
|
xdg_surface_destroy(w->xdg_surface);
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
wgl_xdg_decor_window_destroy(window_->xdg_decor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear any pointers to this window. This is needed because there are no guarantees
|
/* Clear any pointers to this window. This is needed because there are no guarantees
|
||||||
* that flushing the display will the "leave" handlers before handling events. */
|
* that flushing the display will the "leave" handlers before handling events. */
|
||||||
system_->window_surface_unref(window_->wl_surface);
|
m_system->window_surface_unref(w->wl_surface);
|
||||||
|
|
||||||
wl_surface_destroy(window_->wl_surface);
|
wl_surface_destroy(w->wl_surface);
|
||||||
|
|
||||||
/* NOTE(@campbellbarton): Flushing will often run the appropriate handlers event
|
/* NOTE(@campbellbarton): Flushing will often run the appropriate handlers event
|
||||||
* (#wl_surface_listener.leave in particular) to avoid attempted access to the freed surfaces.
|
* (#wl_surface_listener.leave in particular) to avoid attempted access to the freed surfaces.
|
||||||
* This is not fool-proof though, hence the call to #window_surface_unref, see: T99078. */
|
* This is not fool-proof though, hence the call to #window_surface_unref, see: T99078. */
|
||||||
wl_display_flush(system_->wl_display());
|
wl_display_flush(m_system->display());
|
||||||
|
|
||||||
delete window_;
|
delete w;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t GHOST_WindowWayland::getDPIHint()
|
uint16_t GHOST_WindowWayland::getDPIHint()
|
||||||
{
|
{
|
||||||
return window_->dpi;
|
return w->dpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::setWindowCursorVisibility(bool visible)
|
GHOST_TSuccess GHOST_WindowWayland::setWindowCursorVisibility(bool visible)
|
||||||
{
|
{
|
||||||
return system_->setCursorVisibility(visible);
|
return m_system->setCursorVisibility(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::setState(GHOST_TWindowState state)
|
GHOST_TSuccess GHOST_WindowWayland::setState(GHOST_TWindowState state)
|
||||||
@@ -765,84 +711,57 @@ GHOST_TSuccess GHOST_WindowWayland::setState(GHOST_TWindowState state)
|
|||||||
case GHOST_kWindowStateNormal:
|
case GHOST_kWindowStateNormal:
|
||||||
/* Unset states. */
|
/* Unset states. */
|
||||||
switch (getState()) {
|
switch (getState()) {
|
||||||
case GHOST_kWindowStateMaximized: {
|
case GHOST_kWindowStateMaximized:
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
libdecor_frame_unset_maximized(w->decor_frame);
|
||||||
libdecor_frame_unset_maximized(window_->libdecor->frame);
|
#else
|
||||||
}
|
xdg_toplevel_unset_maximized(w->xdg_toplevel);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
xdg_toplevel_unset_maximized(window_->xdg_decor->toplevel);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case GHOST_kWindowStateFullScreen:
|
||||||
case GHOST_kWindowStateFullScreen: {
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
libdecor_frame_unset_fullscreen(w->decor_frame);
|
||||||
libdecor_frame_unset_fullscreen(window_->libdecor->frame);
|
#else
|
||||||
}
|
xdg_toplevel_unset_fullscreen(w->xdg_toplevel);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
xdg_toplevel_unset_fullscreen(window_->xdg_decor->toplevel);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
default: {
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GHOST_kWindowStateMaximized: {
|
case GHOST_kWindowStateMaximized:
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
libdecor_frame_set_maximized(w->decor_frame);
|
||||||
libdecor_frame_set_maximized(window_->libdecor->frame);
|
#else
|
||||||
}
|
xdg_toplevel_set_maximized(w->xdg_toplevel);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
xdg_toplevel_set_maximized(window_->xdg_decor->toplevel);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case GHOST_kWindowStateMinimized:
|
||||||
case GHOST_kWindowStateMinimized: {
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
libdecor_frame_set_minimized(w->decor_frame);
|
||||||
libdecor_frame_set_minimized(window_->libdecor->frame);
|
#else
|
||||||
}
|
xdg_toplevel_set_minimized(w->xdg_toplevel);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
xdg_toplevel_set_minimized(window_->xdg_decor->toplevel);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case GHOST_kWindowStateFullScreen:
|
||||||
case GHOST_kWindowStateFullScreen: {
|
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
libdecor_frame_set_fullscreen(w->decor_frame, nullptr);
|
||||||
libdecor_frame_set_fullscreen(window_->libdecor->frame, nullptr);
|
#else
|
||||||
}
|
xdg_toplevel_set_fullscreen(w->xdg_toplevel, nullptr);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
xdg_toplevel_set_fullscreen(window_->xdg_decor->toplevel, nullptr);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
case GHOST_kWindowStateEmbedded:
|
||||||
case GHOST_kWindowStateEmbedded: {
|
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TWindowState GHOST_WindowWayland::getState() const
|
GHOST_TWindowState GHOST_WindowWayland::getState() const
|
||||||
{
|
{
|
||||||
if (window_->is_fullscreen) {
|
if (w->is_fullscreen) {
|
||||||
return GHOST_kWindowStateFullScreen;
|
return GHOST_kWindowStateFullScreen;
|
||||||
}
|
}
|
||||||
if (window_->is_maximised) {
|
if (w->is_maximised) {
|
||||||
return GHOST_kWindowStateMaximized;
|
return GHOST_kWindowStateMaximized;
|
||||||
}
|
}
|
||||||
return GHOST_kWindowStateNormal;
|
return GHOST_kWindowStateNormal;
|
||||||
@@ -861,35 +780,26 @@ GHOST_TSuccess GHOST_WindowWayland::setOrder(GHOST_TWindowOrder /*order*/)
|
|||||||
GHOST_TSuccess GHOST_WindowWayland::beginFullScreen() const
|
GHOST_TSuccess GHOST_WindowWayland::beginFullScreen() const
|
||||||
{
|
{
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
libdecor_frame_set_fullscreen(w->decor_frame, nullptr);
|
||||||
libdecor_frame_set_fullscreen(window_->libdecor->frame, nullptr);
|
#else
|
||||||
}
|
xdg_toplevel_set_fullscreen(w->xdg_toplevel, nullptr);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
xdg_toplevel_set_fullscreen(window_->xdg_decor->toplevel, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::endFullScreen() const
|
GHOST_TSuccess GHOST_WindowWayland::endFullScreen() const
|
||||||
{
|
{
|
||||||
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
|
||||||
if (use_libdecor) {
|
libdecor_frame_unset_fullscreen(w->decor_frame);
|
||||||
libdecor_frame_unset_fullscreen(window_->libdecor->frame);
|
#else
|
||||||
}
|
xdg_toplevel_unset_fullscreen(w->xdg_toplevel);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
xdg_toplevel_unset_fullscreen(window_->xdg_decor->toplevel);
|
|
||||||
}
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GHOST_WindowWayland::isDialog() const
|
bool GHOST_WindowWayland::isDialog() const
|
||||||
{
|
{
|
||||||
return window_->is_dialog;
|
return w->is_dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GHOST_OPENGL_ALPHA
|
#ifdef GHOST_OPENGL_ALPHA
|
||||||
@@ -898,9 +808,9 @@ void GHOST_WindowWayland::setOpaque() const
|
|||||||
struct wl_region *region;
|
struct wl_region *region;
|
||||||
|
|
||||||
/* Make the window opaque. */
|
/* Make the window opaque. */
|
||||||
region = wl_compositor_create_region(system_->compositor());
|
region = wl_compositor_create_region(m_system->compositor());
|
||||||
wl_region_add(region, 0, 0, UNPACK2(window_->size));
|
wl_region_add(region, 0, 0, UNPACK2(w->size));
|
||||||
wl_surface_set_opaque_region(window_->surface, region);
|
wl_surface_set_opaque_region(w->surface, region);
|
||||||
wl_region_destroy(region);
|
wl_region_destroy(region);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -918,10 +828,10 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
|
|||||||
break;
|
break;
|
||||||
case GHOST_kDrawingContextTypeOpenGL:
|
case GHOST_kDrawingContextTypeOpenGL:
|
||||||
for (int minor = 6; minor >= 0; --minor) {
|
for (int minor = 6; minor >= 0; --minor) {
|
||||||
context = new GHOST_ContextEGL(system_,
|
context = new GHOST_ContextEGL(this->m_system,
|
||||||
m_wantStereoVisual,
|
m_wantStereoVisual,
|
||||||
EGLNativeWindowType(window_->egl_window),
|
EGLNativeWindowType(w->egl_window),
|
||||||
EGLNativeDisplayType(system_->wl_display()),
|
EGLNativeDisplayType(m_system->display()),
|
||||||
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
||||||
4,
|
4,
|
||||||
minor,
|
minor,
|
||||||
@@ -934,10 +844,10 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
|
|||||||
}
|
}
|
||||||
delete context;
|
delete context;
|
||||||
}
|
}
|
||||||
context = new GHOST_ContextEGL(system_,
|
context = new GHOST_ContextEGL(this->m_system,
|
||||||
m_wantStereoVisual,
|
m_wantStereoVisual,
|
||||||
EGLNativeWindowType(window_->egl_window),
|
EGLNativeWindowType(w->egl_window),
|
||||||
EGLNativeDisplayType(system_->wl_display()),
|
EGLNativeDisplayType(m_system->display()),
|
||||||
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
||||||
3,
|
3,
|
||||||
3,
|
3,
|
||||||
@@ -959,22 +869,22 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
|
|||||||
|
|
||||||
uint16_t GHOST_WindowWayland::dpi() const
|
uint16_t GHOST_WindowWayland::dpi() const
|
||||||
{
|
{
|
||||||
return window_->dpi;
|
return w->dpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GHOST_WindowWayland::scale() const
|
int GHOST_WindowWayland::scale() const
|
||||||
{
|
{
|
||||||
return window_->scale;
|
return w->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_surface *GHOST_WindowWayland::wl_surface() const
|
wl_surface *GHOST_WindowWayland::wl_surface() const
|
||||||
{
|
{
|
||||||
return window_->wl_surface;
|
return w->wl_surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<GWL_Output *> &GHOST_WindowWayland::outputs()
|
const std::vector<GWL_Output *> &GHOST_WindowWayland::outputs()
|
||||||
{
|
{
|
||||||
return window_->outputs;
|
return w->outputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
@@ -987,24 +897,24 @@ const std::vector<GWL_Output *> &GHOST_WindowWayland::outputs()
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::close()
|
GHOST_TSuccess GHOST_WindowWayland::close()
|
||||||
{
|
{
|
||||||
return system_->pushEvent(
|
return m_system->pushEvent(
|
||||||
new GHOST_Event(system_->getMilliSeconds(), GHOST_kEventWindowClose, this));
|
new GHOST_Event(m_system->getMilliSeconds(), GHOST_kEventWindowClose, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::activate()
|
GHOST_TSuccess GHOST_WindowWayland::activate()
|
||||||
{
|
{
|
||||||
if (system_->getWindowManager()->setActiveWindow(this) == GHOST_kFailure) {
|
if (m_system->getWindowManager()->setActiveWindow(this) == GHOST_kFailure) {
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
return system_->pushEvent(
|
return m_system->pushEvent(
|
||||||
new GHOST_Event(system_->getMilliSeconds(), GHOST_kEventWindowActivate, this));
|
new GHOST_Event(m_system->getMilliSeconds(), GHOST_kEventWindowActivate, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::deactivate()
|
GHOST_TSuccess GHOST_WindowWayland::deactivate()
|
||||||
{
|
{
|
||||||
system_->getWindowManager()->setWindowInactive(this);
|
m_system->getWindowManager()->setWindowInactive(this);
|
||||||
return system_->pushEvent(
|
return m_system->pushEvent(
|
||||||
new GHOST_Event(system_->getMilliSeconds(), GHOST_kEventWindowDeactivate, this));
|
new GHOST_Event(m_system->getMilliSeconds(), GHOST_kEventWindowDeactivate, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWayland::notify_size()
|
GHOST_TSuccess GHOST_WindowWayland::notify_size()
|
||||||
@@ -1013,8 +923,8 @@ GHOST_TSuccess GHOST_WindowWayland::notify_size()
|
|||||||
setOpaque();
|
setOpaque();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return system_->pushEvent(
|
return m_system->pushEvent(
|
||||||
new GHOST_Event(system_->getMilliSeconds(), GHOST_kEventWindowSize, this));
|
new GHOST_Event(m_system->getMilliSeconds(), GHOST_kEventWindowSize, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
@@ -1031,29 +941,30 @@ GHOST_TSuccess GHOST_WindowWayland::notify_size()
|
|||||||
bool GHOST_WindowWayland::outputs_changed_update_scale()
|
bool GHOST_WindowWayland::outputs_changed_update_scale()
|
||||||
{
|
{
|
||||||
uint32_t dpi_next;
|
uint32_t dpi_next;
|
||||||
const int scale_next = outputs_max_scale_or_default(outputs(), 0, &dpi_next);
|
const int scale_next = outputs_max_scale_or_default(this->outputs(), 0, &dpi_next);
|
||||||
if (UNLIKELY(scale_next == 0)) {
|
if (UNLIKELY(scale_next == 0)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t dpi_curr = window_->dpi;
|
GWL_Window *win = this->w;
|
||||||
const int scale_curr = window_->scale;
|
const uint32_t dpi_curr = win->dpi;
|
||||||
|
const int scale_curr = win->scale;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
if (scale_next != scale_curr) {
|
if (scale_next != scale_curr) {
|
||||||
/* Unlikely but possible there is a pending size change is set. */
|
/* Unlikely but possible there is a pending size change is set. */
|
||||||
window_->size_pending[0] = (window_->size_pending[0] / scale_curr) * scale_next;
|
win->size_pending[0] = (win->size_pending[0] / scale_curr) * scale_next;
|
||||||
window_->size_pending[1] = (window_->size_pending[1] / scale_curr) * scale_next;
|
win->size_pending[1] = (win->size_pending[1] / scale_curr) * scale_next;
|
||||||
|
|
||||||
window_->scale = scale_next;
|
win->scale = scale_next;
|
||||||
wl_surface_set_buffer_scale(window_->wl_surface, scale_next);
|
wl_surface_set_buffer_scale(w->wl_surface, scale_next);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dpi_next != dpi_curr) {
|
if (dpi_next != dpi_curr) {
|
||||||
/* Using the real DPI will cause wrong scaling of the UI
|
/* Using the real DPI will cause wrong scaling of the UI
|
||||||
* use a multiplier for the default DPI as workaround. */
|
* use a multiplier for the default DPI as workaround. */
|
||||||
window_->dpi = dpi_next;
|
win->dpi = dpi_next;
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
/* As this is a low-level function, we might want adding this event to be optional,
|
/* As this is a low-level function, we might want adding this event to be optional,
|
||||||
@@ -1068,7 +979,7 @@ bool GHOST_WindowWayland::outputs_changed_update_scale()
|
|||||||
|
|
||||||
bool GHOST_WindowWayland::outputs_enter(GWL_Output *output)
|
bool GHOST_WindowWayland::outputs_enter(GWL_Output *output)
|
||||||
{
|
{
|
||||||
std::vector<GWL_Output *> &outputs = window_->outputs;
|
std::vector<GWL_Output *> &outputs = w->outputs;
|
||||||
auto it = std::find(outputs.begin(), outputs.end(), output);
|
auto it = std::find(outputs.begin(), outputs.end(), output);
|
||||||
if (it != outputs.end()) {
|
if (it != outputs.end()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1079,7 +990,7 @@ bool GHOST_WindowWayland::outputs_enter(GWL_Output *output)
|
|||||||
|
|
||||||
bool GHOST_WindowWayland::outputs_leave(GWL_Output *output)
|
bool GHOST_WindowWayland::outputs_leave(GWL_Output *output)
|
||||||
{
|
{
|
||||||
std::vector<GWL_Output *> &outputs = window_->outputs;
|
std::vector<GWL_Output *> &outputs = w->outputs;
|
||||||
auto it = std::find(outputs.begin(), outputs.end(), output);
|
auto it = std::find(outputs.begin(), outputs.end(), output);
|
||||||
if (it == outputs.end()) {
|
if (it == outputs.end()) {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -115,9 +115,9 @@ class GHOST_WindowWayland : public GHOST_Window {
|
|||||||
bool outputs_changed_update_scale();
|
bool outputs_changed_update_scale();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GHOST_SystemWayland *system_;
|
GHOST_SystemWayland *m_system;
|
||||||
struct GWL_Window *window_;
|
struct GWL_Window *w;
|
||||||
std::string title_;
|
std::string title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \param type: The type of rendering context create.
|
* \param type: The type of rendering context create.
|
||||||
|
@@ -25,18 +25,18 @@
|
|||||||
#include "GHOST_ContextEGL.h"
|
#include "GHOST_ContextEGL.h"
|
||||||
#include "GHOST_ContextGLX.h"
|
#include "GHOST_ContextGLX.h"
|
||||||
|
|
||||||
/* For #XIWarpPointer. */
|
/* for XIWarpPointer */
|
||||||
#ifdef WITH_X11_XINPUT
|
#ifdef WITH_X11_XINPUT
|
||||||
# include <X11/extensions/XInput2.h>
|
# include <X11/extensions/XInput2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For DPI value. */
|
// For DPI value
|
||||||
#include <X11/Xresource.h>
|
#include <X11/Xresource.h>
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
/* For `gethostname`. */
|
/* gethostname */
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include "GHOST_Window.h"
|
#include "GHOST_Window.h"
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
/* For tablets. */
|
// For tablets
|
||||||
#ifdef WITH_X11_XINPUT
|
#ifdef WITH_X11_XINPUT
|
||||||
# include <X11/extensions/XInput.h>
|
# include <X11/extensions/XInput.h>
|
||||||
#endif
|
#endif
|
||||||
|
@@ -296,7 +296,7 @@ static void load_node(const tinygltf::Model &gltf_model,
|
|||||||
float world_transform[4][4];
|
float world_transform[4][4];
|
||||||
|
|
||||||
GHOST_XrControllerModelNode &node = nodes.emplace_back();
|
GHOST_XrControllerModelNode &node = nodes.emplace_back();
|
||||||
const int32_t node_idx = int32_t(nodes.size() - 1);
|
const int32_t node_idx = (int32_t)(nodes.size() - 1);
|
||||||
node.parent_idx = parent_idx;
|
node.parent_idx = parent_idx;
|
||||||
calc_node_transforms(gltf_node, parent_transform, node.local_transform, world_transform);
|
calc_node_transforms(gltf_node, parent_transform, node.local_transform, world_transform);
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ void GHOST_XrControllerModel::loadControllerModel(XrSession session)
|
|||||||
|
|
||||||
std::vector<XrControllerModelNodePropertiesMSFT> node_properties(
|
std::vector<XrControllerModelNodePropertiesMSFT> node_properties(
|
||||||
model_properties.nodeCountOutput, {XR_TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT});
|
model_properties.nodeCountOutput, {XR_TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT});
|
||||||
model_properties.nodeCapacityInput = uint32_t(node_properties.size());
|
model_properties.nodeCapacityInput = (uint32_t)node_properties.size();
|
||||||
model_properties.nodeProperties = node_properties.data();
|
model_properties.nodeProperties = node_properties.data();
|
||||||
CHECK_XR(g_xrGetControllerModelPropertiesMSFT(session, m_model_key, &model_properties),
|
CHECK_XR(g_xrGetControllerModelPropertiesMSFT(session, m_model_key, &model_properties),
|
||||||
"Failed to get controller model node properties.");
|
"Failed to get controller model node properties.");
|
||||||
@@ -583,11 +583,11 @@ void GHOST_XrControllerModel::updateComponents(XrSession session)
|
|||||||
void GHOST_XrControllerModel::getData(GHOST_XrControllerModelData &r_data)
|
void GHOST_XrControllerModel::getData(GHOST_XrControllerModelData &r_data)
|
||||||
{
|
{
|
||||||
if (m_data_loaded) {
|
if (m_data_loaded) {
|
||||||
r_data.count_vertices = uint32_t(m_vertices.size());
|
r_data.count_vertices = (uint32_t)m_vertices.size();
|
||||||
r_data.vertices = m_vertices.data();
|
r_data.vertices = m_vertices.data();
|
||||||
r_data.count_indices = uint32_t(m_indices.size());
|
r_data.count_indices = (uint32_t)m_indices.size();
|
||||||
r_data.indices = m_indices.data();
|
r_data.indices = m_indices.data();
|
||||||
r_data.count_components = uint32_t(m_components.size());
|
r_data.count_components = (uint32_t)m_components.size();
|
||||||
r_data.components = m_components.data();
|
r_data.components = m_components.data();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -85,7 +85,7 @@ class GHOST_XrGraphicsBindingOpenGL : public GHOST_IXrGraphicsBinding {
|
|||||||
XrGraphicsRequirementsOpenGLKHR gpu_requirements = {XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR};
|
XrGraphicsRequirementsOpenGLKHR gpu_requirements = {XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR};
|
||||||
const XrVersion gl_version = XR_MAKE_VERSION(gl_major_version, gl_minor_version, 0);
|
const XrVersion gl_version = XR_MAKE_VERSION(gl_major_version, gl_minor_version, 0);
|
||||||
|
|
||||||
/* Although it would seem reasonable that the PROC address would not change if the instance was
|
/* Although it would seem reasonable that the proc address would not change if the instance was
|
||||||
* the same, in testing, repeated calls to #xrGetInstanceProcAddress() with the same instance
|
* the same, in testing, repeated calls to #xrGetInstanceProcAddress() with the same instance
|
||||||
* can still result in changes so the workaround is to simply set the function pointer every
|
* can still result in changes so the workaround is to simply set the function pointer every
|
||||||
* time (trivializing its 'static' designation). */
|
* time (trivializing its 'static' designation). */
|
||||||
@@ -343,7 +343,7 @@ class GHOST_XrGraphicsBindingD3D : public GHOST_IXrGraphicsBinding {
|
|||||||
// static XrInstance s_instance = XR_NULL_HANDLE;
|
// static XrInstance s_instance = XR_NULL_HANDLE;
|
||||||
XrGraphicsRequirementsD3D11KHR gpu_requirements = {XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR};
|
XrGraphicsRequirementsD3D11KHR gpu_requirements = {XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR};
|
||||||
|
|
||||||
/* Although it would seem reasonable that the PROC address would not change if the instance was
|
/* Although it would seem reasonable that the proc address would not change if the instance was
|
||||||
* the same, in testing, repeated calls to #xrGetInstanceProcAddress() with the same instance
|
* the same, in testing, repeated calls to #xrGetInstanceProcAddress() with the same instance
|
||||||
* can still result in changes so the workaround is to simply set the function pointer every
|
* can still result in changes so the workaround is to simply set the function pointer every
|
||||||
* time (trivializing its 'static' designation). */
|
* time (trivializing its 'static' designation). */
|
||||||
|
@@ -745,7 +745,7 @@ bool GHOST_XrSession::attachActionSets()
|
|||||||
|
|
||||||
for (auto &[profile, bindings] : profile_bindings) {
|
for (auto &[profile, bindings] : profile_bindings) {
|
||||||
bindings_info.interactionProfile = profile;
|
bindings_info.interactionProfile = profile;
|
||||||
bindings_info.countSuggestedBindings = uint32_t(bindings.size());
|
bindings_info.countSuggestedBindings = (uint32_t)bindings.size();
|
||||||
bindings_info.suggestedBindings = bindings.data();
|
bindings_info.suggestedBindings = bindings.data();
|
||||||
|
|
||||||
CHECK_XR(xrSuggestInteractionProfileBindings(instance, &bindings_info),
|
CHECK_XR(xrSuggestInteractionProfileBindings(instance, &bindings_info),
|
||||||
@@ -754,7 +754,7 @@ bool GHOST_XrSession::attachActionSets()
|
|||||||
|
|
||||||
/* Attach action sets. */
|
/* Attach action sets. */
|
||||||
XrSessionActionSetsAttachInfo attach_info{XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO};
|
XrSessionActionSetsAttachInfo attach_info{XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO};
|
||||||
attach_info.countActionSets = uint32_t(m_oxr->action_sets.size());
|
attach_info.countActionSets = (uint32_t)m_oxr->action_sets.size();
|
||||||
|
|
||||||
/* Create an aligned copy of the action sets to pass to xrAttachSessionActionSets(). */
|
/* Create an aligned copy of the action sets to pass to xrAttachSessionActionSets(). */
|
||||||
std::vector<XrActionSet> action_sets(attach_info.countActionSets);
|
std::vector<XrActionSet> action_sets(attach_info.countActionSets);
|
||||||
@@ -776,7 +776,7 @@ bool GHOST_XrSession::syncActions(const char *action_set_name)
|
|||||||
|
|
||||||
XrActionsSyncInfo sync_info{XR_TYPE_ACTIONS_SYNC_INFO};
|
XrActionsSyncInfo sync_info{XR_TYPE_ACTIONS_SYNC_INFO};
|
||||||
sync_info.countActiveActionSets = (action_set_name != nullptr) ? 1 :
|
sync_info.countActiveActionSets = (action_set_name != nullptr) ? 1 :
|
||||||
uint32_t(action_sets.size());
|
(uint32_t)action_sets.size();
|
||||||
if (sync_info.countActiveActionSets < 1) {
|
if (sync_info.countActiveActionSets < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -407,12 +407,17 @@ Application::Application(GHOST_ISystem *system)
|
|||||||
stereo(false)
|
stereo(false)
|
||||||
{
|
{
|
||||||
GHOST_GLSettings glSettings = {0};
|
GHOST_GLSettings glSettings = {0};
|
||||||
glSettings.context_type = GHOST_kDrawingContextTypeOpenGL;
|
|
||||||
fApp = this;
|
fApp = this;
|
||||||
|
|
||||||
// Create the main window
|
// Create the main window
|
||||||
m_mainWindow = system->createWindow(
|
m_mainWindow = system->createWindow("gears - main window",
|
||||||
"gears - main window", 10, 64, 320, 200, GHOST_kWindowStateNormal, glSettings);
|
10,
|
||||||
|
64,
|
||||||
|
320,
|
||||||
|
200,
|
||||||
|
GHOST_kWindowStateNormal,
|
||||||
|
GHOST_kDrawingContextTypeOpenGL,
|
||||||
|
glSettings);
|
||||||
|
|
||||||
if (!m_mainWindow) {
|
if (!m_mainWindow) {
|
||||||
std::cout << "could not create main window\n";
|
std::cout << "could not create main window\n";
|
||||||
@@ -420,8 +425,14 @@ Application::Application(GHOST_ISystem *system)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a secondary window
|
// Create a secondary window
|
||||||
m_secondaryWindow = system->createWindow(
|
m_secondaryWindow = system->createWindow("gears - secondary window",
|
||||||
"gears - secondary window", 340, 64, 320, 200, GHOST_kWindowStateNormal, glSettings);
|
340,
|
||||||
|
64,
|
||||||
|
320,
|
||||||
|
200,
|
||||||
|
GHOST_kWindowStateNormal,
|
||||||
|
GHOST_kDrawingContextTypeOpenGL,
|
||||||
|
glSettings);
|
||||||
if (!m_secondaryWindow) {
|
if (!m_secondaryWindow) {
|
||||||
std::cout << "could not create secondary window\n";
|
std::cout << "could not create secondary window\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
@@ -43,7 +43,7 @@ void (*MEM_set_error_callback)(void (*func)(const char *)) = MEM_lockfree_set_er
|
|||||||
bool (*MEM_consistency_check)(void) = MEM_lockfree_consistency_check;
|
bool (*MEM_consistency_check)(void) = MEM_lockfree_consistency_check;
|
||||||
void (*MEM_set_memory_debug)(void) = MEM_lockfree_set_memory_debug;
|
void (*MEM_set_memory_debug)(void) = MEM_lockfree_set_memory_debug;
|
||||||
size_t (*MEM_get_memory_in_use)(void) = MEM_lockfree_get_memory_in_use;
|
size_t (*MEM_get_memory_in_use)(void) = MEM_lockfree_get_memory_in_use;
|
||||||
uint (*MEM_get_memory_blocks_in_use)(void) = MEM_lockfree_get_memory_blocks_in_use;
|
unsigned int (*MEM_get_memory_blocks_in_use)(void) = MEM_lockfree_get_memory_blocks_in_use;
|
||||||
void (*MEM_reset_peak_memory)(void) = MEM_lockfree_reset_peak_memory;
|
void (*MEM_reset_peak_memory)(void) = MEM_lockfree_reset_peak_memory;
|
||||||
size_t (*MEM_get_peak_memory)(void) = MEM_lockfree_get_peak_memory;
|
size_t (*MEM_get_peak_memory)(void) = MEM_lockfree_get_peak_memory;
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user