Mesh: Lines index buffer creation improvement #120720
|
@ -1559,8 +1559,10 @@ if(WITH_OPENMP)
|
|||
if(NOT WITH_OPENMP_STATIC)
|
||||
string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}")
|
||||
string(APPEND CMAKE_CXX_FLAGS " ${OpenMP_CXX_FLAGS}")
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
||||
if(DEFINED OpenMP_LINKER_FLAGS)
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
||||
endif()
|
||||
else()
|
||||
# Typically avoid adding flags as defines but we can't
|
||||
# pass OpenMP flags to the linker for static builds, meaning
|
||||
|
|
|
@ -722,9 +722,9 @@ set(UNIFIED_RUNTIME_FILE unified-runtime-${UNIFIED_RUNTIME_VERSION}.tar.gz)
|
|||
# compiler, the versions used are taken from the following location
|
||||
# https://github.com/intel/intel-graphics-compiler/releases
|
||||
|
||||
set(IGC_VERSION 1.0.14828.26)
|
||||
set(IGC_VERSION 1.0.15468.25)
|
||||
set(IGC_URI https://github.com/intel/intel-graphics-compiler/archive/refs/tags/igc-${IGC_VERSION}.tar.gz)
|
||||
set(IGC_HASH acad90b3e149cf87875e6b9100152f9e7644d6cc79ed54eaf52698abdb42076c)
|
||||
set(IGC_HASH c2c36af98ead4f4f6975633eaa53f45b84cb96ce48d9bfa879bebfaf12367b79)
|
||||
set(IGC_HASH_TYPE SHA256)
|
||||
set(IGC_FILE igc-${IGC_VERSION}.tar.gz)
|
||||
|
||||
|
@ -768,9 +768,9 @@ set(IGC_SPIRV_TOOLS_HASH 327b2dba4515646eee28c1a5fe1332891e81c8b6ff289363f52877f
|
|||
set(IGC_SPIRV_TOOLS_HASH_TYPE SHA256)
|
||||
set(IGC_SPIRV_TOOLS_FILE SPIR-V-Tools-${IGC_SPIRV_TOOLS_VERSION}.tar.gz)
|
||||
|
||||
set(IGC_SPIRV_TRANSLATOR_VERSION 23f398bf369093b1fd67459db8071ffcc6b92658)
|
||||
set(IGC_SPIRV_TRANSLATOR_VERSION 7e332d0acc8ee57462d9fbedefaf411fc193fdd0)
|
||||
set(IGC_SPIRV_TRANSLATOR_URI https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/${IGC_SPIRV_TRANSLATOR_VERSION}.tar.gz)
|
||||
set(IGC_SPIRV_TRANSLATOR_HASH a96447656ff6b40d9ad286524e22f4e7319d439c54136026fe72550d1162cd35)
|
||||
set(IGC_SPIRV_TRANSLATOR_HASH 29aadf5fd4e64ff1d4f86446eacd6a7439efeb280478988c36314c4441072c36)
|
||||
set(IGC_SPIRV_TRANSLATOR_HASH_TYPE SHA256)
|
||||
set(IGC_SPIRV_TRANSLATOR_FILE SPIR-V-Translator-${IGC_SPIRV_TRANSLATOR_VERSION}.tar.gz)
|
||||
|
||||
|
@ -778,15 +778,15 @@ set(IGC_SPIRV_TRANSLATOR_FILE SPIR-V-Translator-${IGC_SPIRV_TRANSLATOR_VERSION}.
|
|||
### Intel Graphics Compiler DEPS END ###
|
||||
########################################
|
||||
|
||||
set(GMMLIB_VERSION intel-gmmlib-22.3.0)
|
||||
set(GMMLIB_VERSION intel-gmmlib-22.3.11)
|
||||
set(GMMLIB_URI https://github.com/intel/gmmlib/archive/refs/tags/${GMMLIB_VERSION}.tar.gz)
|
||||
set(GMMLIB_HASH c1f33e1519edfc527127baeb0436b783430dfd256c643130169a3a71dc86aff9)
|
||||
set(GMMLIB_HASH b97f4e501c1e902a559cbd6597c008a700f4ab8c495680bf1968db99c6547afe)
|
||||
set(GMMLIB_HASH_TYPE SHA256)
|
||||
set(GMMLIB_FILE ${GMMLIB_VERSION}.tar.gz)
|
||||
|
||||
set(OCLOC_VERSION 23.30.26918.47)
|
||||
set(OCLOC_VERSION 23.43.27642.40)
|
||||
set(OCLOC_URI https://github.com/intel/compute-runtime/archive/refs/tags/${OCLOC_VERSION}.tar.gz)
|
||||
set(OCLOC_HASH 9890f29cbf27ce7eb845f3f7711fe8f3b0c4ee2164b77871fe51102548553f8f)
|
||||
set(OCLOC_HASH 67d0c6f3103ff12408a628e14f7170da3e0220313e10799693d576cea7821fe2)
|
||||
set(OCLOC_HASH_TYPE SHA256)
|
||||
set(OCLOC_FILE ocloc-${OCLOC_VERSION}.tar.gz)
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
set -e
|
||||
|
||||
if [ `id -u` -ne 0 ]; then
|
||||
echo "This script must be run as root"
|
||||
exit 1
|
||||
echo "This script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Required by: config manager command below to enable powertools.
|
||||
|
@ -46,8 +46,7 @@ dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/
|
|||
PACKAGES_FOR_LIBS=(
|
||||
# Used to checkout Blender's code.
|
||||
git
|
||||
# Used to checkout Blender's `../lib/` directory.
|
||||
subversion
|
||||
git-lfs
|
||||
# Used to extract packages.
|
||||
bzip2
|
||||
# Used to extract packages.
|
||||
|
|
|
@ -7,16 +7,18 @@
|
|||
# HIP_VERSION, the HIP compiler version
|
||||
# HIP_FOUND, if the HIP toolkit is found.
|
||||
|
||||
if(NOT (DEFINED HIP_ROOT_DIR))
|
||||
set(HIP_ROOT_DIR "")
|
||||
endif()
|
||||
|
||||
# If `HIP_ROOT_DIR` was defined in the environment, use it.
|
||||
if(DEFINED HIP_ROOT_DIR AND HIP_ROOT_DIR)
|
||||
if(HIP_ROOT_DIR)
|
||||
# Pass.
|
||||
elseif(DEFINED ENV{HIP_ROOT_DIR})
|
||||
set(HIP_ROOT_DIR $ENV{HIP_ROOT_DIR})
|
||||
elseif(DEFINED ENV{HIP_PATH})
|
||||
# Built-in environment variable from SDK.
|
||||
set(HIP_ROOT_DIR $ENV{HIP_PATH})
|
||||
else()
|
||||
set(HIP_ROOT_DIR "")
|
||||
endif()
|
||||
|
||||
set(_hip_SEARCH_DIRS
|
||||
|
|
|
@ -7,16 +7,18 @@
|
|||
# HIPRT_BITCODE, bitcode file with ray-tracing functionality
|
||||
# HIPRT_FOUND, if SDK found
|
||||
|
||||
if(NOT (DEFINED HIPRT_ROOT_DIR))
|
||||
set(HIPRT_ROOT_DIR "")
|
||||
endif()
|
||||
|
||||
# If `HIPRT_ROOT_DIR` was defined in the environment, use it.
|
||||
if(DEFINED HIPRT_ROOT_DIR AND HIPRT_ROOT_DIR)
|
||||
if(HIPRT_ROOT_DIR)
|
||||
# Pass.
|
||||
elseif(DEFINED ENV{HIPRT_ROOT_DIR})
|
||||
set(HIPRT_ROOT_DIR $ENV{HIPRT_ROOT_DIR})
|
||||
elseif(DEFINED ENV{HIP_PATH})
|
||||
# Built-in environment variable from SDK.
|
||||
set(HIPRT_ROOT_DIR $ENV{HIP_PATH})
|
||||
else()
|
||||
set(HIPRT_ROOT_DIR "")
|
||||
endif()
|
||||
|
||||
set(_hiprt_SEARCH_DIRS
|
||||
|
|
|
@ -11,13 +11,15 @@
|
|||
# This can also be an environment variable.
|
||||
# OPTIX_FOUND, If false, do not try to use OptiX.
|
||||
|
||||
if(NOT (DEFINED OPTIX_ROOT_DIR))
|
||||
set(OPTIX_ROOT_DIR "")
|
||||
endif()
|
||||
|
||||
# If `OPTIX_ROOT_DIR` was defined in the environment, use it.
|
||||
if(DEFINED OPTIX_ROOT_DIR AND OPTIX_ROOT_DIR)
|
||||
if(OPTIX_ROOT_DIR)
|
||||
# Pass.
|
||||
elseif(DEFINED ENV{OPTIX_ROOT_DIR})
|
||||
set(OPTIX_ROOT_DIR $ENV{OPTIX_ROOT_DIR})
|
||||
else()
|
||||
set(OPTIX_ROOT_DIR "")
|
||||
endif()
|
||||
|
||||
set(_optix_SEARCH_DIRS
|
||||
|
|
|
@ -12,12 +12,14 @@
|
|||
# This can also be an environment variable.
|
||||
# SYCL_FOUND, If false, then don't try to use SYCL.
|
||||
|
||||
if(DEFINED SYCL_ROOT_DIR AND SYCL_ROOT_DIR)
|
||||
if(NOT (DEFINED SYCL_ROOT_DIR))
|
||||
set(SYCL_ROOT_DIR "")
|
||||
endif()
|
||||
|
||||
if(SYCL_ROOT_DIR)
|
||||
# Pass.
|
||||
elseif(DEFINED ENV{SYCL_ROOT_DIR} AND NOT $ENV{SYCL_ROOT_DIR} STREQUAL "")
|
||||
set(SYCL_ROOT_DIR $ENV{SYCL_ROOT_DIR})
|
||||
else()
|
||||
set(SYCL_ROOT_DIR "")
|
||||
endif()
|
||||
|
||||
set(_sycl_search_dirs
|
||||
|
|
|
@ -37,15 +37,34 @@ else()
|
|||
unset(LIBDIR_GLIBC228_ABI)
|
||||
endif()
|
||||
|
||||
if(NOT (EXISTS ${LIBDIR}))
|
||||
message(STATUS
|
||||
"Unable to find LIBDIR: ${LIBDIR}, system libraries may be used "
|
||||
"(disable WITH_LIBS_PRECOMPILED to suppress this message)."
|
||||
)
|
||||
if(NOT DEFINED LIBDIR)
|
||||
set(LIBDIR "") # Suppress undefined warnings, allow printing even if empty.
|
||||
endif()
|
||||
if((LIBDIR STREQUAL "") OR (NOT (EXISTS "${LIBDIR}")))
|
||||
if(WITH_STRICT_BUILD_OPTIONS)
|
||||
message(SEND_ERROR
|
||||
"Unable to find LIBDIR: \"${LIBDIR}\". "
|
||||
"WITH_LIBS_PRECOMPILED needs to be able to find the LIBDIR for the precompiled libraries."
|
||||
)
|
||||
else()
|
||||
message(STATUS
|
||||
"Unable to find LIBDIR: \"${LIBDIR}\". system libraries may be used "
|
||||
"(disable WITH_LIBS_PRECOMPILED to suppress this message)."
|
||||
)
|
||||
endif()
|
||||
unset(LIBDIR)
|
||||
set(WITH_LIBS_PRECOMPILED OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Disable the CPU check if not portable or if we are not using the pre-compiled libs.
|
||||
# This is because:
|
||||
# 1. We don't install the CPU check library on a non portable build.
|
||||
# 2. We assume that people know what systems they are targeting when they build a non
|
||||
# portable build or when not using our precompiled libs.
|
||||
set_and_warn_dependency(WITH_INSTALL_PORTABLE WITH_CPU_CHECK OFF)
|
||||
set_and_warn_dependency(WITH_LIBS_PRECOMPILED WITH_CPU_CHECK OFF)
|
||||
|
||||
# Support restoring this value once pre-compiled libraries have been handled.
|
||||
set(WITH_STATIC_LIBS_INIT ${WITH_STATIC_LIBS})
|
||||
|
||||
|
@ -120,7 +139,11 @@ if(DEFINED tiff_DIR)
|
|||
endif()
|
||||
|
||||
if(WITH_VULKAN_BACKEND)
|
||||
if((DEFINED LIBDIR) AND (EXISTS "${LIBDIR}/vulkan") AND (EXISTS "${LIBDIR}/shaderc"))
|
||||
if(DEFINED LIBDIR)
|
||||
# If these are missing, something went wrong (outdated LIBDIR?).
|
||||
if(NOT ((EXISTS "${LIBDIR}/vulkan") AND (EXISTS "${LIBDIR}/shaderc")))
|
||||
message(FATAL_ERROR "${LIBDIR}/vulkan & ${LIBDIR}/shaderc are missing!")
|
||||
endif()
|
||||
if(NOT DEFINED VULKAN_ROOT_DIR)
|
||||
set(VULKAN_ROOT_DIR ${LIBDIR}/vulkan)
|
||||
endif()
|
||||
|
@ -345,9 +368,11 @@ if(WITH_INPUT_NDOF)
|
|||
endif()
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_OSL)
|
||||
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
|
||||
if(EXISTS ${CYCLES_OSL} AND NOT OSL_ROOT)
|
||||
set(OSL_ROOT ${CYCLES_OSL})
|
||||
if(DEFINED LIBDIR)
|
||||
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
|
||||
if(EXISTS ${CYCLES_OSL} AND NOT OSL_ROOT)
|
||||
set(OSL_ROOT ${CYCLES_OSL})
|
||||
endif()
|
||||
endif()
|
||||
find_package_wrapper(OSL)
|
||||
set_and_warn_library_found("OSL" OSL_FOUND WITH_CYCLES_OSL)
|
||||
|
@ -366,7 +391,7 @@ if(WITH_CYCLES AND WITH_CYCLES_OSL)
|
|||
endif()
|
||||
add_bundled_libraries(osl/lib)
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
|
||||
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI AND DEFINED LIBDIR)
|
||||
set(CYCLES_LEVEL_ZERO ${LIBDIR}/level-zero CACHE PATH "Path to Level Zero installation")
|
||||
mark_as_advanced(CYCLES_LEVEL_ZERO)
|
||||
if(EXISTS ${CYCLES_LEVEL_ZERO} AND NOT LEVEL_ZERO_ROOT_DIR)
|
||||
|
@ -493,7 +518,9 @@ if(WITH_PUGIXML)
|
|||
endif()
|
||||
|
||||
if(WITH_IMAGE_WEBP)
|
||||
set(WEBP_ROOT_DIR ${LIBDIR}/webp)
|
||||
if(DEFINED LIBDIR)
|
||||
set(WEBP_ROOT_DIR ${LIBDIR}/webp)
|
||||
endif()
|
||||
find_package_wrapper(WebP)
|
||||
set_and_warn_library_found("WebP" WEBP_FOUND WITH_IMAGE_WEBP)
|
||||
endif()
|
||||
|
@ -696,10 +723,11 @@ if(WITH_GHOST_WAYLAND)
|
|||
# When dynamically linked WAYLAND is used and `${LIBDIR}/wayland` is present,
|
||||
# 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((DEFINED LIBDIR) AND (EXISTS "${LIBDIR}/wayland" AND WITH_GHOST_WAYLAND_DYNLOAD))
|
||||
set(_use_system_wayland OFF)
|
||||
else()
|
||||
set(_use_system_wayland ON)
|
||||
set(_use_system_wayland ON)
|
||||
if(DEFINED LIBDIR)
|
||||
if(EXISTS "${LIBDIR}/wayland" AND WITH_GHOST_WAYLAND_DYNLOAD)
|
||||
set(_use_system_wayland OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(_use_system_wayland)
|
||||
|
@ -768,8 +796,11 @@ if(WITH_GHOST_WAYLAND)
|
|||
add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR)
|
||||
endif()
|
||||
|
||||
if((DEFINED LIBDIR) AND (EXISTS "${LIBDIR}/wayland/bin/wayland-scanner"))
|
||||
if(DEFINED LIBDIR)
|
||||
set(WAYLAND_SCANNER "${LIBDIR}/wayland/bin/wayland-scanner")
|
||||
if(NOT (EXISTS "${WAYLAND_SCANNER}"))
|
||||
message(FATAL_ERROR "${WAYLAND_SCANNER} is missing!")
|
||||
endif()
|
||||
else()
|
||||
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
|
||||
endif()
|
||||
|
@ -898,7 +929,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||
message(STATUS "The \"mold\" binary could not be found, using system linker.")
|
||||
set(WITH_LINKER_MOLD OFF)
|
||||
elseif(CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
|
||||
message(STATUS "GCC 12.1 or newer is required for th MOLD linker.")
|
||||
message(STATUS "GCC 12.1 or newer is required for the MOLD linker.")
|
||||
set(WITH_LINKER_MOLD OFF)
|
||||
else()
|
||||
get_filename_component(MOLD_BIN_DIR "${MOLD_BIN}" DIRECTORY)
|
||||
|
@ -1108,4 +1139,8 @@ if(PLATFORM_BUNDLED_LIBRARIES)
|
|||
set(PLATFORM_ENV_BUILD "LD_LIBRARY_PATH=\"${_library_paths}:$LD_LIBRARY_PATH\"")
|
||||
set(PLATFORM_ENV_INSTALL "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib/;$LD_LIBRARY_PATH")
|
||||
unset(_library_paths)
|
||||
else()
|
||||
# Quiet unused variable warnings, unfortunately this can't be empty.
|
||||
set(PLATFORM_ENV_BUILD "_DUMMY_ENV_VAR_=1")
|
||||
set(PLATFORM_ENV_INSTALL "_DUMMY_ENV_VAR_=1")
|
||||
endif()
|
||||
|
|
|
@ -54,7 +54,7 @@ if not (lib_tests_dirpath / ".git").exists():
|
|||
sys.exit(1)
|
||||
|
||||
# Ensure the test data files sub-module is configured and present.
|
||||
make_utils.git_enable_submodule(git_command, "tests/data")
|
||||
make_utils.git_enable_submodule(git_command, Path("tests") / "data")
|
||||
make_utils.git_update_submodule(args.git_command, lib_tests_dirpath)
|
||||
|
||||
# Run cmake again to detect tests files.
|
||||
|
|
|
@ -22,7 +22,10 @@ from pathlib import Path
|
|||
from make_utils import call, check_output
|
||||
from urllib.parse import urljoin, urlsplit
|
||||
|
||||
from typing import Optional
|
||||
from typing import (
|
||||
Optional,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
|
||||
def print_stage(text: str) -> None:
|
||||
|
@ -91,7 +94,7 @@ def get_effective_architecture(args: argparse.Namespace) -> str:
|
|||
NOTE: When cross-compiling the architecture is coming from the command line
|
||||
argument.
|
||||
"""
|
||||
architecture = args.architecture
|
||||
architecture: Optional[str] = args.architecture
|
||||
if architecture:
|
||||
assert isinstance(architecture, str)
|
||||
elif "ARM64" in platform.version():
|
||||
|
@ -101,15 +104,16 @@ def get_effective_architecture(args: argparse.Namespace) -> str:
|
|||
architecture = platform.machine().lower()
|
||||
|
||||
# Normalize the architecture name.
|
||||
if architecture in ("x86_64", "amd64"):
|
||||
if architecture in {"x86_64", "amd64"}:
|
||||
architecture = "x64"
|
||||
|
||||
assert (architecture in ("x64", "arm64"))
|
||||
assert (architecture in {"x64", "arm64"})
|
||||
|
||||
assert isinstance(architecture, str)
|
||||
return architecture
|
||||
|
||||
|
||||
def get_submodule_directories(args: argparse.Namespace):
|
||||
def get_submodule_directories(args: argparse.Namespace) -> Tuple[Path, ...]:
|
||||
"""
|
||||
Get list of all configured submodule directories.
|
||||
"""
|
||||
|
@ -121,8 +125,8 @@ def get_submodule_directories(args: argparse.Namespace):
|
|||
return ()
|
||||
|
||||
submodule_directories_output = check_output(
|
||||
[args.git_command, "config", "--file", dot_modules, "--get-regexp", "path"])
|
||||
return (Path(line.split(' ', 1)[1]) for line in submodule_directories_output.strip().splitlines())
|
||||
[args.git_command, "config", "--file", str(dot_modules), "--get-regexp", "path"])
|
||||
return tuple([Path(line.split(' ', 1)[1]) for line in submodule_directories_output.strip().splitlines()])
|
||||
|
||||
|
||||
def ensure_git_lfs(args: argparse.Namespace) -> None:
|
||||
|
@ -131,9 +135,9 @@ def ensure_git_lfs(args: argparse.Namespace) -> None:
|
|||
call((args.git_command, "lfs", "install", "--skip-repo"), exit_on_error=True)
|
||||
|
||||
|
||||
def update_precompiled_libraries(args: argparse.Namespace) -> str:
|
||||
def initialize_precompiled_libraries(args: argparse.Namespace) -> str:
|
||||
"""
|
||||
Configure and update submodule for precompiled libraries
|
||||
Configure submodule for precompiled libraries
|
||||
|
||||
This function detects the current host architecture and enables
|
||||
corresponding submodule, and updates the submodule.
|
||||
|
@ -162,27 +166,23 @@ def update_precompiled_libraries(args: argparse.Namespace) -> str:
|
|||
if Path(submodule_dir) not in submodule_directories:
|
||||
return "Skipping libraries update: no configured submodule\n"
|
||||
|
||||
make_utils.git_enable_submodule(args.git_command, submodule_dir)
|
||||
|
||||
if not make_utils.git_update_submodule(args.git_command, submodule_dir):
|
||||
return "Error updating precompiled libraries\n"
|
||||
print(f"* Enabling precompiled libraries at {submodule_dir}")
|
||||
make_utils.git_enable_submodule(args.git_command, Path(submodule_dir))
|
||||
|
||||
return ""
|
||||
|
||||
|
||||
def update_tests_data_files(args: argparse.Namespace) -> str:
|
||||
def initialize_tests_data_files(args: argparse.Namespace) -> str:
|
||||
"""
|
||||
Configure and update submodule with files used by regression tests
|
||||
Configure submodule with files used by regression tests
|
||||
"""
|
||||
|
||||
print_stage("Configuring Tests Data Files")
|
||||
|
||||
submodule_dir = "tests/data"
|
||||
|
||||
make_utils.git_enable_submodule(args.git_command, submodule_dir)
|
||||
|
||||
if not make_utils.git_update_submodule(args.git_command, submodule_dir):
|
||||
return "Error updating test data\n"
|
||||
print(f"* Enabling tests data at {submodule_dir}")
|
||||
make_utils.git_enable_submodule(args.git_command, Path(submodule_dir))
|
||||
|
||||
return ""
|
||||
|
||||
|
@ -285,7 +285,8 @@ def resolve_external_url(blender_url: str, repo_name: str) -> str:
|
|||
def external_script_copy_old_submodule_over(
|
||||
args: argparse.Namespace,
|
||||
directory: Path,
|
||||
old_submodules_dir: Path) -> None:
|
||||
old_submodules_dir: Path,
|
||||
) -> None:
|
||||
blender_git_root = get_blender_git_root()
|
||||
external_dir = blender_git_root / directory
|
||||
|
||||
|
@ -305,10 +306,12 @@ def external_script_copy_old_submodule_over(
|
|||
call((args.git_command, "config", "--file", str(git_config), "--unset", "core.worktree"))
|
||||
|
||||
|
||||
def floating_checkout_initialize_if_needed(args: argparse.Namespace,
|
||||
repo_name: str,
|
||||
directory: Path,
|
||||
old_submodules_dir: Path = None) -> None:
|
||||
def floating_checkout_initialize_if_needed(
|
||||
args: argparse.Namespace,
|
||||
repo_name: str,
|
||||
directory: Path,
|
||||
old_submodules_dir: Optional[Path] = None,
|
||||
) -> None:
|
||||
"""Initialize checkout of an external repository"""
|
||||
|
||||
blender_git_root = get_blender_git_root()
|
||||
|
@ -338,9 +341,11 @@ def floating_checkout_initialize_if_needed(args: argparse.Namespace,
|
|||
call((args.git_command, "clone", "--origin", origin_name, external_url, str(external_dir)))
|
||||
|
||||
|
||||
def floating_checkout_add_origin_if_needed(args: argparse.Namespace,
|
||||
repo_name: str,
|
||||
directory: Path) -> None:
|
||||
def floating_checkout_add_origin_if_needed(
|
||||
args: argparse.Namespace,
|
||||
repo_name: str,
|
||||
directory: Path,
|
||||
) -> None:
|
||||
"""
|
||||
Add remote called 'origin' if there is a fork of the external repository available
|
||||
|
||||
|
@ -397,12 +402,14 @@ def floating_checkout_add_origin_if_needed(args: argparse.Namespace,
|
|||
return
|
||||
|
||||
|
||||
def floating_checkout_update(args: argparse.Namespace,
|
||||
repo_name: str,
|
||||
directory: Path,
|
||||
branch: Optional[str],
|
||||
old_submodules_dir: Path = None,
|
||||
only_update=False) -> str:
|
||||
def floating_checkout_update(
|
||||
args: argparse.Namespace,
|
||||
repo_name: str,
|
||||
directory: Path,
|
||||
branch: Optional[str],
|
||||
old_submodules_dir: Optional[Path] = None,
|
||||
only_update: bool = False,
|
||||
) -> str:
|
||||
"""Update a single external checkout with the given name in the scripts folder"""
|
||||
|
||||
blender_git_root = get_blender_git_root()
|
||||
|
@ -479,41 +486,37 @@ def floating_checkout_update(args: argparse.Namespace,
|
|||
return skip_msg
|
||||
|
||||
|
||||
def external_scripts_update(args: argparse.Namespace,
|
||||
repo_name: str,
|
||||
directory_name: str,
|
||||
branch: Optional[str]) -> str:
|
||||
return floating_checkout_update(args,
|
||||
repo_name,
|
||||
Path("scripts") / directory_name,
|
||||
branch,
|
||||
old_submodules_dir=Path("release") / "scripts" / directory_name)
|
||||
|
||||
|
||||
def scripts_submodules_update(args: argparse.Namespace, branch: Optional[str]) -> str:
|
||||
"""Update working trees of addons and addons_contrib within the scripts/ directory"""
|
||||
msg = ""
|
||||
|
||||
msg += external_scripts_update(args, "blender-addons", "addons", branch)
|
||||
msg += external_scripts_update(args, "blender-addons-contrib", "addons_contrib", branch)
|
||||
|
||||
return msg
|
||||
def external_scripts_update(
|
||||
args: argparse.Namespace,
|
||||
repo_name: str,
|
||||
directory_name: str,
|
||||
branch: Optional[str],
|
||||
) -> str:
|
||||
return floating_checkout_update(
|
||||
args,
|
||||
repo_name,
|
||||
Path("scripts") / directory_name,
|
||||
branch,
|
||||
old_submodules_dir=Path("release") / "scripts" / directory_name,
|
||||
)
|
||||
|
||||
|
||||
def floating_libraries_update(args: argparse.Namespace, branch: Optional[str]) -> str:
|
||||
"""Update libraries checkouts which are floating (not attached as Git submodules)"""
|
||||
msg = ""
|
||||
|
||||
msg += floating_checkout_update(args,
|
||||
"benchmarks",
|
||||
Path("tests") / "benchmarks",
|
||||
branch,
|
||||
only_update=True)
|
||||
msg += floating_checkout_update(
|
||||
args,
|
||||
"benchmarks",
|
||||
Path("tests") / "benchmarks",
|
||||
branch,
|
||||
only_update=True,
|
||||
)
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def add_submodule_push_url(args: argparse.Namespace):
|
||||
def add_submodule_push_url(args: argparse.Namespace) -> None:
|
||||
"""
|
||||
Add pushURL configuration for all locally activated submodules, pointing to SSH protocol.
|
||||
"""
|
||||
|
@ -551,7 +554,39 @@ def add_submodule_push_url(args: argparse.Namespace):
|
|||
make_utils.git_set_config(args.git_command, "remote.origin.pushURL", push_url, str(config))
|
||||
|
||||
|
||||
def submodules_update(args: argparse.Namespace, branch: Optional[str]) -> str:
|
||||
def submodules_lib_update(args: argparse.Namespace, branch: Optional[str]) -> str:
|
||||
print_stage("Updating Libraries")
|
||||
|
||||
msg = ""
|
||||
msg += floating_libraries_update(args, branch)
|
||||
|
||||
submodule_directories = get_submodule_directories(args)
|
||||
for submodule_path in submodule_directories:
|
||||
if not make_utils.is_git_submodule_enabled(args.git_command, submodule_path):
|
||||
print(f"* Skipping {submodule_path}")
|
||||
continue
|
||||
|
||||
print(f"* Updating {submodule_path} ...")
|
||||
|
||||
if not make_utils.git_update_submodule(args.git_command, submodule_path):
|
||||
msg += f"Error updating Git submodule {submodule_path}\n"
|
||||
|
||||
add_submodule_push_url(args)
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def scripts_submodules_update(args: argparse.Namespace, branch: Optional[str]) -> str:
|
||||
"""Update working trees of addons and addons_contrib within the scripts/ directory"""
|
||||
msg = ""
|
||||
|
||||
msg += external_scripts_update(args, "blender-addons", "addons", branch)
|
||||
msg += external_scripts_update(args, "blender-addons-contrib", "addons_contrib", branch)
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def submodules_code_update(args: argparse.Namespace, branch: Optional[str]) -> str:
|
||||
"""Update submodules or other externally tracked source trees"""
|
||||
print_stage("Updating Submodules")
|
||||
|
||||
|
@ -559,25 +594,6 @@ def submodules_update(args: argparse.Namespace, branch: Optional[str]) -> str:
|
|||
|
||||
msg += scripts_submodules_update(args, branch)
|
||||
|
||||
msg += floating_libraries_update(args, branch)
|
||||
|
||||
print("* Updating Git submodules")
|
||||
|
||||
submodule_directories = get_submodule_directories(args)
|
||||
for submodule_path in submodule_directories:
|
||||
if submodule_path.parts[0] == "lib" and args.no_libraries:
|
||||
print(f"Skipping library submodule {submodule_path}")
|
||||
continue
|
||||
|
||||
if submodule_path.parts[0] == "tests" and not args.use_tests:
|
||||
print(f"Skipping tests submodule {submodule_path}")
|
||||
continue
|
||||
|
||||
if not make_utils.git_update_submodule(args.git_command, submodule_path):
|
||||
msg += f"Error updating Git submodule {submodule_path}\n"
|
||||
|
||||
add_submodule_push_url(args)
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
|
@ -606,12 +622,13 @@ if __name__ == "__main__":
|
|||
blender_skip_msg = "Blender repository skipped: " + blender_skip_msg + "\n"
|
||||
|
||||
if not args.no_libraries:
|
||||
libraries_skip_msg += update_precompiled_libraries(args)
|
||||
libraries_skip_msg += initialize_precompiled_libraries(args)
|
||||
if args.use_tests:
|
||||
libraries_skip_msg += update_tests_data_files(args)
|
||||
libraries_skip_msg += initialize_tests_data_files(args)
|
||||
libraries_skip_msg += submodules_lib_update(args, branch)
|
||||
|
||||
if not args.no_submodules:
|
||||
submodules_skip_msg = submodules_update(args, branch)
|
||||
submodules_skip_msg += submodules_code_update(args, branch)
|
||||
|
||||
# Report any skipped repositories at the end, so it's not as easy to miss.
|
||||
skip_msg = blender_skip_msg + libraries_skip_msg + submodules_skip_msg
|
||||
|
|
|
@ -15,12 +15,18 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
from typing import (
|
||||
Dict,
|
||||
Sequence,
|
||||
Optional,
|
||||
)
|
||||
|
||||
|
||||
def call(cmd: Sequence[str], exit_on_error: bool = True, silent: bool = False, env=None) -> int:
|
||||
def call(
|
||||
cmd: Sequence[str],
|
||||
exit_on_error: bool = True,
|
||||
silent: bool = False,
|
||||
env: Optional[Dict[str, str]] = None,
|
||||
) -> int:
|
||||
if not silent:
|
||||
cmd_str = ""
|
||||
if env:
|
||||
|
@ -130,17 +136,46 @@ def git_set_config(git_command: str, key: str, value: str, file: Optional[str] =
|
|||
return check_output([git_command, "config", key, value])
|
||||
|
||||
|
||||
def git_enable_submodule(git_command: str, submodule_dir: str):
|
||||
def _git_submodule_config_key(submodule_dir: Path, key: str) -> str:
|
||||
submodule_dir_str = submodule_dir.as_posix()
|
||||
return f"submodule.{submodule_dir_str}.{key}"
|
||||
|
||||
|
||||
def is_git_submodule_enabled(git_command: str, submodule_dir: Path) -> bool:
|
||||
"""Check whether submodule denoted by its directory within the repository is enabled"""
|
||||
|
||||
git_root = Path(check_output([git_command, "rev-parse", "--show-toplevel"]))
|
||||
gitmodules = git_root / ".gitmodules"
|
||||
|
||||
# Check whether the submodule actually exists.
|
||||
# Request path of an unknown submodule will cause non-zero exit code.
|
||||
path = git_get_config(
|
||||
git_command, _git_submodule_config_key(submodule_dir, "path"), str(gitmodules))
|
||||
if not path:
|
||||
return False
|
||||
|
||||
# When the "update" strategy is not provided explicitly in the the local configuration
|
||||
# `git config` returns a non-zero exit code. For those assume the default "checkout"
|
||||
# strategy.
|
||||
update = check_output(
|
||||
(git_command, "config", "--local", _git_submodule_config_key(submodule_dir, "update")),
|
||||
exit_on_error=False)
|
||||
|
||||
return update.lower() != "none"
|
||||
|
||||
|
||||
def git_enable_submodule(git_command: str, submodule_dir: Path) -> None:
|
||||
"""Enable submodule denoted by its directory within the repository"""
|
||||
|
||||
command = (git_command,
|
||||
"config",
|
||||
"--local",
|
||||
f"submodule.{submodule_dir}.update", "checkout")
|
||||
call(command, exit_on_error=True, silent=False)
|
||||
_git_submodule_config_key(submodule_dir, "update"),
|
||||
"checkout")
|
||||
call(command, exit_on_error=True, silent=True)
|
||||
|
||||
|
||||
def git_update_submodule(git_command: str, submodule_dir: str) -> bool:
|
||||
def git_update_submodule(git_command: str, submodule_dir: Path) -> bool:
|
||||
"""
|
||||
Update the given submodule.
|
||||
|
||||
|
@ -171,11 +206,11 @@ def git_update_submodule(git_command: str, submodule_dir: str) -> bool:
|
|||
|
||||
env = {"GIT_LFS_SKIP_SMUDGE": "1"}
|
||||
|
||||
if call((git_command, "submodule", "update", "--init", "--progress", submodule_dir),
|
||||
if call((git_command, "submodule", "update", "--init", "--progress", str(submodule_dir)),
|
||||
exit_on_error=False, env=env) != 0:
|
||||
return False
|
||||
|
||||
return call((git_command, "-C", submodule_dir, "lfs", "pull"),
|
||||
return call((git_command, "-C", str(submodule_dir), "lfs", "pull"),
|
||||
exit_on_error=False) == 0
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,10 @@ if NOT EXIST "%BUILD_VS_LIBDIR%\.git" (
|
|||
echo *********************************************************
|
||||
:RETRY
|
||||
"%GIT%" -C "%BLENDER_DIR%\" config --local "submodule.%BUILD_VS_LIBDIR%.update" "checkout"
|
||||
set GIT_LFS_SKIP_SMUDGE=1
|
||||
"%GIT%" -C "%BLENDER_DIR%\" submodule update --progress --init "%BUILD_VS_LIBDIR%"
|
||||
set GIT_LFS_SKIP_SMUDGE=
|
||||
"%GIT%" -C "./%BUILD_VS_LIBDIR%" lfs pull
|
||||
if errorlevel 1 (
|
||||
set /p LibRetry= "Error during download, retry? y/n"
|
||||
if /I "!LibRetry!"=="Y" (
|
||||
|
|
|
@ -24,7 +24,7 @@ if EXIST %PYTHON% (
|
|||
)
|
||||
|
||||
if NOT EXIST %PYTHON% (
|
||||
if EXIST %BLENDER_DIR%\lib\windows_x64\ (
|
||||
if EXIST %BLENDER_DIR%\lib\windows_x64\.git (
|
||||
echo Warning: Python not found, there is likely an issue with the library folder
|
||||
)
|
||||
set PYTHON=""
|
||||
|
|
|
@ -55,8 +55,7 @@ if(WITH_LZMA)
|
|||
add_subdirectory(lzma)
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES OR WITH_COMPOSITOR_CPU OR WITH_OPENSUBDIV)
|
||||
add_subdirectory(clew)
|
||||
if(WITH_CYCLES OR WITH_OPENSUBDIV)
|
||||
if((WITH_CYCLES_DEVICE_CUDA OR WITH_CYCLES_DEVICE_OPTIX) AND WITH_CUDA_DYNLOAD)
|
||||
add_subdirectory(cuew)
|
||||
endif()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Project: Audaspace
|
||||
URL: https://github.com/audaspace/audaspace
|
||||
License: Apache 2.0
|
||||
Upstream version: 1.4+ (0d18fe7, 2024 Jan 2)
|
||||
Local modifications: JOSResampleReader default quality set to MEDIUM
|
||||
Upstream version: 1.4+ (ae29ce2, 2024 Feb 26)
|
||||
Local modifications: none
|
||||
|
|
|
@ -560,7 +560,7 @@ AUD_API AUD_Sound* AUD_Sound_rechannel(AUD_Sound* sound, AUD_Channels channels)
|
|||
}
|
||||
}
|
||||
|
||||
AUD_API AUD_Sound* AUD_Sound_resample(AUD_Sound* sound, AUD_SampleRate rate, bool high_quality)
|
||||
AUD_API AUD_Sound* AUD_Sound_resample(AUD_Sound* sound, AUD_SampleRate rate, AUD_ResampleQuality quality)
|
||||
{
|
||||
assert(sound);
|
||||
|
||||
|
@ -570,10 +570,14 @@ AUD_API AUD_Sound* AUD_Sound_resample(AUD_Sound* sound, AUD_SampleRate rate, boo
|
|||
specs.channels = CHANNELS_INVALID;
|
||||
specs.rate = rate;
|
||||
specs.format = FORMAT_INVALID;
|
||||
if(high_quality)
|
||||
return new AUD_Sound(new JOSResample(*sound, specs));
|
||||
else
|
||||
if (quality == AUD_RESAMPLE_QUALITY_FASTEST)
|
||||
{
|
||||
return new AUD_Sound(new LinearResample(*sound, specs));
|
||||
}
|
||||
else
|
||||
{
|
||||
return new AUD_Sound(new JOSResample(*sound, specs, static_cast<ResampleQuality>(quality)));
|
||||
}
|
||||
}
|
||||
catch(Exception&)
|
||||
{
|
||||
|
|
|
@ -300,10 +300,10 @@ extern AUD_API AUD_Sound* AUD_Sound_rechannel(AUD_Sound* sound, AUD_Channels cha
|
|||
* Resamples the sound.
|
||||
* \param sound The sound to resample.
|
||||
* \param rate The new sample rate.
|
||||
* \param high_quality When true use a higher quality but slower resampler.
|
||||
* \param quality Resampling quality vs performance choice.
|
||||
* \return The resampled sound.
|
||||
*/
|
||||
extern AUD_API AUD_Sound* AUD_Sound_resample(AUD_Sound* sound, AUD_SampleRate rate, bool high_quality);
|
||||
extern AUD_API AUD_Sound* AUD_Sound_resample(AUD_Sound* sound, AUD_SampleRate rate, AUD_ResampleQuality quality);
|
||||
|
||||
/**
|
||||
* Reverses a sound. Make sure the sound source can be reversed.
|
||||
|
|
|
@ -270,14 +270,14 @@ AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, int sampl
|
|||
return length;
|
||||
}
|
||||
|
||||
AUD_API int AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate, void(*callback)(float, void*), void* data, char* error, size_t errorsize)
|
||||
AUD_API int AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate, AUD_ResampleQuality quality, void(*callback)(float, void*), void* data, char* error, size_t errorsize)
|
||||
{
|
||||
try
|
||||
{
|
||||
Sequence* f = dynamic_cast<Sequence *>(sound->get());
|
||||
|
||||
f->setSpecs(convCToSpec(specs.specs));
|
||||
std::shared_ptr<IReader> reader = f->createQualityReader();
|
||||
std::shared_ptr<IReader> reader = f->createQualityReader(static_cast<ResampleQuality>(quality));
|
||||
reader->seek(start);
|
||||
std::shared_ptr<IWriter> writer = FileWriter::createWriter(filename, convCToDSpec(specs), static_cast<Container>(format), static_cast<Codec>(codec), bitrate);
|
||||
FileWriter::writeReader(reader, writer, length, buffersize, callback, data);
|
||||
|
@ -295,7 +295,7 @@ AUD_API int AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int lengt
|
|||
}
|
||||
}
|
||||
|
||||
AUD_API int AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate, void(*callback)(float, void*), void* data, char* error, size_t errorsize)
|
||||
AUD_API int AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate, AUD_ResampleQuality quality, void(*callback)(float, void*), void* data, char* error, size_t errorsize)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -329,7 +329,7 @@ AUD_API int AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsign
|
|||
writers.push_back(FileWriter::createWriter(stream.str(), convCToDSpec(specs), static_cast<Container>(format), static_cast<Codec>(codec), bitrate));
|
||||
}
|
||||
|
||||
std::shared_ptr<IReader> reader = f->createQualityReader();
|
||||
std::shared_ptr<IReader> reader = f->createQualityReader(static_cast<ResampleQuality>(quality));
|
||||
reader->seek(start);
|
||||
FileWriter::writeReader(reader, writers, length, buffersize, callback, data);
|
||||
|
||||
|
@ -346,19 +346,19 @@ AUD_API int AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsign
|
|||
}
|
||||
}
|
||||
|
||||
AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, double start)
|
||||
AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, AUD_ResampleQuality quality, double start)
|
||||
{
|
||||
try
|
||||
{
|
||||
ReadDevice* device = new ReadDevice(convCToDSpec(specs));
|
||||
device->setQuality(true);
|
||||
device->setQuality(static_cast<ResampleQuality>(quality));
|
||||
device->setVolume(volume);
|
||||
|
||||
Sequence* f = dynamic_cast<Sequence*>(sequencer->get());
|
||||
|
||||
f->setSpecs(convCToSpec(specs.specs));
|
||||
|
||||
AUD_Handle handle = device->play(f->createQualityReader());
|
||||
AUD_Handle handle = device->play(f->createQualityReader(static_cast<ResampleQuality>(quality)));
|
||||
if(handle.get())
|
||||
{
|
||||
handle->seek(start);
|
||||
|
|
|
@ -69,6 +69,7 @@ extern AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, in
|
|||
* \param format The file's container format.
|
||||
* \param codec The codec used for encoding the audio data.
|
||||
* \param bitrate The bitrate for encoding.
|
||||
* \param quality The resampling quality.
|
||||
* \param callback A callback function that is called periodically during mixdown, reporting progress if length > 0. Can be NULL.
|
||||
* \param data Pass through parameter that is passed to the callback.
|
||||
* \param error String buffer to copy the error message to in case of failure.
|
||||
|
@ -78,7 +79,7 @@ extern AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, in
|
|||
extern AUD_API int AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length,
|
||||
unsigned int buffersize, const char* filename,
|
||||
AUD_DeviceSpecs specs, AUD_Container format,
|
||||
AUD_Codec codec, unsigned int bitrate,
|
||||
AUD_Codec codec, unsigned int bitrate, AUD_ResampleQuality quality,
|
||||
void(*callback)(float, void*), void* data, char* error, size_t errorsize);
|
||||
|
||||
/**
|
||||
|
@ -92,6 +93,7 @@ extern AUD_API int AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned in
|
|||
* \param format The file's container format.
|
||||
* \param codec The codec used for encoding the audio data.
|
||||
* \param bitrate The bitrate for encoding.
|
||||
* \param quality The resampling quality.
|
||||
* \param callback A callback function that is called periodically during mixdown, reporting progress if length > 0. Can be NULL.
|
||||
* \param data Pass through parameter that is passed to the callback.
|
||||
* \param error String buffer to copy the error message to in case of failure.
|
||||
|
@ -101,7 +103,7 @@ extern AUD_API int AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned in
|
|||
extern AUD_API int AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length,
|
||||
unsigned int buffersize, const char* filename,
|
||||
AUD_DeviceSpecs specs, AUD_Container format,
|
||||
AUD_Codec codec, unsigned int bitrate,
|
||||
AUD_Codec codec, unsigned int bitrate, AUD_ResampleQuality quality,
|
||||
void(*callback)(float, void*), void* data, char* error, size_t errorsize);
|
||||
|
||||
/**
|
||||
|
@ -109,10 +111,12 @@ extern AUD_API int AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start,
|
|||
* \param specs Output audio specifications.
|
||||
* \param sequencer The sound scene to mix down.
|
||||
* \param volume The overall mixdown volume.
|
||||
* \param quality The resampling quality.
|
||||
* \param start The start time of the mixdown in the sound scene.
|
||||
* \return The read device for the mixdown.
|
||||
*/
|
||||
extern AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, double start);
|
||||
extern AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer,
|
||||
float volume, AUD_ResampleQuality quality, double start);
|
||||
|
||||
/**
|
||||
* Initializes audio routines (FFMPEG/JACK if it is enabled).
|
||||
|
|
|
@ -119,6 +119,15 @@ typedef enum
|
|||
AUD_CHANNELS_SURROUND71 = 8 /// 7.1 surround sound.
|
||||
} AUD_Channels;
|
||||
|
||||
/// Resampling algorithm and quality.
|
||||
typedef enum
|
||||
{
|
||||
AUD_RESAMPLE_QUALITY_FASTEST = 0, /// Linear resample, very fast but lowest quality.
|
||||
AUD_RESAMPLE_QUALITY_LOW = 1, /// JOS resample at low quality preset.
|
||||
AUD_RESAMPLE_QUALITY_MEDIUM = 2, /// JOS resample at medium quality preset.
|
||||
AUD_RESAMPLE_QUALITY_HIGH = 3 /// JOS resample at high quality preset.
|
||||
} AUD_ResampleQuality;
|
||||
|
||||
/**
|
||||
* The sample rate tells how many samples are played back within one second.
|
||||
* Some exotic formats may use other sample rates than provided here.
|
||||
|
|
|
@ -1269,12 +1269,12 @@ Sound_rechannel(Sound* self, PyObject* args)
|
|||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_resample_doc,
|
||||
".. method:: resample(rate, high_quality)\n\n"
|
||||
".. method:: resample(rate, quality)\n\n"
|
||||
" Resamples the sound.\n\n"
|
||||
" :arg rate: The new sample rate.\n"
|
||||
" :type rate: double\n"
|
||||
" :arg high_quality: When true use a higher quality but slower resampler.\n"
|
||||
" :type high_quality: bool\n"
|
||||
" :arg quality: Resampler performance vs quality choice (0=fastest, 3=slowest).\n"
|
||||
" :type quality: int\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`");
|
||||
|
||||
|
@ -1282,20 +1282,11 @@ static PyObject *
|
|||
Sound_resample(Sound* self, PyObject* args)
|
||||
{
|
||||
double rate;
|
||||
PyObject* high_qualityo;
|
||||
bool high_quality = false;
|
||||
int quality = 0;
|
||||
|
||||
if(!PyArg_ParseTuple(args, "d|O:resample", &rate, &high_qualityo))
|
||||
if(!PyArg_ParseTuple(args, "d|i:resample", &rate, &quality))
|
||||
return nullptr;
|
||||
|
||||
if(!PyBool_Check(high_qualityo))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "high_quality is not a boolean!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
high_quality = high_qualityo == Py_True;
|
||||
|
||||
PyTypeObject* type = Py_TYPE(self);
|
||||
Sound* parent = (Sound*)type->tp_alloc(type, 0);
|
||||
|
||||
|
@ -1307,10 +1298,10 @@ Sound_resample(Sound* self, PyObject* args)
|
|||
specs.channels = CHANNELS_INVALID;
|
||||
specs.rate = rate;
|
||||
specs.format = FORMAT_INVALID;
|
||||
if(high_quality)
|
||||
parent->sound = new std::shared_ptr<ISound>(new JOSResample(*reinterpret_cast<std::shared_ptr<ISound>*>(self->sound), specs));
|
||||
else
|
||||
if (quality == int(ResampleQuality::FASTEST))
|
||||
parent->sound = new std::shared_ptr<ISound>(new LinearResample(*reinterpret_cast<std::shared_ptr<ISound>*>(self->sound), specs));
|
||||
else
|
||||
parent->sound = new std::shared_ptr<ISound>(new JOSResample(*reinterpret_cast<std::shared_ptr<ISound>*>(self->sound), specs, static_cast<ResampleQuality>(quality)));
|
||||
}
|
||||
catch(Exception& e)
|
||||
{
|
||||
|
|
|
@ -36,4 +36,15 @@ set(LIBPULSE_FOUND ${WITH_PULSEAUDIO})
|
|||
set(PYTHONLIBS_FOUND TRUE)
|
||||
set(NUMPY_FOUND ${WITH_PYTHON_NUMPY})
|
||||
set(NUMPY_INCLUDE_DIRS ${PYTHON_NUMPY_INCLUDE_DIRS})
|
||||
|
||||
set(SDL_FOUND ${WITH_SDL})
|
||||
if(SDL_FOUND)
|
||||
set(USE_SDL2 TRUE)
|
||||
if(WITH_SDL_DYNLOAD)
|
||||
set(SDL2_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/extern/sdlew/include/SDL2")
|
||||
# Not needed, Blender's `sdlew` defines symbols.
|
||||
set(SDL2_LIBRARY "")
|
||||
endif()
|
||||
# This probably shouldn't be used, but it is.
|
||||
set(SDL_LIBRARY "${SDL2_LIBRARY}")
|
||||
endif()
|
||||
|
|
|
@ -69,7 +69,7 @@ protected:
|
|||
* @param file The source code file in which the exception was thrown.
|
||||
* @param line The source code line from which the exception was thrown.
|
||||
*/
|
||||
Exception(std::string message, std::string file, int line);
|
||||
Exception(const std::string &message, const std::string &file, int line);
|
||||
public:
|
||||
/**
|
||||
* Destroys the object.
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
* @param file The source code file in which the exception was thrown.
|
||||
* @param line The source code line from which the exception was thrown.
|
||||
*/
|
||||
FileException(std::string message, std::string file, int line);
|
||||
FileException(const std::string &message, const std::string &file, int line);
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
* @param file The source code file in which the exception was thrown.
|
||||
* @param line The source code line from which the exception was thrown.
|
||||
*/
|
||||
DeviceException(std::string message, std::string file, int line);
|
||||
DeviceException(const std::string &message, const std::string &file, int line);
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
|
@ -171,7 +171,7 @@ public:
|
|||
* @param file The source code file in which the exception was thrown.
|
||||
* @param line The source code line from which the exception was thrown.
|
||||
*/
|
||||
StateException(std::string message, std::string file, int line);
|
||||
StateException(const std::string &message, const std::string &file, int line);
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
|
|
|
@ -62,14 +62,14 @@ public:
|
|||
* @param name A representative name for the device.
|
||||
* @param factory The factory that creates the device.
|
||||
*/
|
||||
static void registerDevice(std::string name, std::shared_ptr<IDeviceFactory> factory);
|
||||
static void registerDevice(const std::string &name, std::shared_ptr<IDeviceFactory> factory);
|
||||
|
||||
/**
|
||||
* Returns the factory for a specific device.
|
||||
* @param name The representative name of the device.
|
||||
* @return The factory if it was found, or nullptr otherwise.
|
||||
*/
|
||||
static std::shared_ptr<IDeviceFactory> getDeviceFactory(std::string name);
|
||||
static std::shared_ptr<IDeviceFactory> getDeviceFactory(const std::string &name);
|
||||
|
||||
/**
|
||||
* Returns the default device based on the priorities of the registered factories.
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
* If a device is currently being handled it will be released.
|
||||
* @param name The representative name of the device.
|
||||
*/
|
||||
static void openDevice(std::string name);
|
||||
static void openDevice(const std::string &name);
|
||||
|
||||
/**
|
||||
* Opens the default device which will then be handled by the manager.
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
* Sets a name for the device.
|
||||
* \param name The internal name for the device.
|
||||
*/
|
||||
virtual void setName(std::string name)=0;
|
||||
virtual void setName(const std::string &name)=0;
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
|
|
|
@ -231,9 +231,9 @@ protected:
|
|||
std::shared_ptr<Mixer> m_mixer;
|
||||
|
||||
/**
|
||||
* Whether to do high or low quality resampling.
|
||||
* Resampling quality.
|
||||
*/
|
||||
bool m_quality;
|
||||
ResampleQuality m_quality;
|
||||
|
||||
/**
|
||||
* Initializes member variables.
|
||||
|
@ -347,9 +347,9 @@ public:
|
|||
|
||||
/**
|
||||
* Sets the resampling quality.
|
||||
* \param quality Low (false) or high (true) quality.
|
||||
* \param quality Resampling quality vs performance setting.
|
||||
*/
|
||||
void setQuality(bool quality);
|
||||
void setQuality(ResampleQuality quality);
|
||||
|
||||
virtual DeviceSpecs getSpecs() const;
|
||||
virtual std::shared_ptr<IHandle> play(std::shared_ptr<IReader> reader, bool keep = false);
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
* \param filename The sound file path.
|
||||
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
|
||||
*/
|
||||
File(std::string filename, int stream = 0);
|
||||
File(const std::string &filename, int stream = 0);
|
||||
|
||||
/**
|
||||
* Creates a new sound.
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
* @return The reader created.
|
||||
* @exception Exception If no file input can read the file an exception is thrown.
|
||||
*/
|
||||
static std::shared_ptr<IReader> createReader(std::string filename, int stream = 0);
|
||||
static std::shared_ptr<IReader> createReader(const std::string &filename, int stream = 0);
|
||||
|
||||
/**
|
||||
* Creates a file reader for the given buffer if a registed IFileInput is able to read it.
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
* \return A vector with as many streams as there are in the file.
|
||||
* \exception Exception Thrown if the file specified cannot be read.
|
||||
*/
|
||||
static std::vector<StreamInfo> queryStreams(std::string filename);
|
||||
static std::vector<StreamInfo> queryStreams(const std::string &filename);
|
||||
|
||||
/**
|
||||
* Queries the streams of a sound file.
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
* @return A writer that creates the file.
|
||||
* @exception Exception If no file output can write the file with the given specification an exception is thrown.
|
||||
*/
|
||||
static std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
static std::shared_ptr<IWriter> createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
* \param bitrate The bitrate for encoding.
|
||||
* \return The writer to write data to.
|
||||
*/
|
||||
static std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
static std::shared_ptr<IWriter> createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
|
||||
/**
|
||||
* Writes a reader to a writer.
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
* \return The reader that reads the file.
|
||||
* \exception Exception Thrown if the file specified cannot be read.
|
||||
*/
|
||||
virtual std::shared_ptr<IReader> createReader(std::string filename, int stream = 0)=0;
|
||||
virtual std::shared_ptr<IReader> createReader(const std::string &filename, int stream = 0)=0;
|
||||
|
||||
/**
|
||||
* Creates a reader for a file to be read from memory.
|
||||
|
@ -71,7 +71,7 @@ public:
|
|||
* \return A vector with as many streams as there are in the file.
|
||||
* \exception Exception Thrown if the file specified cannot be read.
|
||||
*/
|
||||
virtual std::vector<StreamInfo> queryStreams(std::string filename)=0;
|
||||
virtual std::vector<StreamInfo> queryStreams(const std::string &filename)=0;
|
||||
|
||||
/**
|
||||
* Queries the streams of a sound file.
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
* \param bitrate The bitrate for encoding.
|
||||
* \exception Exception Thrown if the file specified cannot be written.
|
||||
*/
|
||||
virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)=0;
|
||||
virtual std::shared_ptr<IWriter> createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)=0;
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
|
|
|
@ -36,13 +36,15 @@ private:
|
|||
JOSResample(const JOSResample&) = delete;
|
||||
JOSResample& operator=(const JOSResample&) = delete;
|
||||
|
||||
ResampleQuality m_quality;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a new sound.
|
||||
* \param sound The input sound.
|
||||
* \param specs The target specifications.
|
||||
*/
|
||||
JOSResample(std::shared_ptr<ISound> sound, DeviceSpecs specs);
|
||||
JOSResample(std::shared_ptr<ISound> sound, DeviceSpecs specs, ResampleQuality quality = ResampleQuality::HIGH);
|
||||
|
||||
virtual std::shared_ptr<IReader> createReader();
|
||||
};
|
||||
|
|
|
@ -36,39 +36,39 @@ private:
|
|||
typedef void (JOSResampleReader::*resample_f)(double target_factor, int length, sample_t* buffer);
|
||||
|
||||
/**
|
||||
* The half filter length for Quality::HIGH setting.
|
||||
* The half filter length for HIGH quality setting.
|
||||
*/
|
||||
static const int m_len_high;
|
||||
/**
|
||||
* The half filter length for Quality::MEDIUM setting.
|
||||
* The half filter length for MEDIUM quality setting.
|
||||
*/
|
||||
static const int m_len_medium;
|
||||
/**
|
||||
* The half filter length for Quality::LOW setting.
|
||||
* The half filter length for LOW quality setting.
|
||||
*/
|
||||
static const int m_len_low;
|
||||
/**
|
||||
* The filter sample step size for Quality::HIGH setting.
|
||||
* The filter sample step size for HIGH quality setting.
|
||||
*/
|
||||
static const int m_L_high;
|
||||
/**
|
||||
* The filter sample step size for Quality::MEDIUM setting.
|
||||
* The filter sample step size for MEDIUM quality setting.
|
||||
*/
|
||||
static const int m_L_medium;
|
||||
/**
|
||||
* The filter sample step size for Quality::LOW setting.
|
||||
* The filter sample step size for LOW quality setting.
|
||||
*/
|
||||
static const int m_L_low;
|
||||
/**
|
||||
* The filter coefficients for Quality::HIGH setting.
|
||||
* The filter coefficients for HIGH quality setting.
|
||||
*/
|
||||
static const float m_coeff_high[];
|
||||
/**
|
||||
* The filter coefficients for Quality::MEDIUM setting.
|
||||
* The filter coefficients for MEDIUM quality setting.
|
||||
*/
|
||||
static const float m_coeff_medium[];
|
||||
/**
|
||||
* The filter coefficients for Quality::LOW setting.
|
||||
* The filter coefficients for LOW quality setting.
|
||||
*/
|
||||
static const float m_coeff_low[];
|
||||
|
||||
|
@ -152,19 +152,13 @@ private:
|
|||
void AUD_LOCAL resample(double target_factor, int length, sample_t* buffer);
|
||||
|
||||
public:
|
||||
enum class Quality
|
||||
{
|
||||
LOW = 0,
|
||||
MEDIUM,
|
||||
HIGH,
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a resampling reader.
|
||||
* \param reader The reader to mix.
|
||||
* \param rate The target sampling rate.
|
||||
*/
|
||||
JOSResampleReader(std::shared_ptr<IReader> reader, SampleRate rate, Quality = Quality::MEDIUM);
|
||||
JOSResampleReader(std::shared_ptr<IReader> reader, SampleRate rate, ResampleQuality quality = ResampleQuality::HIGH);
|
||||
|
||||
virtual void seek(int position);
|
||||
virtual int getLength() const;
|
||||
|
|
|
@ -83,6 +83,15 @@ enum Channel
|
|||
CHANNEL_MAX
|
||||
};
|
||||
|
||||
/// Resampling algorithm and quality.
|
||||
enum class ResampleQuality
|
||||
{
|
||||
FASTEST = 0, /// Linear resample, very fast but lowest quality.
|
||||
LOW, /// JOS resample at low quality preset.
|
||||
MEDIUM, /// JOS resample at medium quality preset.
|
||||
HIGH /// JOS resample at high quality preset.
|
||||
};
|
||||
|
||||
/**
|
||||
* The sample rate tells how many samples are played back within one second.
|
||||
* Some exotic formats may use other sample rates than provided here.
|
||||
|
|
|
@ -160,10 +160,11 @@ public:
|
|||
void remove(std::shared_ptr<SequenceEntry> entry);
|
||||
|
||||
/**
|
||||
* Creates a new reader with high quality resampling.
|
||||
* Creates a new reader with indicated resampling quality.
|
||||
* \param quality The resampling quality.
|
||||
* \return The new reader.
|
||||
*/
|
||||
std::shared_ptr<IReader> createQualityReader();
|
||||
std::shared_ptr<IReader> createQualityReader(ResampleQuality quality);
|
||||
|
||||
virtual std::shared_ptr<IReader> createReader();
|
||||
};
|
||||
|
|
|
@ -74,9 +74,9 @@ public:
|
|||
/**
|
||||
* Creates a resampling reader.
|
||||
* \param sequence The sequence data.
|
||||
* \param quality Whether a high quality resample should be used for resampling.
|
||||
* \param quality Resampling quality vs performance option.
|
||||
*/
|
||||
SequenceReader(std::shared_ptr<SequenceData> sequence, bool quality = false);
|
||||
SequenceReader(std::shared_ptr<SequenceData> sequence, ResampleQuality quality = ResampleQuality::FASTEST);
|
||||
|
||||
/**
|
||||
* Destroys the reader.
|
||||
|
|
|
@ -210,7 +210,7 @@ public:
|
|||
m_buffersize = buffersize;
|
||||
}
|
||||
|
||||
virtual void setName(std::string name)
|
||||
virtual void setName(const std::string &name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
@ -35,7 +35,7 @@ void FFMPEG::registerPlugin()
|
|||
FileManager::registerOutput(plugin);
|
||||
}
|
||||
|
||||
std::shared_ptr<IReader> FFMPEG::createReader(std::string filename, int stream)
|
||||
std::shared_ptr<IReader> FFMPEG::createReader(const std::string &filename, int stream)
|
||||
{
|
||||
return std::shared_ptr<IReader>(new FFMPEGReader(filename, stream));
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ std::shared_ptr<IReader> FFMPEG::createReader(std::shared_ptr<Buffer> buffer, in
|
|||
return std::shared_ptr<IReader>(new FFMPEGReader(buffer, stream));
|
||||
}
|
||||
|
||||
std::vector<StreamInfo> FFMPEG::queryStreams(std::string filename)
|
||||
std::vector<StreamInfo> FFMPEG::queryStreams(const std::string &filename)
|
||||
{
|
||||
return FFMPEGReader(filename).queryStreams();
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ std::vector<StreamInfo> FFMPEG::queryStreams(std::shared_ptr<Buffer> buffer)
|
|||
return FFMPEGReader(buffer).queryStreams();
|
||||
}
|
||||
|
||||
std::shared_ptr<IWriter> FFMPEG::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
|
||||
std::shared_ptr<IWriter> FFMPEG::createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
|
||||
{
|
||||
return std::shared_ptr<IWriter>(new FFMPEGWriter(filename, specs, format, codec, bitrate));
|
||||
}
|
||||
|
|
|
@ -52,11 +52,11 @@ public:
|
|||
*/
|
||||
static void registerPlugin();
|
||||
|
||||
virtual std::shared_ptr<IReader> createReader(std::string filename, int stream = 0);
|
||||
virtual std::shared_ptr<IReader> createReader(const std::string &filename, int stream = 0);
|
||||
virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0);
|
||||
virtual std::vector<StreamInfo> queryStreams(std::string filename);
|
||||
virtual std::vector<StreamInfo> queryStreams(const std::string &filename);
|
||||
virtual std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
|
||||
virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
virtual std::shared_ptr<IWriter> createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
|
|
|
@ -239,7 +239,7 @@ void FFMPEGReader::init(int stream)
|
|||
m_specs.rate = (SampleRate) m_codecCtx->sample_rate;
|
||||
}
|
||||
|
||||
FFMPEGReader::FFMPEGReader(std::string filename, int stream) :
|
||||
FFMPEGReader::FFMPEGReader(const std::string &filename, int stream) :
|
||||
m_pkgbuf(),
|
||||
m_formatCtx(nullptr),
|
||||
m_codecCtx(nullptr),
|
||||
|
|
|
@ -154,7 +154,7 @@ public:
|
|||
* \exception Exception Thrown if the file specified does not exist or
|
||||
* cannot be read with ffmpeg.
|
||||
*/
|
||||
FFMPEGReader(std::string filename, int stream = 0);
|
||||
FFMPEGReader(const std::string &filename, int stream = 0);
|
||||
|
||||
/**
|
||||
* Creates a new reader.
|
||||
|
|
|
@ -158,7 +158,7 @@ void FFMPEGWriter::close()
|
|||
#endif
|
||||
}
|
||||
|
||||
FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate) :
|
||||
FFMPEGWriter::FFMPEGWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate) :
|
||||
m_position(0),
|
||||
m_specs(specs),
|
||||
m_formatCtx(nullptr),
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
* \exception Exception Thrown if the file specified does not exist or
|
||||
* cannot be read with ffmpeg.
|
||||
*/
|
||||
FFMPEGWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
FFMPEGWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
|
||||
/**
|
||||
* Destroys the writer and closes the file.
|
||||
|
|
|
@ -162,7 +162,7 @@ void JackDevice::jack_shutdown(void* data)
|
|||
device->m_valid = false;
|
||||
}
|
||||
|
||||
JackDevice::JackDevice(std::string name, DeviceSpecs specs, int buffersize) :
|
||||
JackDevice::JackDevice(const std::string &name, DeviceSpecs specs, int buffersize) :
|
||||
m_synchronizer(this)
|
||||
{
|
||||
if(specs.channels == CHANNELS_INVALID)
|
||||
|
@ -358,7 +358,7 @@ public:
|
|||
m_buffersize = buffersize;
|
||||
}
|
||||
|
||||
virtual void setName(std::string name)
|
||||
virtual void setName(const std::string &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ public:
|
|||
* \param buffersize The size of the internal buffer.
|
||||
* \exception Exception Thrown if the audio device cannot be opened.
|
||||
*/
|
||||
JackDevice(std::string name, DeviceSpecs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE);
|
||||
JackDevice(const std::string &name, DeviceSpecs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
/**
|
||||
* Closes the JACK client.
|
||||
|
|
|
@ -32,7 +32,7 @@ void SndFile::registerPlugin()
|
|||
FileManager::registerOutput(plugin);
|
||||
}
|
||||
|
||||
std::shared_ptr<IReader> SndFile::createReader(std::string filename, int stream)
|
||||
std::shared_ptr<IReader> SndFile::createReader(const std::string &filename, int stream)
|
||||
{
|
||||
return std::shared_ptr<IReader>(new SndFileReader(filename));
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ std::shared_ptr<IReader> SndFile::createReader(std::shared_ptr<Buffer> buffer, i
|
|||
return std::shared_ptr<IReader>(new SndFileReader(buffer));
|
||||
}
|
||||
|
||||
std::vector<StreamInfo> SndFile::queryStreams(std::string filename)
|
||||
std::vector<StreamInfo> SndFile::queryStreams(const std::string &filename)
|
||||
{
|
||||
return SndFileReader(filename).queryStreams();
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ std::vector<StreamInfo> SndFile::queryStreams(std::shared_ptr<Buffer> buffer)
|
|||
return SndFileReader(buffer).queryStreams();
|
||||
}
|
||||
|
||||
std::shared_ptr<IWriter> SndFile::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
|
||||
std::shared_ptr<IWriter> SndFile::createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
|
||||
{
|
||||
return std::shared_ptr<IWriter>(new SndFileWriter(filename, specs, format, codec, bitrate));
|
||||
}
|
||||
|
|
|
@ -52,11 +52,11 @@ public:
|
|||
*/
|
||||
static void registerPlugin();
|
||||
|
||||
virtual std::shared_ptr<IReader> createReader(std::string filename, int stream = 0);
|
||||
virtual std::shared_ptr<IReader> createReader(const std::string &filename, int stream = 0);
|
||||
virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0);
|
||||
virtual std::vector<StreamInfo> queryStreams(std::string filename);
|
||||
virtual std::vector<StreamInfo> queryStreams(const std::string &filename);
|
||||
virtual std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
|
||||
virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
virtual std::shared_ptr<IWriter> createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
|
|
|
@ -71,7 +71,7 @@ sf_count_t SndFileReader::vio_tell(void* user_data)
|
|||
return reader->m_memoffset;
|
||||
}
|
||||
|
||||
SndFileReader::SndFileReader(std::string filename) :
|
||||
SndFileReader::SndFileReader(const std::string &filename) :
|
||||
m_position(0)
|
||||
{
|
||||
SF_INFO sfinfo;
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
* \exception Exception Thrown if the file specified does not exist or
|
||||
* cannot be read with libsndfile.
|
||||
*/
|
||||
SndFileReader(std::string filename);
|
||||
SndFileReader(const std::string &filename);
|
||||
|
||||
/**
|
||||
* Creates a new reader.
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
SndFileWriter::SndFileWriter(std::string filename, DeviceSpecs specs,
|
||||
SndFileWriter::SndFileWriter(const std::string &filename, DeviceSpecs specs,
|
||||
Container format, Codec codec, unsigned int bitrate) :
|
||||
m_position(0), m_specs(specs)
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
* \exception Exception Thrown if the file specified cannot be written
|
||||
* with libsndfile.
|
||||
*/
|
||||
SndFileWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
SndFileWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
|
||||
/**
|
||||
* Destroys the writer and closes the file.
|
||||
|
|
|
@ -1131,7 +1131,7 @@ void OpenALDevice::updateStreams()
|
|||
/**************************** IDevice Code ************************************/
|
||||
/******************************************************************************/
|
||||
|
||||
OpenALDevice::OpenALDevice(DeviceSpecs specs, int buffersize, std::string name) :
|
||||
OpenALDevice::OpenALDevice(DeviceSpecs specs, int buffersize, const std::string &name) :
|
||||
m_name(name), m_playing(false), m_buffersize(buffersize)
|
||||
{
|
||||
// cannot determine how many channels or which format OpenAL uses, but
|
||||
|
@ -1561,7 +1561,7 @@ private:
|
|||
std::string m_name;
|
||||
|
||||
public:
|
||||
OpenALDeviceFactory(std::string name = "") :
|
||||
OpenALDeviceFactory(const std::string &name = "") :
|
||||
m_buffersize(AUD_DEFAULT_BUFFER_SIZE),
|
||||
m_name(name)
|
||||
{
|
||||
|
@ -1590,7 +1590,7 @@ public:
|
|||
m_buffersize = buffersize;
|
||||
}
|
||||
|
||||
virtual void setName(std::string name)
|
||||
virtual void setName(const std::string &name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -1599,7 +1599,7 @@ void OpenALDevice::registerPlugin()
|
|||
{
|
||||
auto names = OpenALDevice::getDeviceNames();
|
||||
DeviceManager::registerDevice("OpenAL", std::shared_ptr<IDeviceFactory>(new OpenALDeviceFactory));
|
||||
for(std::string &name : names)
|
||||
for(const std::string &name : names)
|
||||
{
|
||||
DeviceManager::registerDevice("OpenAL - " + name, std::shared_ptr<IDeviceFactory>(new OpenALDeviceFactory(name)));
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ public:
|
|||
* \note The buffersize will be multiplicated by three for this device.
|
||||
* \exception DeviceException Thrown if the audio device cannot be opened.
|
||||
*/
|
||||
OpenALDevice(DeviceSpecs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE, std::string name = "");
|
||||
OpenALDevice(DeviceSpecs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE, const std::string &name = "");
|
||||
|
||||
virtual ~OpenALDevice();
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ void PulseAudioDevice::playing(bool playing)
|
|||
AUD_pa_threaded_mainloop_unlock(m_mainloop);
|
||||
}
|
||||
|
||||
PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buffersize) :
|
||||
PulseAudioDevice::PulseAudioDevice(const std::string &name, DeviceSpecs specs, int buffersize) :
|
||||
m_synchronizer(this),
|
||||
m_playback(false),
|
||||
m_state(PA_CONTEXT_UNCONNECTED),
|
||||
|
@ -321,7 +321,7 @@ public:
|
|||
m_buffersize = buffersize;
|
||||
}
|
||||
|
||||
virtual void setName(std::string name)
|
||||
virtual void setName(const std::string &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
* \note The specification really used for opening the device may differ.
|
||||
* \exception Exception Thrown if the audio device cannot be opened.
|
||||
*/
|
||||
PulseAudioDevice(std::string name, DeviceSpecs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE);
|
||||
PulseAudioDevice(const std::string &name, DeviceSpecs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
/**
|
||||
* Closes the PulseAudio audio device.
|
||||
|
|
|
@ -157,7 +157,7 @@ public:
|
|||
m_buffersize = buffersize;
|
||||
}
|
||||
|
||||
virtual void setName(std::string name)
|
||||
virtual void setName(const std::string &name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
@ -458,7 +458,7 @@ public:
|
|||
m_buffersize = buffersize;
|
||||
}
|
||||
|
||||
virtual void setName(std::string name)
|
||||
virtual void setName(const std::string &name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ Exception::Exception(const Exception& exception) :
|
|||
{
|
||||
}
|
||||
|
||||
Exception::Exception(std::string message, std::string file, int line) :
|
||||
Exception::Exception(const std::string &message, const std::string &file, int line) :
|
||||
m_message(message),
|
||||
m_file(file),
|
||||
m_line(line)
|
||||
|
@ -65,7 +65,7 @@ int Exception::getLine() const
|
|||
return m_line;
|
||||
}
|
||||
|
||||
FileException::FileException(std::string message, std::string file, int line) :
|
||||
FileException::FileException(const std::string &message, const std::string &file, int line) :
|
||||
Exception(message, file, line)
|
||||
{
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ FileException::~FileException() AUD_NOEXCEPT
|
|||
{
|
||||
}
|
||||
|
||||
DeviceException::DeviceException(std::string message, std::string file, int line) :
|
||||
DeviceException::DeviceException(const std::string &message, const std::string &file, int line) :
|
||||
Exception(message, file, line)
|
||||
{
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ DeviceException::~DeviceException() AUD_NOEXCEPT
|
|||
{
|
||||
}
|
||||
|
||||
StateException::StateException(std::string message, std::string file, int line) :
|
||||
StateException::StateException(const std::string &message, const std::string &file, int line) :
|
||||
Exception(message, file, line)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -28,12 +28,12 @@ AUD_NAMESPACE_BEGIN
|
|||
std::unordered_map<std::string, std::shared_ptr<IDeviceFactory>> DeviceManager::m_factories;
|
||||
std::shared_ptr<IDevice> DeviceManager::m_device;
|
||||
|
||||
void DeviceManager::registerDevice(std::string name, std::shared_ptr<IDeviceFactory> factory)
|
||||
void DeviceManager::registerDevice(const std::string &name, std::shared_ptr<IDeviceFactory> factory)
|
||||
{
|
||||
m_factories[name] = factory;
|
||||
}
|
||||
|
||||
std::shared_ptr<IDeviceFactory> DeviceManager::getDeviceFactory(std::string name)
|
||||
std::shared_ptr<IDeviceFactory> DeviceManager::getDeviceFactory(const std::string &name)
|
||||
{
|
||||
auto it = m_factories.find(name);
|
||||
|
||||
|
@ -66,7 +66,7 @@ void DeviceManager::setDevice(std::shared_ptr<IDevice> device)
|
|||
m_device = device;
|
||||
}
|
||||
|
||||
void DeviceManager::openDevice(std::string name)
|
||||
void DeviceManager::openDevice(const std::string &name)
|
||||
{
|
||||
setDevice(getDeviceFactory(name)->openDevice());
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void setName(std::string name)
|
||||
virtual void setName(const std::string &name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
@ -718,7 +718,7 @@ void SoftwareDevice::create()
|
|||
m_doppler_factor = 1.0f;
|
||||
m_distance_model = DISTANCE_MODEL_INVERSE_CLAMPED;
|
||||
m_flags = 0;
|
||||
m_quality = false;
|
||||
m_quality = ResampleQuality::FASTEST;
|
||||
}
|
||||
|
||||
void SoftwareDevice::destroy()
|
||||
|
@ -829,7 +829,7 @@ void SoftwareDevice::setPanning(IHandle* handle, float pan)
|
|||
h->m_user_pan = pan;
|
||||
}
|
||||
|
||||
void SoftwareDevice::setQuality(bool quality)
|
||||
void SoftwareDevice::setQuality(ResampleQuality quality)
|
||||
{
|
||||
m_quality = quality;
|
||||
}
|
||||
|
@ -886,10 +886,14 @@ std::shared_ptr<IHandle> SoftwareDevice::play(std::shared_ptr<IReader> reader, b
|
|||
std::shared_ptr<ResampleReader> resampler;
|
||||
|
||||
// resample
|
||||
if(m_quality)
|
||||
resampler = std::shared_ptr<ResampleReader>(new JOSResampleReader(reader, m_specs.rate));
|
||||
else
|
||||
if (m_quality == ResampleQuality::FASTEST)
|
||||
{
|
||||
resampler = std::shared_ptr<ResampleReader>(new LinearResampleReader(reader, m_specs.rate));
|
||||
}
|
||||
else
|
||||
{
|
||||
resampler = std::shared_ptr<ResampleReader>(new JOSResampleReader(reader, m_specs.rate, m_quality));
|
||||
}
|
||||
reader = std::shared_ptr<IReader>(resampler);
|
||||
|
||||
// rechannel
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
File::File(std::string filename, int stream) :
|
||||
File::File(const std::string &filename, int stream) :
|
||||
m_filename(filename), m_stream(stream)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void FileManager::registerOutput(std::shared_ptr<aud::IFileOutput> output)
|
|||
outputs().push_back(output);
|
||||
}
|
||||
|
||||
std::shared_ptr<IReader> FileManager::createReader(std::string filename, int stream)
|
||||
std::shared_ptr<IReader> FileManager::createReader(const std::string &filename, int stream)
|
||||
{
|
||||
for(std::shared_ptr<IFileInput> input : inputs())
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ std::shared_ptr<IReader> FileManager::createReader(std::shared_ptr<Buffer> buffe
|
|||
AUD_THROW(FileException, "The file couldn't be read with any installed file reader.");
|
||||
}
|
||||
|
||||
std::vector<StreamInfo> FileManager::queryStreams(std::string filename)
|
||||
std::vector<StreamInfo> FileManager::queryStreams(const std::string &filename)
|
||||
{
|
||||
for(std::shared_ptr<IFileInput> input : inputs())
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ std::vector<StreamInfo> FileManager::queryStreams(std::shared_ptr<Buffer> buffer
|
|||
AUD_THROW(FileException, "The file couldn't be read with any installed file reader.");
|
||||
}
|
||||
|
||||
std::shared_ptr<IWriter> FileManager::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
|
||||
std::shared_ptr<IWriter> FileManager::createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
|
||||
{
|
||||
for(std::shared_ptr<IFileOutput> output : outputs())
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
std::shared_ptr<IWriter> FileWriter::createWriter(std::string filename,DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
|
||||
std::shared_ptr<IWriter> FileWriter::createWriter(const std::string &filename,DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
|
||||
{
|
||||
return FileManager::createWriter(filename, specs, format, codec, bitrate);
|
||||
}
|
||||
|
|
|
@ -19,15 +19,14 @@
|
|||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
JOSResample::JOSResample(std::shared_ptr<ISound> sound,
|
||||
DeviceSpecs specs) :
|
||||
SpecsChanger(sound, specs)
|
||||
JOSResample::JOSResample(std::shared_ptr<ISound> sound, DeviceSpecs specs, ResampleQuality quality) :
|
||||
SpecsChanger(sound, specs), m_quality(quality)
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<IReader> JOSResample::createReader()
|
||||
{
|
||||
return std::shared_ptr<IReader>(new JOSResampleReader(getReader(), m_specs.rate));
|
||||
return std::shared_ptr<IReader>(new JOSResampleReader(getReader(), m_specs.rate, m_quality));
|
||||
}
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
|
|
|
@ -45,7 +45,7 @@ static inline int lrint_impl(double x)
|
|||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
JOSResampleReader::JOSResampleReader(std::shared_ptr<IReader> reader, SampleRate rate, Quality quality) :
|
||||
JOSResampleReader::JOSResampleReader(std::shared_ptr<IReader> reader, SampleRate rate, ResampleQuality quality) :
|
||||
ResampleReader(reader, rate),
|
||||
m_channels(CHANNELS_INVALID),
|
||||
m_n(0),
|
||||
|
@ -55,17 +55,17 @@ JOSResampleReader::JOSResampleReader(std::shared_ptr<IReader> reader, SampleRate
|
|||
{
|
||||
switch(quality)
|
||||
{
|
||||
case Quality::LOW:
|
||||
case ResampleQuality::LOW:
|
||||
m_len = m_len_low;
|
||||
m_L = m_L_low;
|
||||
m_coeff = m_coeff_low;
|
||||
break;
|
||||
case Quality::MEDIUM:
|
||||
case ResampleQuality::MEDIUM:
|
||||
m_len = m_len_medium;
|
||||
m_L = m_L_medium;
|
||||
m_coeff = m_coeff_medium;
|
||||
break;
|
||||
case Quality::HIGH:
|
||||
case ResampleQuality::HIGH:
|
||||
m_len = m_len_high;
|
||||
m_L = m_L_high;
|
||||
m_coeff = m_coeff_high;
|
||||
|
|
|
@ -100,9 +100,9 @@ void Sequence::remove(std::shared_ptr<SequenceEntry> entry)
|
|||
m_sequence->remove(entry);
|
||||
}
|
||||
|
||||
std::shared_ptr<IReader> Sequence::createQualityReader()
|
||||
std::shared_ptr<IReader> Sequence::createQualityReader(ResampleQuality quality)
|
||||
{
|
||||
return std::shared_ptr<IReader>(new SequenceReader(m_sequence, true));
|
||||
return std::shared_ptr<IReader>(new SequenceReader(m_sequence, quality));
|
||||
}
|
||||
|
||||
std::shared_ptr<IReader> Sequence::createReader()
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
SequenceReader::SequenceReader(std::shared_ptr<SequenceData> sequence, bool quality) :
|
||||
SequenceReader::SequenceReader(std::shared_ptr<SequenceData> sequence, ResampleQuality quality) :
|
||||
m_position(0), m_device(sequence->m_specs), m_sequence(sequence), m_status(0), m_entry_status(0)
|
||||
{
|
||||
m_device.setQuality(quality);
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2006 Blender Foundation
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
set(INC
|
||||
.
|
||||
include
|
||||
)
|
||||
|
||||
set(INC_SYS
|
||||
|
||||
)
|
||||
|
||||
set(SRC
|
||||
include/clew.h
|
||||
src/clew.c
|
||||
)
|
||||
|
||||
set(LIB
|
||||
)
|
||||
|
||||
add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
||||
|
||||
blender_add_lib(extern_clew "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
|
@ -1,5 +0,0 @@
|
|||
Project: OpenCL Wrangler
|
||||
URL: https://github.com/OpenCLWrangler/clew
|
||||
License: Apache 2.0
|
||||
Upstream version: 27a6867
|
||||
Local modifications: None
|
File diff suppressed because it is too large
Load Diff
|
@ -1,407 +0,0 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (c) 2009 Organic Vectory B.V.
|
||||
// Written by George van Venrooij
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file license.txt)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "clew.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define VC_EXTRALEAN
|
||||
#include <windows.h>
|
||||
|
||||
typedef HMODULE CLEW_DYNLIB_HANDLE;
|
||||
|
||||
#define CLEW_DYNLIB_OPEN LoadLibraryA
|
||||
#define CLEW_DYNLIB_CLOSE FreeLibrary
|
||||
#define CLEW_DYNLIB_IMPORT GetProcAddress
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
|
||||
typedef void* CLEW_DYNLIB_HANDLE;
|
||||
|
||||
#define CLEW_DYNLIB_OPEN(path) dlopen(path, RTLD_NOW | RTLD_GLOBAL)
|
||||
#define CLEW_DYNLIB_CLOSE dlclose
|
||||
#define CLEW_DYNLIB_IMPORT dlsym
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
//! \brief module handle
|
||||
static CLEW_DYNLIB_HANDLE module = NULL;
|
||||
|
||||
// Variables holding function entry points
|
||||
PFNCLGETPLATFORMIDS __clewGetPlatformIDs = NULL;
|
||||
PFNCLGETPLATFORMINFO __clewGetPlatformInfo = NULL;
|
||||
PFNCLGETDEVICEIDS __clewGetDeviceIDs = NULL;
|
||||
PFNCLGETDEVICEINFO __clewGetDeviceInfo = NULL;
|
||||
PFNCLCREATESUBDEVICES __clewCreateSubDevices = NULL;
|
||||
PFNCLRETAINDEVICE __clewRetainDevice = NULL;
|
||||
PFNCLRELEASEDEVICE __clewReleaseDevice = NULL;
|
||||
PFNCLCREATECONTEXT __clewCreateContext = NULL;
|
||||
PFNCLCREATECONTEXTFROMTYPE __clewCreateContextFromType = NULL;
|
||||
PFNCLRETAINCONTEXT __clewRetainContext = NULL;
|
||||
PFNCLRELEASECONTEXT __clewReleaseContext = NULL;
|
||||
PFNCLGETCONTEXTINFO __clewGetContextInfo = NULL;
|
||||
PFNCLCREATECOMMANDQUEUE __clewCreateCommandQueue = NULL;
|
||||
PFNCLRETAINCOMMANDQUEUE __clewRetainCommandQueue = NULL;
|
||||
PFNCLRELEASECOMMANDQUEUE __clewReleaseCommandQueue = NULL;
|
||||
PFNCLGETCOMMANDQUEUEINFO __clewGetCommandQueueInfo = NULL;
|
||||
#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
|
||||
PFNCLSETCOMMANDQUEUEPROPERTY __clewSetCommandQueueProperty = NULL;
|
||||
#endif
|
||||
PFNCLCREATEBUFFER __clewCreateBuffer = NULL;
|
||||
PFNCLCREATESUBBUFFER __clewCreateSubBuffer = NULL;
|
||||
PFNCLCREATEIMAGE __clewCreateImage = NULL;
|
||||
PFNCLRETAINMEMOBJECT __clewRetainMemObject = NULL;
|
||||
PFNCLRELEASEMEMOBJECT __clewReleaseMemObject = NULL;
|
||||
PFNCLGETSUPPORTEDIMAGEFORMATS __clewGetSupportedImageFormats = NULL;
|
||||
PFNCLGETMEMOBJECTINFO __clewGetMemObjectInfo = NULL;
|
||||
PFNCLGETIMAGEINFO __clewGetImageInfo = NULL;
|
||||
PFNCLSETMEMOBJECTDESTRUCTORCALLBACK __clewSetMemObjectDestructorCallback = NULL;
|
||||
PFNCLCREATESAMPLER __clewCreateSampler = NULL;
|
||||
PFNCLRETAINSAMPLER __clewRetainSampler = NULL;
|
||||
PFNCLRELEASESAMPLER __clewReleaseSampler = NULL;
|
||||
PFNCLGETSAMPLERINFO __clewGetSamplerInfo = NULL;
|
||||
PFNCLCREATEPROGRAMWITHSOURCE __clewCreateProgramWithSource = NULL;
|
||||
PFNCLCREATEPROGRAMWITHBINARY __clewCreateProgramWithBinary = NULL;
|
||||
PFNCLCREATEPROGRAMWITHBUILTINKERNELS __clewCreateProgramWithBuiltInKernels = NULL;
|
||||
PFNCLRETAINPROGRAM __clewRetainProgram = NULL;
|
||||
PFNCLRELEASEPROGRAM __clewReleaseProgram = NULL;
|
||||
PFNCLBUILDPROGRAM __clewBuildProgram = NULL;
|
||||
PFNCLGETPROGRAMINFO __clewGetProgramInfo = NULL;
|
||||
PFNCLGETPROGRAMBUILDINFO __clewGetProgramBuildInfo = NULL;
|
||||
PFNCLCREATEKERNEL __clewCreateKernel = NULL;
|
||||
PFNCLCREATEKERNELSINPROGRAM __clewCreateKernelsInProgram = NULL;
|
||||
PFNCLRETAINKERNEL __clewRetainKernel = NULL;
|
||||
PFNCLRELEASEKERNEL __clewReleaseKernel = NULL;
|
||||
PFNCLSETKERNELARG __clewSetKernelArg = NULL;
|
||||
PFNCLGETKERNELINFO __clewGetKernelInfo = NULL;
|
||||
PFNCLGETKERNELWORKGROUPINFO __clewGetKernelWorkGroupInfo = NULL;
|
||||
PFNCLWAITFOREVENTS __clewWaitForEvents = NULL;
|
||||
PFNCLGETEVENTINFO __clewGetEventInfo = NULL;
|
||||
PFNCLCREATEUSEREVENT __clewCreateUserEvent = NULL;
|
||||
PFNCLRETAINEVENT __clewRetainEvent = NULL;
|
||||
PFNCLRELEASEEVENT __clewReleaseEvent = NULL;
|
||||
PFNCLSETUSEREVENTSTATUS __clewSetUserEventStatus = NULL;
|
||||
PFNCLSETEVENTCALLBACK __clewSetEventCallback = NULL;
|
||||
PFNCLGETEVENTPROFILINGINFO __clewGetEventProfilingInfo = NULL;
|
||||
PFNCLFLUSH __clewFlush = NULL;
|
||||
PFNCLFINISH __clewFinish = NULL;
|
||||
PFNCLENQUEUEREADBUFFER __clewEnqueueReadBuffer = NULL;
|
||||
PFNCLENQUEUEREADBUFFERRECT __clewEnqueueReadBufferRect = NULL;
|
||||
PFNCLENQUEUEWRITEBUFFER __clewEnqueueWriteBuffer = NULL;
|
||||
PFNCLENQUEUEWRITEBUFFERRECT __clewEnqueueWriteBufferRect = NULL;
|
||||
PFNCLENQUEUECOPYBUFFER __clewEnqueueCopyBuffer = NULL;
|
||||
PFNCLENQUEUEREADIMAGE __clewEnqueueReadImage = NULL;
|
||||
PFNCLENQUEUEWRITEIMAGE __clewEnqueueWriteImage = NULL;
|
||||
PFNCLENQUEUECOPYIMAGE __clewEnqueueCopyImage = NULL;
|
||||
PFNCLENQUEUECOPYBUFFERRECT __clewEnqueueCopyBufferRect = NULL;
|
||||
PFNCLENQUEUECOPYIMAGETOBUFFER __clewEnqueueCopyImageToBuffer = NULL;
|
||||
PFNCLENQUEUECOPYBUFFERTOIMAGE __clewEnqueueCopyBufferToImage = NULL;
|
||||
PFNCLENQUEUEMAPBUFFER __clewEnqueueMapBuffer = NULL;
|
||||
PFNCLENQUEUEMAPIMAGE __clewEnqueueMapImage = NULL;
|
||||
PFNCLENQUEUEUNMAPMEMOBJECT __clewEnqueueUnmapMemObject = NULL;
|
||||
PFNCLENQUEUENDRANGEKERNEL __clewEnqueueNDRangeKernel = NULL;
|
||||
PFNCLENQUEUETASK __clewEnqueueTask = NULL;
|
||||
PFNCLENQUEUENATIVEKERNEL __clewEnqueueNativeKernel = NULL;
|
||||
|
||||
|
||||
|
||||
PFNCLGETEXTENSIONFUNCTIONADDRESSFORPLATFORM __clewGetExtensionFunctionAddressForPlatform = NULL;
|
||||
|
||||
#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
|
||||
PFNCLCREATEIMAGE2D __clewCreateImage2D = NULL;
|
||||
PFNCLCREATEIMAGE3D __clewCreateImage3D = NULL;
|
||||
PFNCLENQUEUEMARKER __clewEnqueueMarker = NULL;
|
||||
PFNCLENQUEUEWAITFOREVENTS __clewEnqueueWaitForEvents = NULL;
|
||||
PFNCLENQUEUEBARRIER __clewEnqueueBarrier = NULL;
|
||||
PFNCLUNLOADCOMPILER __clewUnloadCompiler = NULL;
|
||||
PFNCLGETEXTENSIONFUNCTIONADDRESS __clewGetExtensionFunctionAddress = NULL;
|
||||
#endif
|
||||
|
||||
/* cl_gl */
|
||||
PFNCLCREATEFROMGLBUFFER __clewCreateFromGLBuffer = NULL;
|
||||
PFNCLCREATEFROMGLTEXTURE __clewCreateFromGLTexture = NULL;
|
||||
PFNCLCREATEFROMGLRENDERBUFFER __clewCreateFromGLRenderbuffer = NULL;
|
||||
PFNCLGETGLOBJECTINFO __clewGetGLObjectInfo = NULL;
|
||||
PFNCLGETGLTEXTUREINFO __clewGetGLTextureInfo = NULL;
|
||||
PFNCLENQUEUEACQUIREGLOBJECTS __clewEnqueueAcquireGLObjects = NULL;
|
||||
PFNCLENQUEUERELEASEGLOBJECTS __clewEnqueueReleaseGLObjects = NULL;
|
||||
#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
|
||||
PFNCLCREATEFROMGLTEXTURE2D __clewCreateFromGLTexture2D = NULL;
|
||||
PFNCLCREATEFROMGLTEXTURE3D __clewCreateFromGLTexture3D = NULL;
|
||||
#endif
|
||||
PFNCLGETGLCONTEXTINFOKHR __clewGetGLContextInfoKHR = NULL;
|
||||
|
||||
static CLEW_DYNLIB_HANDLE dynamic_library_open_find(const char **paths) {
|
||||
int i = 0;
|
||||
while (paths[i] != NULL) {
|
||||
CLEW_DYNLIB_HANDLE lib = CLEW_DYNLIB_OPEN(paths[i]);
|
||||
if (lib != NULL) {
|
||||
return lib;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void clewExit(void)
|
||||
{
|
||||
if (module != NULL)
|
||||
{
|
||||
// Ignore errors
|
||||
CLEW_DYNLIB_CLOSE(module);
|
||||
module = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int clewInit()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const char *paths[] = {"OpenCL.dll", NULL};
|
||||
#elif defined(__APPLE__)
|
||||
const char *paths[] = {"/Library/Frameworks/OpenCL.framework/OpenCL", NULL};
|
||||
#else
|
||||
const char *paths[] = {"libOpenCL.so",
|
||||
"libOpenCL.so.0",
|
||||
"libOpenCL.so.1",
|
||||
"libOpenCL.so.2",
|
||||
NULL};
|
||||
#endif
|
||||
|
||||
int error = 0;
|
||||
|
||||
// Check if already initialized
|
||||
if (module != NULL)
|
||||
{
|
||||
return CLEW_SUCCESS;
|
||||
}
|
||||
|
||||
// Load library
|
||||
module = dynamic_library_open_find(paths);
|
||||
|
||||
// Check for errors
|
||||
if (module == NULL)
|
||||
{
|
||||
return CLEW_ERROR_OPEN_FAILED;
|
||||
}
|
||||
|
||||
// Set unloading
|
||||
error = atexit(clewExit);
|
||||
|
||||
if (error)
|
||||
{
|
||||
// Failure queuing atexit, shutdown with error
|
||||
CLEW_DYNLIB_CLOSE(module);
|
||||
module = NULL;
|
||||
|
||||
return CLEW_ERROR_ATEXIT_FAILED;
|
||||
}
|
||||
|
||||
// Determine function entry-points
|
||||
__clewGetPlatformIDs = (PFNCLGETPLATFORMIDS )CLEW_DYNLIB_IMPORT(module, "clGetPlatformIDs");
|
||||
__clewGetPlatformInfo = (PFNCLGETPLATFORMINFO )CLEW_DYNLIB_IMPORT(module, "clGetPlatformInfo");
|
||||
__clewGetDeviceIDs = (PFNCLGETDEVICEIDS )CLEW_DYNLIB_IMPORT(module, "clGetDeviceIDs");
|
||||
__clewGetDeviceInfo = (PFNCLGETDEVICEINFO )CLEW_DYNLIB_IMPORT(module, "clGetDeviceInfo");
|
||||
__clewCreateSubDevices = (PFNCLCREATESUBDEVICES )CLEW_DYNLIB_IMPORT(module, "clCreateSubDevices");
|
||||
__clewRetainDevice = (PFNCLRETAINDEVICE )CLEW_DYNLIB_IMPORT(module, "clRetainDevice");
|
||||
__clewReleaseDevice = (PFNCLRELEASEDEVICE )CLEW_DYNLIB_IMPORT(module, "clReleaseDevice");
|
||||
__clewCreateContext = (PFNCLCREATECONTEXT )CLEW_DYNLIB_IMPORT(module, "clCreateContext");
|
||||
__clewCreateContextFromType = (PFNCLCREATECONTEXTFROMTYPE )CLEW_DYNLIB_IMPORT(module, "clCreateContextFromType");
|
||||
__clewRetainContext = (PFNCLRETAINCONTEXT )CLEW_DYNLIB_IMPORT(module, "clRetainContext");
|
||||
__clewReleaseContext = (PFNCLRELEASECONTEXT )CLEW_DYNLIB_IMPORT(module, "clReleaseContext");
|
||||
__clewGetContextInfo = (PFNCLGETCONTEXTINFO )CLEW_DYNLIB_IMPORT(module, "clGetContextInfo");
|
||||
__clewCreateCommandQueue = (PFNCLCREATECOMMANDQUEUE )CLEW_DYNLIB_IMPORT(module, "clCreateCommandQueue");
|
||||
__clewRetainCommandQueue = (PFNCLRETAINCOMMANDQUEUE )CLEW_DYNLIB_IMPORT(module, "clRetainCommandQueue");
|
||||
__clewReleaseCommandQueue = (PFNCLRELEASECOMMANDQUEUE )CLEW_DYNLIB_IMPORT(module, "clReleaseCommandQueue");
|
||||
__clewGetCommandQueueInfo = (PFNCLGETCOMMANDQUEUEINFO )CLEW_DYNLIB_IMPORT(module, "clGetCommandQueueInfo");
|
||||
#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
|
||||
__clewSetCommandQueueProperty = (PFNCLSETCOMMANDQUEUEPROPERTY )CLEW_DYNLIB_IMPORT(module, "clSetCommandQueueProperty");
|
||||
#endif
|
||||
__clewCreateBuffer = (PFNCLCREATEBUFFER )CLEW_DYNLIB_IMPORT(module, "clCreateBuffer");
|
||||
__clewCreateSubBuffer = (PFNCLCREATESUBBUFFER )CLEW_DYNLIB_IMPORT(module, "clCreateSubBuffer");
|
||||
__clewCreateImage = (PFNCLCREATEIMAGE )CLEW_DYNLIB_IMPORT(module, "clCreateImage");
|
||||
__clewRetainMemObject = (PFNCLRETAINMEMOBJECT )CLEW_DYNLIB_IMPORT(module, "clRetainMemObject");
|
||||
__clewReleaseMemObject = (PFNCLRELEASEMEMOBJECT )CLEW_DYNLIB_IMPORT(module, "clReleaseMemObject");
|
||||
__clewGetSupportedImageFormats = (PFNCLGETSUPPORTEDIMAGEFORMATS )CLEW_DYNLIB_IMPORT(module, "clGetSupportedImageFormats");
|
||||
__clewGetMemObjectInfo = (PFNCLGETMEMOBJECTINFO )CLEW_DYNLIB_IMPORT(module, "clGetMemObjectInfo");
|
||||
__clewGetImageInfo = (PFNCLGETIMAGEINFO )CLEW_DYNLIB_IMPORT(module, "clGetImageInfo");
|
||||
__clewSetMemObjectDestructorCallback = (PFNCLSETMEMOBJECTDESTRUCTORCALLBACK)CLEW_DYNLIB_IMPORT(module, "clSetMemObjectDestructorCallback");
|
||||
__clewCreateSampler = (PFNCLCREATESAMPLER )CLEW_DYNLIB_IMPORT(module, "clCreateSampler");
|
||||
__clewRetainSampler = (PFNCLRETAINSAMPLER )CLEW_DYNLIB_IMPORT(module, "clRetainSampler");
|
||||
__clewReleaseSampler = (PFNCLRELEASESAMPLER )CLEW_DYNLIB_IMPORT(module, "clReleaseSampler");
|
||||
__clewGetSamplerInfo = (PFNCLGETSAMPLERINFO )CLEW_DYNLIB_IMPORT(module, "clGetSamplerInfo");
|
||||
__clewCreateProgramWithSource = (PFNCLCREATEPROGRAMWITHSOURCE )CLEW_DYNLIB_IMPORT(module, "clCreateProgramWithSource");
|
||||
__clewCreateProgramWithBinary = (PFNCLCREATEPROGRAMWITHBINARY )CLEW_DYNLIB_IMPORT(module, "clCreateProgramWithBinary");
|
||||
__clewCreateProgramWithBuiltInKernels =(PFNCLCREATEPROGRAMWITHBUILTINKERNELS)CLEW_DYNLIB_IMPORT(module, "clCreateProgramWithBuiltInKernels");
|
||||
__clewRetainProgram = (PFNCLRETAINPROGRAM )CLEW_DYNLIB_IMPORT(module, "clRetainProgram");
|
||||
__clewReleaseProgram = (PFNCLRELEASEPROGRAM )CLEW_DYNLIB_IMPORT(module, "clReleaseProgram");
|
||||
__clewBuildProgram = (PFNCLBUILDPROGRAM )CLEW_DYNLIB_IMPORT(module, "clBuildProgram");
|
||||
|
||||
__clewGetProgramInfo = (PFNCLGETPROGRAMINFO )CLEW_DYNLIB_IMPORT(module, "clGetProgramInfo");
|
||||
__clewGetProgramBuildInfo = (PFNCLGETPROGRAMBUILDINFO )CLEW_DYNLIB_IMPORT(module, "clGetProgramBuildInfo");
|
||||
__clewCreateKernel = (PFNCLCREATEKERNEL )CLEW_DYNLIB_IMPORT(module, "clCreateKernel");
|
||||
__clewCreateKernelsInProgram = (PFNCLCREATEKERNELSINPROGRAM )CLEW_DYNLIB_IMPORT(module, "clCreateKernelsInProgram");
|
||||
__clewRetainKernel = (PFNCLRETAINKERNEL )CLEW_DYNLIB_IMPORT(module, "clRetainKernel");
|
||||
__clewReleaseKernel = (PFNCLRELEASEKERNEL )CLEW_DYNLIB_IMPORT(module, "clReleaseKernel");
|
||||
__clewSetKernelArg = (PFNCLSETKERNELARG )CLEW_DYNLIB_IMPORT(module, "clSetKernelArg");
|
||||
__clewGetKernelInfo = (PFNCLGETKERNELINFO )CLEW_DYNLIB_IMPORT(module, "clGetKernelInfo");
|
||||
__clewGetKernelWorkGroupInfo = (PFNCLGETKERNELWORKGROUPINFO )CLEW_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo");
|
||||
__clewWaitForEvents = (PFNCLWAITFOREVENTS )CLEW_DYNLIB_IMPORT(module, "clWaitForEvents");
|
||||
__clewGetEventInfo = (PFNCLGETEVENTINFO )CLEW_DYNLIB_IMPORT(module, "clGetEventInfo");
|
||||
__clewCreateUserEvent = (PFNCLCREATEUSEREVENT )CLEW_DYNLIB_IMPORT(module, "clCreateUserEvent");
|
||||
__clewRetainEvent = (PFNCLRETAINEVENT )CLEW_DYNLIB_IMPORT(module, "clRetainEvent");
|
||||
__clewReleaseEvent = (PFNCLRELEASEEVENT )CLEW_DYNLIB_IMPORT(module, "clReleaseEvent");
|
||||
__clewSetUserEventStatus = (PFNCLSETUSEREVENTSTATUS )CLEW_DYNLIB_IMPORT(module, "clSetUserEventStatus");
|
||||
__clewSetEventCallback = (PFNCLSETEVENTCALLBACK )CLEW_DYNLIB_IMPORT(module, "clSetEventCallback");
|
||||
__clewGetEventProfilingInfo = (PFNCLGETEVENTPROFILINGINFO )CLEW_DYNLIB_IMPORT(module, "clGetEventProfilingInfo");
|
||||
__clewFlush = (PFNCLFLUSH )CLEW_DYNLIB_IMPORT(module, "clFlush");
|
||||
__clewFinish = (PFNCLFINISH )CLEW_DYNLIB_IMPORT(module, "clFinish");
|
||||
__clewEnqueueReadBuffer = (PFNCLENQUEUEREADBUFFER )CLEW_DYNLIB_IMPORT(module, "clEnqueueReadBuffer");
|
||||
__clewEnqueueReadBufferRect = (PFNCLENQUEUEREADBUFFERRECT )CLEW_DYNLIB_IMPORT(module, "clEnqueueReadBufferRect");
|
||||
__clewEnqueueWriteBuffer = (PFNCLENQUEUEWRITEBUFFER )CLEW_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer");
|
||||
__clewEnqueueWriteBufferRect = (PFNCLENQUEUEWRITEBUFFERRECT )CLEW_DYNLIB_IMPORT(module, "clEnqueueWriteBufferRect");
|
||||
__clewEnqueueCopyBuffer = (PFNCLENQUEUECOPYBUFFER )CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer");
|
||||
__clewEnqueueCopyBufferRect = (PFNCLENQUEUECOPYBUFFERRECT )CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyBufferRect");
|
||||
__clewEnqueueReadImage = (PFNCLENQUEUEREADIMAGE )CLEW_DYNLIB_IMPORT(module, "clEnqueueReadImage");
|
||||
__clewEnqueueWriteImage = (PFNCLENQUEUEWRITEIMAGE )CLEW_DYNLIB_IMPORT(module, "clEnqueueWriteImage");
|
||||
__clewEnqueueCopyImage = (PFNCLENQUEUECOPYIMAGE )CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyImage");
|
||||
__clewEnqueueCopyImageToBuffer = (PFNCLENQUEUECOPYIMAGETOBUFFER )CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer");
|
||||
__clewEnqueueCopyBufferToImage = (PFNCLENQUEUECOPYBUFFERTOIMAGE )CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage");
|
||||
__clewEnqueueMapBuffer = (PFNCLENQUEUEMAPBUFFER )CLEW_DYNLIB_IMPORT(module, "clEnqueueMapBuffer");
|
||||
__clewEnqueueMapImage = (PFNCLENQUEUEMAPIMAGE )CLEW_DYNLIB_IMPORT(module, "clEnqueueMapImage");
|
||||
__clewEnqueueUnmapMemObject = (PFNCLENQUEUEUNMAPMEMOBJECT )CLEW_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject");
|
||||
__clewEnqueueNDRangeKernel = (PFNCLENQUEUENDRANGEKERNEL )CLEW_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel");
|
||||
__clewEnqueueTask = (PFNCLENQUEUETASK )CLEW_DYNLIB_IMPORT(module, "clEnqueueTask");
|
||||
__clewEnqueueNativeKernel = (PFNCLENQUEUENATIVEKERNEL )CLEW_DYNLIB_IMPORT(module, "clEnqueueNativeKernel");
|
||||
|
||||
|
||||
__clewGetExtensionFunctionAddressForPlatform = (PFNCLGETEXTENSIONFUNCTIONADDRESSFORPLATFORM)CLEW_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddressForPlatform");
|
||||
#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
|
||||
__clewCreateImage2D = (PFNCLCREATEIMAGE2D )CLEW_DYNLIB_IMPORT(module, "clCreateImage2D");
|
||||
__clewCreateImage3D = (PFNCLCREATEIMAGE3D )CLEW_DYNLIB_IMPORT(module, "clCreateImage3D");
|
||||
__clewEnqueueMarker = (PFNCLENQUEUEMARKER )CLEW_DYNLIB_IMPORT(module, "clEnqueueMarker");
|
||||
__clewEnqueueWaitForEvents = (PFNCLENQUEUEWAITFOREVENTS )CLEW_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents");
|
||||
__clewEnqueueBarrier = (PFNCLENQUEUEBARRIER )CLEW_DYNLIB_IMPORT(module, "clEnqueueBarrier");
|
||||
__clewUnloadCompiler = (PFNCLUNLOADCOMPILER )CLEW_DYNLIB_IMPORT(module, "clUnloadCompiler");
|
||||
__clewGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLEW_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
|
||||
#endif
|
||||
|
||||
|
||||
/* cl_gl */
|
||||
__clewCreateFromGLBuffer = (PFNCLCREATEFROMGLBUFFER )CLEW_DYNLIB_IMPORT(module, "clCreateFromGLBuffer");
|
||||
__clewCreateFromGLTexture = (PFNCLCREATEFROMGLTEXTURE )CLEW_DYNLIB_IMPORT(module, "clCreateFromGLTexture");
|
||||
__clewCreateFromGLRenderbuffer = (PFNCLCREATEFROMGLRENDERBUFFER )CLEW_DYNLIB_IMPORT(module, "clCreateFromGLRenderbuffer");
|
||||
__clewGetGLObjectInfo = (PFNCLGETGLOBJECTINFO )CLEW_DYNLIB_IMPORT(module, "clGetGLObjectInfo");
|
||||
__clewGetGLTextureInfo = (PFNCLGETGLTEXTUREINFO )CLEW_DYNLIB_IMPORT(module, "clGetGLTextureInfo");
|
||||
__clewEnqueueAcquireGLObjects = (PFNCLENQUEUEACQUIREGLOBJECTS )CLEW_DYNLIB_IMPORT(module, "clEnqueueAcquireGLObjects");
|
||||
__clewEnqueueReleaseGLObjects = (PFNCLENQUEUERELEASEGLOBJECTS )CLEW_DYNLIB_IMPORT(module, "clEnqueueReleaseGLObjects");
|
||||
#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
|
||||
__clewCreateFromGLTexture2D = (PFNCLCREATEFROMGLTEXTURE2D )CLEW_DYNLIB_IMPORT(module, "clCreateFromGLTexture2D");
|
||||
__clewCreateFromGLTexture3D = (PFNCLCREATEFROMGLTEXTURE3D )CLEW_DYNLIB_IMPORT(module, "clCreateFromGLTexture3D");
|
||||
#endif
|
||||
__clewGetGLContextInfoKHR = (PFNCLGETGLCONTEXTINFOKHR )CLEW_DYNLIB_IMPORT(module, "clGetGLContextInfoKHR");
|
||||
|
||||
|
||||
if(__clewGetPlatformIDs == NULL) return 0;
|
||||
if(__clewGetPlatformInfo == NULL) return 0;
|
||||
if(__clewGetDeviceIDs == NULL) return 0;
|
||||
if(__clewGetDeviceInfo == NULL) return 0;
|
||||
|
||||
return CLEW_SUCCESS;
|
||||
}
|
||||
|
||||
const char* clewErrorString(cl_int error)
|
||||
{
|
||||
static const char* strings[] =
|
||||
{
|
||||
// Error Codes
|
||||
"CL_SUCCESS" // 0
|
||||
, "CL_DEVICE_NOT_FOUND" // -1
|
||||
, "CL_DEVICE_NOT_AVAILABLE" // -2
|
||||
, "CL_COMPILER_NOT_AVAILABLE" // -3
|
||||
, "CL_MEM_OBJECT_ALLOCATION_FAILURE" // -4
|
||||
, "CL_OUT_OF_RESOURCES" // -5
|
||||
, "CL_OUT_OF_HOST_MEMORY" // -6
|
||||
, "CL_PROFILING_INFO_NOT_AVAILABLE" // -7
|
||||
, "CL_MEM_COPY_OVERLAP" // -8
|
||||
, "CL_IMAGE_FORMAT_MISMATCH" // -9
|
||||
, "CL_IMAGE_FORMAT_NOT_SUPPORTED" // -10
|
||||
, "CL_BUILD_PROGRAM_FAILURE" // -11
|
||||
, "CL_MAP_FAILURE" // -12
|
||||
, "CL_MISALIGNED_SUB_BUFFER_OFFSET" // -13
|
||||
, "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST"// -14
|
||||
, "CL_COMPILE_PROGRAM_FAILURE" // -15
|
||||
, "CL_LINKER_NOT_AVAILABLE" // -16
|
||||
, "CL_LINK_PROGRAM_FAILURE" // -17
|
||||
, "CL_DEVICE_PARTITION_FAILED" // -18
|
||||
, "CL_KERNEL_ARG_INFO_NOT_AVAILABLE" // -19
|
||||
|
||||
, "" // -20
|
||||
, "" // -21
|
||||
, "" // -22
|
||||
, "" // -23
|
||||
, "" // -24
|
||||
, "" // -25
|
||||
, "" // -26
|
||||
, "" // -27
|
||||
, "" // -28
|
||||
, "" // -29
|
||||
|
||||
, "CL_INVALID_VALUE" // -30
|
||||
, "CL_INVALID_DEVICE_TYPE" // -31
|
||||
, "CL_INVALID_PLATFORM" // -32
|
||||
, "CL_INVALID_DEVICE" // -33
|
||||
, "CL_INVALID_CONTEXT" // -34
|
||||
, "CL_INVALID_QUEUE_PROPERTIES" // -35
|
||||
, "CL_INVALID_COMMAND_QUEUE" // -36
|
||||
, "CL_INVALID_HOST_PTR" // -37
|
||||
, "CL_INVALID_MEM_OBJECT" // -38
|
||||
, "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR" // -39
|
||||
, "CL_INVALID_IMAGE_SIZE" // -40
|
||||
, "CL_INVALID_SAMPLER" // -41
|
||||
, "CL_INVALID_BINARY" // -42
|
||||
, "CL_INVALID_BUILD_OPTIONS" // -43
|
||||
, "CL_INVALID_PROGRAM" // -44
|
||||
, "CL_INVALID_PROGRAM_EXECUTABLE" // -45
|
||||
, "CL_INVALID_KERNEL_NAME" // -46
|
||||
, "CL_INVALID_KERNEL_DEFINITION" // -47
|
||||
, "CL_INVALID_KERNEL" // -48
|
||||
, "CL_INVALID_ARG_INDEX" // -49
|
||||
, "CL_INVALID_ARG_VALUE" // -50
|
||||
, "CL_INVALID_ARG_SIZE" // -51
|
||||
, "CL_INVALID_KERNEL_ARGS" // -52
|
||||
, "CL_INVALID_WORK_DIMENSION" // -53
|
||||
, "CL_INVALID_WORK_GROUP_SIZE" // -54
|
||||
, "CL_INVALID_WORK_ITEM_SIZE" // -55
|
||||
, "CL_INVALID_GLOBAL_OFFSET" // -56
|
||||
, "CL_INVALID_EVENT_WAIT_LIST" // -57
|
||||
, "CL_INVALID_EVENT" // -58
|
||||
, "CL_INVALID_OPERATION" // -59
|
||||
, "CL_INVALID_GL_OBJECT" // -60
|
||||
, "CL_INVALID_BUFFER_SIZE" // -61
|
||||
, "CL_INVALID_MIP_LEVEL" // -62
|
||||
, "CL_INVALID_GLOBAL_WORK_SIZE" // -63
|
||||
, "CL_INVALID_PROPERTY" // -64
|
||||
, "CL_INVALID_IMAGE_DESCRIPTOR" // -65
|
||||
, "CL_INVALID_COMPILER_OPTIONS" // -66
|
||||
, "CL_INVALID_LINKER_OPTIONS" // -67
|
||||
, "CL_INVALID_DEVICE_PARTITION_COUNT" // -68
|
||||
};
|
||||
|
||||
static const int num_errors = sizeof(strings) / sizeof(strings[0]);
|
||||
|
||||
if (error == -1001) {
|
||||
return "CL_PLATFORM_NOT_FOUND_KHR";
|
||||
}
|
||||
|
||||
if (error > 0 || -error >= num_errors) {
|
||||
return "Unknown OpenCL error";
|
||||
}
|
||||
|
||||
return strings[-error];
|
||||
}
|
|
@ -26,10 +26,10 @@ endif()
|
|||
|
||||
# Build Flags
|
||||
# todo: this code could be refactored a bit to avoid duplication
|
||||
# note: CXX_HAS_SSE is needed in case passing SSE flags fails altogether (gcc-arm)
|
||||
# note: CXX_HAS_SSE42 is needed in case passing SSE flags fails altogether (gcc-arm)
|
||||
|
||||
if(WITH_CYCLES_NATIVE_ONLY)
|
||||
set(CXX_HAS_SSE FALSE)
|
||||
set(CXX_HAS_SSE42 FALSE)
|
||||
set(CXX_HAS_AVX FALSE)
|
||||
set(CXX_HAS_AVX2 FALSE)
|
||||
add_definitions(
|
||||
|
@ -65,11 +65,11 @@ if(WITH_CYCLES_NATIVE_ONLY)
|
|||
set(CYCLES_KERNEL_FLAGS "${MSVC_NATIVE_ARCH_FLAGS}")
|
||||
endif()
|
||||
elseif(NOT WITH_CPU_SIMD OR (SUPPORT_NEON_BUILD AND SSE2NEON_FOUND))
|
||||
set(CXX_HAS_SSE FALSE)
|
||||
set(CXX_HAS_SSE42 FALSE)
|
||||
set(CXX_HAS_AVX FALSE)
|
||||
set(CXX_HAS_AVX2 FALSE)
|
||||
elseif(WIN32 AND MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CXX_HAS_SSE TRUE)
|
||||
set(CXX_HAS_SSE42 TRUE)
|
||||
set(CXX_HAS_AVX TRUE)
|
||||
set(CXX_HAS_AVX2 TRUE)
|
||||
|
||||
|
@ -95,11 +95,9 @@ elseif(WIN32 AND MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|||
|
||||
# there is no /arch:SSE3, but intrinsics are available anyway
|
||||
if(CMAKE_CL_64)
|
||||
set(CYCLES_SSE2_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS}")
|
||||
set(CYCLES_SSE42_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS}")
|
||||
set(CYCLES_AVX2_KERNEL_FLAGS "${CYCLES_AVX2_ARCH_FLAGS} ${CYCLES_KERNEL_FLAGS}")
|
||||
else()
|
||||
set(CYCLES_SSE2_KERNEL_FLAGS "/arch:SSE2 ${CYCLES_KERNEL_FLAGS}")
|
||||
set(CYCLES_SSE42_KERNEL_FLAGS "/arch:SSE2 ${CYCLES_KERNEL_FLAGS}")
|
||||
set(CYCLES_AVX2_KERNEL_FLAGS "${CYCLES_AVX2_ARCH_FLAGS} ${CYCLES_KERNEL_FLAGS}")
|
||||
endif()
|
||||
|
@ -109,7 +107,7 @@ elseif(WIN32 AND MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|||
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /Ox")
|
||||
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " /Ox")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
check_cxx_compiler_flag(-msse CXX_HAS_SSE)
|
||||
check_cxx_compiler_flag(-msse4.2 CXX_HAS_SSE42)
|
||||
check_cxx_compiler_flag(-mavx CXX_HAS_AVX)
|
||||
check_cxx_compiler_flag(-mavx2 CXX_HAS_AVX2)
|
||||
|
||||
|
@ -127,26 +125,27 @@ elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
|||
string(APPEND CYCLES_KERNEL_FLAGS " -fno-rounding-math")
|
||||
endif()
|
||||
|
||||
if(CXX_HAS_SSE)
|
||||
if(CXX_HAS_SSE42)
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
string(APPEND CYCLES_KERNEL_FLAGS " -mfpmath=sse")
|
||||
endif()
|
||||
|
||||
set(CYCLES_SSE2_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS} -msse -msse2")
|
||||
set(CYCLES_SSE42_KERNEL_FLAGS "${CYCLES_SSE2_KERNEL_FLAGS} -msse3 -mssse3 -msse4.1 -msse4.2")
|
||||
set(CYCLES_SSE42_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS} -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2")
|
||||
if(CXX_HAS_AVX2)
|
||||
set(CYCLES_AVX2_KERNEL_FLAGS "${CYCLES_SSE42_KERNEL_FLAGS} -mavx -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mf16c")
|
||||
endif()
|
||||
|
||||
string(APPEND CMAKE_CXX_FLAGS " ${CYCLES_SSE42_KERNEL_FLAGS}")
|
||||
else()
|
||||
string(APPEND CMAKE_CXX_FLAGS " ${CYCLES_KERNEL_FLAGS}")
|
||||
endif()
|
||||
|
||||
string(APPEND CMAKE_CXX_FLAGS " ${CYCLES_KERNEL_FLAGS}")
|
||||
elseif(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
check_cxx_compiler_flag(/QxSSE2 CXX_HAS_SSE)
|
||||
check_cxx_compiler_flag(/QxSSE4.2 CXX_HAS_SSE42)
|
||||
check_cxx_compiler_flag(/arch:AVX CXX_HAS_AVX)
|
||||
check_cxx_compiler_flag(/QxCORE-AVX2 CXX_HAS_AVX2)
|
||||
|
||||
if(CXX_HAS_SSE)
|
||||
set(CYCLES_SSE2_KERNEL_FLAGS "/QxSSE2")
|
||||
if(CXX_HAS_SSE42)
|
||||
set(CYCLES_SSE42_KERNEL_FLAGS "/QxSSE4.2")
|
||||
|
||||
if(CXX_HAS_AVX2)
|
||||
|
@ -154,24 +153,11 @@ elseif(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
|||
endif()
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
if(APPLE)
|
||||
# ICC does not support SSE2 flag on MacOSX
|
||||
check_cxx_compiler_flag(-xssse3 CXX_HAS_SSE)
|
||||
else()
|
||||
check_cxx_compiler_flag(-xsse2 CXX_HAS_SSE)
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag(-xsse4.2 CXX_HAS_SSE42)
|
||||
check_cxx_compiler_flag(-xavx CXX_HAS_AVX)
|
||||
check_cxx_compiler_flag(-xcore-avx2 CXX_HAS_AVX2)
|
||||
|
||||
if(CXX_HAS_SSE)
|
||||
if(APPLE)
|
||||
# ICC does not support SSE2 flag on MacOSX
|
||||
set(CYCLES_SSE2_KERNEL_FLAGS "-xssse3")
|
||||
else()
|
||||
set(CYCLES_SSE2_KERNEL_FLAGS "-xsse2")
|
||||
endif()
|
||||
|
||||
if(CXX_HAS_SSE42)
|
||||
set(CYCLES_SSE42_KERNEL_FLAGS "-xsse4.2")
|
||||
|
||||
if(CXX_HAS_AVX2)
|
||||
|
@ -180,9 +166,8 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(CXX_HAS_SSE)
|
||||
if(CXX_HAS_SSE42)
|
||||
add_definitions(
|
||||
-DWITH_KERNEL_SSE2
|
||||
-DWITH_KERNEL_SSE42
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -970,7 +970,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
|||
|
||||
debug_use_cpu_avx2: BoolProperty(name="AVX2", default=True)
|
||||
debug_use_cpu_sse42: BoolProperty(name="SSE42", default=True)
|
||||
debug_use_cpu_sse2: BoolProperty(name="SSE2", default=True)
|
||||
debug_bvh_layout: EnumProperty(
|
||||
name="BVH Layout",
|
||||
items=enum_bvh_layouts,
|
||||
|
@ -1656,7 +1655,7 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
|||
col.label(text=rpt_("and Windows driver version %s or newer") % driver_version,
|
||||
icon='BLANK1', translate=False)
|
||||
elif sys.platform.startswith("linux"):
|
||||
driver_version = "XX.XX.26918.50"
|
||||
driver_version = "XX.XX.27642.38"
|
||||
col.label(
|
||||
text=rpt_("Requires Intel GPU with Xe-HPG architecture and"),
|
||||
icon='BLANK1',
|
||||
|
|
|
@ -2234,7 +2234,6 @@ class CYCLES_RENDER_PT_debug(CyclesDebugButtonsPanel, Panel):
|
|||
col = layout.column(heading="CPU")
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(cscene, "debug_use_cpu_sse2", toggle=True)
|
||||
row.prop(cscene, "debug_use_cpu_sse42", toggle=True)
|
||||
row.prop(cscene, "debug_use_cpu_avx2", toggle=True)
|
||||
col.prop(cscene, "debug_bvh_layout", text="BVH")
|
||||
|
|
|
@ -931,7 +931,8 @@ static void export_hair_curves_motion(Hair *hair,
|
|||
}
|
||||
|
||||
/* Export motion keys. */
|
||||
const int num_keys = hair->get_curve_keys().size();
|
||||
const size_t num_keys = hair->num_keys();
|
||||
const size_t num_curves = hair->num_curves();
|
||||
float4 *mP = attr_mP->data_float4() + motion_step * num_keys;
|
||||
bool have_motion = false;
|
||||
int num_motion_keys = 0;
|
||||
|
@ -944,6 +945,9 @@ static void export_hair_curves_motion(Hair *hair,
|
|||
|
||||
for (const int i : points_by_curve.index_range()) {
|
||||
const blender::IndexRange points = points_by_curve[i];
|
||||
if (curve_index >= num_curves) {
|
||||
break;
|
||||
}
|
||||
|
||||
Hair::Curve curve = hair->get_curve(curve_index);
|
||||
curve_index++;
|
||||
|
|
|
@ -66,7 +66,6 @@ static void debug_flags_sync_from_scene(BL::Scene b_scene)
|
|||
/* Synchronize CPU flags. */
|
||||
flags.cpu.avx2 = get_boolean(cscene, "debug_use_cpu_avx2");
|
||||
flags.cpu.sse42 = get_boolean(cscene, "debug_use_cpu_sse42");
|
||||
flags.cpu.sse2 = get_boolean(cscene, "debug_use_cpu_sse2");
|
||||
flags.cpu.bvh_layout = (BVHLayout)get_enum(cscene, "debug_bvh_layout");
|
||||
/* Synchronize CUDA flags. */
|
||||
flags.cuda.adaptive_compile = get_boolean(cscene, "debug_use_cuda_adaptive_compile");
|
||||
|
|
|
@ -46,7 +46,6 @@ void device_cpu_info(vector<DeviceInfo> &devices)
|
|||
string device_cpu_capabilities()
|
||||
{
|
||||
string capabilities = "";
|
||||
capabilities += system_cpu_support_sse2() ? "SSE2 " : "";
|
||||
capabilities += system_cpu_support_sse42() ? "SSE42 " : "";
|
||||
capabilities += system_cpu_support_avx2() ? "AVX2" : "";
|
||||
if (capabilities[capabilities.size() - 1] == ' ') {
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#define KERNEL_FUNCTIONS(name) \
|
||||
KERNEL_NAME_EVAL(cpu, name), KERNEL_NAME_EVAL(cpu_sse2, name), \
|
||||
KERNEL_NAME_EVAL(cpu_sse42, name), KERNEL_NAME_EVAL(cpu_avx2, name)
|
||||
KERNEL_NAME_EVAL(cpu, name), KERNEL_NAME_EVAL(cpu_sse42, name), KERNEL_NAME_EVAL(cpu_avx2, name)
|
||||
|
||||
#define REGISTER_KERNEL(name) name(KERNEL_FUNCTIONS(name))
|
||||
#define REGISTER_KERNEL_FILM_CONVERT(name) \
|
||||
|
|
|
@ -17,11 +17,10 @@ CCL_NAMESPACE_BEGIN
|
|||
template<typename FunctionType> class CPUKernelFunction {
|
||||
public:
|
||||
CPUKernelFunction(FunctionType kernel_default,
|
||||
FunctionType kernel_sse2,
|
||||
FunctionType kernel_sse42,
|
||||
FunctionType kernel_avx2)
|
||||
{
|
||||
kernel_info_ = get_best_kernel_info(kernel_default, kernel_sse2, kernel_sse42, kernel_avx2);
|
||||
kernel_info_ = get_best_kernel_info(kernel_default, kernel_sse42, kernel_avx2);
|
||||
}
|
||||
|
||||
template<typename... Args> inline auto operator()(Args... args) const
|
||||
|
@ -55,12 +54,10 @@ template<typename FunctionType> class CPUKernelFunction {
|
|||
};
|
||||
|
||||
KernelInfo get_best_kernel_info(FunctionType kernel_default,
|
||||
FunctionType kernel_sse2,
|
||||
FunctionType kernel_sse42,
|
||||
FunctionType kernel_avx2)
|
||||
{
|
||||
/* Silence warnings about unused variables when compiling without some architectures. */
|
||||
(void)kernel_sse2;
|
||||
(void)kernel_sse42;
|
||||
(void)kernel_avx2;
|
||||
|
||||
|
@ -76,12 +73,6 @@ template<typename FunctionType> class CPUKernelFunction {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
|
||||
if (DebugFlags().cpu.has_sse2() && system_cpu_support_sse2()) {
|
||||
return KernelInfo("SSE2", kernel_sse2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return KernelInfo("default", kernel_default);
|
||||
}
|
||||
|
||||
|
|
|
@ -661,9 +661,7 @@ void HIPDevice::tex_alloc(device_texture &mem)
|
|||
address_mode = hipAddressModeClamp;
|
||||
break;
|
||||
case EXTENSION_CLIP:
|
||||
/* TODO(@arya): setting this to Mode Clamp instead of Mode Border
|
||||
* because it's unsupported in HIP. */
|
||||
address_mode = hipAddressModeClamp;
|
||||
address_mode = hipAddressModeBorder;
|
||||
break;
|
||||
case EXTENSION_MIRROR:
|
||||
address_mode = hipAddressModeMirror;
|
||||
|
@ -855,7 +853,11 @@ void HIPDevice::tex_alloc(device_texture &mem)
|
|||
thread_scoped_lock lock(device_mem_map_mutex);
|
||||
cmem = &device_mem_map[&mem];
|
||||
|
||||
hip_assert(hipTexObjectCreate(&cmem->texobject, &resDesc, &texDesc, NULL));
|
||||
if (hipTexObjectCreate(&cmem->texobject, &resDesc, &texDesc, NULL) != hipSuccess) {
|
||||
set_error(
|
||||
"Failed to create texture. Maximum GPU texture size or available GPU memory was likely "
|
||||
"exceeded.");
|
||||
}
|
||||
|
||||
texture_info[slot].data = (uint64_t)cmem->texobject;
|
||||
}
|
||||
|
|
|
@ -523,7 +523,7 @@ bool MetalDeviceQueue::enqueue(DeviceKernel kernel,
|
|||
break;
|
||||
}
|
||||
|
||||
if (bvhMetalRT) {
|
||||
if (bvhMetalRT && bvhMetalRT->accel_struct) {
|
||||
/* Mark all Accelerations resources as used */
|
||||
[mtlComputeCommandEncoder useResource:bvhMetalRT->accel_struct
|
||||
usage:MTLResourceUsageRead];
|
||||
|
|
|
@ -866,7 +866,7 @@ static const int lowest_supported_driver_version_win = 1015186;
|
|||
* This information is returned by `ocloc query OCL_DRIVER_VERSION`.*/
|
||||
static const int lowest_supported_driver_version_neo = 28044;
|
||||
# else
|
||||
static const int lowest_supported_driver_version_neo = 26918;
|
||||
static const int lowest_supported_driver_version_neo = 27642;
|
||||
# endif
|
||||
|
||||
int parse_driver_build_version(const sycl::device &device)
|
||||
|
|
|
@ -14,7 +14,6 @@ set(INC_SYS
|
|||
|
||||
set(SRC_KERNEL_DEVICE_CPU
|
||||
device/cpu/kernel.cpp
|
||||
device/cpu/kernel_sse2.cpp
|
||||
device/cpu/kernel_sse42.cpp
|
||||
device/cpu/kernel_avx2.cpp
|
||||
)
|
||||
|
@ -883,7 +882,7 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||
|
||||
# Set defaults for spir64 and spir64_gen options
|
||||
if(NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64)
|
||||
set(CYCLES_ONEAPI_SYCL_OPTIONS_spir64 "-options '-ze-opt-regular-grf-kernel integrator_intersect -ze-opt-large-grf-kernel shade -ze-opt-no-local-to-generic'")
|
||||
set(CYCLES_ONEAPI_SYCL_OPTIONS_spir64 "-options '-ze-opt-large-register-file -ze-opt-regular-grf-kernel integrator_intersect -ze-opt-large-grf-kernel shade -ze-opt-no-local-to-generic'")
|
||||
endif()
|
||||
if(NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen)
|
||||
set(CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "${CYCLES_ONEAPI_SYCL_OPTIONS_spir64}" CACHE STRING "Extra build options for spir64_gen target")
|
||||
|
@ -1163,8 +1162,7 @@ endif()
|
|||
|
||||
set_source_files_properties(device/cpu/kernel.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_KERNEL_FLAGS}")
|
||||
|
||||
if(CXX_HAS_SSE)
|
||||
set_source_files_properties(device/cpu/kernel_sse2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE2_KERNEL_FLAGS}")
|
||||
if(CXX_HAS_SSE42)
|
||||
set_source_files_properties(device/cpu/kernel_sse42.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE42_KERNEL_FLAGS}")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -4,31 +4,25 @@
|
|||
|
||||
/* CPU kernel entry points */
|
||||
|
||||
/* On x86-64, we can assume SSE2, so avoid the extra kernel and compile this
|
||||
* one with SSE2 intrinsics.
|
||||
/* On x86-64, our minimum is SSE4.2, so avoid the extra kernel and compile this
|
||||
* one with SSE4.2 intrinsics.
|
||||
*/
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
# define __KERNEL_SSE__
|
||||
# define __KERNEL_SSE2__
|
||||
# define __KERNEL_SSE3__
|
||||
# define __KERNEL_SSSE3__
|
||||
# define __KERNEL_SSE42__
|
||||
#endif
|
||||
|
||||
/* When building kernel for native machine detect kernel features from the flags
|
||||
* set by compiler.
|
||||
*/
|
||||
#ifdef WITH_KERNEL_NATIVE
|
||||
# ifdef __SSE2__
|
||||
# ifndef __KERNEL_SSE2__
|
||||
# define __KERNEL_SSE2__
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __SSE3__
|
||||
# define __KERNEL_SSE3__
|
||||
# endif
|
||||
# ifdef __SSSE3__
|
||||
# define __KERNEL_SSSE3__
|
||||
# endif
|
||||
# ifdef __SSE4_2__
|
||||
# define __KERNEL_SSE42__
|
||||
# ifndef __KERNEL_SSE42__
|
||||
# define __KERNEL_SSE42__
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __AVX__
|
||||
# ifndef __KERNEL_SSE__
|
||||
|
|
|
@ -33,9 +33,6 @@ void kernel_global_memory_copy(KernelGlobalsCPU *kg, const char *name, void *mem
|
|||
#define KERNEL_ARCH cpu
|
||||
#include "kernel/device/cpu/kernel_arch.h"
|
||||
|
||||
#define KERNEL_ARCH cpu_sse2
|
||||
#include "kernel/device/cpu/kernel_arch.h"
|
||||
|
||||
#define KERNEL_ARCH cpu_sse42
|
||||
#include "kernel/device/cpu/kernel_arch.h"
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
/* Optimized CPU kernel entry points. This file is compiled with SSE2
|
||||
* optimization flags and nearly all functions inlined, while kernel.cpp
|
||||
* is compiled without for other CPU's. */
|
||||
|
||||
#include "util/optimization.h"
|
||||
|
||||
#ifndef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
|
||||
# define KERNEL_STUB
|
||||
#else
|
||||
/* SSE optimization disabled for now on 32 bit, see bug #36316. */
|
||||
# if !(defined(__GNUC__) && (defined(i386) || defined(_M_IX86)))
|
||||
# define __KERNEL_SSE2__
|
||||
# endif
|
||||
#endif /* WITH_CYCLES_OPTIMIZED_KERNEL_SSE2 */
|
||||
|
||||
#include "kernel/device/cpu/kernel.h"
|
||||
#define KERNEL_ARCH cpu_sse2
|
||||
#include "kernel/device/cpu/kernel_arch_impl.h"
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
/* Optimized CPU kernel entry points. This file is compiled with SSE3/SSSE3
|
||||
/* Optimized CPU kernel entry points. This file is compiled with SSE42
|
||||
* optimization flags and nearly all functions inlined, while kernel.cpp
|
||||
* is compiled without for other CPU's. */
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
|||
#else
|
||||
/* SSE optimization disabled for now on 32 bit, see bug #36316. */
|
||||
# if !(defined(__GNUC__) && (defined(i386) || defined(_M_IX86)))
|
||||
# define __KERNEL_SSE__
|
||||
# define __KERNEL_SSE2__
|
||||
# define __KERNEL_SSE3__
|
||||
# define __KERNEL_SSSE3__
|
||||
|
|
|
@ -955,22 +955,6 @@ ccl_device Spectrum surface_shader_transparency(KernelGlobals kg, ccl_private co
|
|||
}
|
||||
}
|
||||
|
||||
ccl_device void surface_shader_disable_transparency(KernelGlobals kg, ccl_private ShaderData *sd)
|
||||
{
|
||||
if (sd->flag & SD_TRANSPARENT) {
|
||||
for (int i = 0; i < sd->num_closure; i++) {
|
||||
ccl_private ShaderClosure *sc = &sd->closure[i];
|
||||
|
||||
if (sc->type == CLOSURE_BSDF_TRANSPARENT_ID) {
|
||||
sc->sample_weight = 0.0f;
|
||||
sc->weight = zero_spectrum();
|
||||
}
|
||||
}
|
||||
|
||||
sd->flag &= ~SD_TRANSPARENT;
|
||||
}
|
||||
}
|
||||
|
||||
ccl_device Spectrum surface_shader_alpha(KernelGlobals kg, ccl_private const ShaderData *sd)
|
||||
{
|
||||
Spectrum alpha = one_spectrum() - surface_shader_transparency(kg, sd);
|
||||
|
|
|
@ -16,8 +16,8 @@ static bool validate_cpu_capabilities()
|
|||
return system_cpu_support_avx2();
|
||||
#elif defined(__KERNEL_AVX__)
|
||||
return system_cpu_support_avx();
|
||||
#elif defined(__KERNEL_SSE2__)
|
||||
return system_cpu_support_sse2();
|
||||
#elif defined(__KERNEL_SSE42__)
|
||||
return system_cpu_support_sse42();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,6 @@ set(SRC
|
|||
path.cpp
|
||||
profiling.cpp
|
||||
string.cpp
|
||||
simd.cpp
|
||||
system.cpp
|
||||
task.cpp
|
||||
thread.cpp
|
||||
|
@ -136,7 +135,7 @@ set(SRC_HEADERS
|
|||
xml.h
|
||||
)
|
||||
|
||||
if(CXX_HAS_SSE)
|
||||
if(CXX_HAS_SSE42)
|
||||
set_source_files_properties(transform_sse42.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE42_KERNEL_FLAGS}")
|
||||
endif()
|
||||
if(CXX_HAS_AVX2)
|
||||
|
|
|
@ -31,7 +31,6 @@ void DebugFlags::CPU::reset()
|
|||
|
||||
CHECK_CPU_FLAGS(avx2, "CYCLES_CPU_NO_AVX2");
|
||||
CHECK_CPU_FLAGS(sse42, "CYCLES_CPU_NO_SSE42");
|
||||
CHECK_CPU_FLAGS(sse2, "CYCLES_CPU_NO_SSE2");
|
||||
|
||||
#undef STRINGIFY
|
||||
#undef CHECK_CPU_FLAGS
|
||||
|
|
|
@ -27,7 +27,6 @@ class DebugFlags {
|
|||
/* Flags describing which instructions sets are allowed for use. */
|
||||
bool avx2 = true;
|
||||
bool sse42 = true;
|
||||
bool sse2 = true;
|
||||
|
||||
/* Check functions to see whether instructions up to the given one
|
||||
* are allowed for use.
|
||||
|
@ -38,11 +37,7 @@ class DebugFlags {
|
|||
}
|
||||
bool has_sse42()
|
||||
{
|
||||
return has_sse2() && sse42;
|
||||
}
|
||||
bool has_sse2()
|
||||
{
|
||||
return sse2;
|
||||
return sse42;
|
||||
}
|
||||
|
||||
/* Requested BVH layout.
|
||||
|
|
|
@ -9,28 +9,25 @@
|
|||
|
||||
/* x86
|
||||
*
|
||||
* Compile a regular, SSE2 and SSE3 kernel. */
|
||||
* Compile a regular and SSE42 kernel. */
|
||||
|
||||
# if defined(i386) || defined(_M_IX86)
|
||||
|
||||
/* We require minimum SSE2 support on x86, so auto enable. */
|
||||
# define __KERNEL_SSE2__
|
||||
# ifdef WITH_KERNEL_SSE2
|
||||
# define WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
|
||||
/* We require minimum SSE4.2 support on x86, so auto enable. */
|
||||
# define __KERNEL_SSE42__
|
||||
# ifdef WITH_KERNEL_SSE42
|
||||
# define WITH_CYCLES_OPTIMIZED_KERNEL_SSE42
|
||||
# endif
|
||||
|
||||
/* x86-64
|
||||
*
|
||||
* Compile a regular (includes SSE2), SSE 4.2 and AVX2 kernel. */
|
||||
* Compile a regular (includes SSE4.2) and AVX2 kernel. */
|
||||
|
||||
# elif defined(__x86_64__) || defined(_M_X64)
|
||||
|
||||
/* SSE2 is always available on x86-64 CPUs, so auto enable */
|
||||
# define __KERNEL_SSE2__
|
||||
/* no SSE2 kernel on x86-64, part of regular kernel */
|
||||
# ifdef WITH_KERNEL_SSE42
|
||||
# define WITH_CYCLES_OPTIMIZED_KERNEL_SSE42
|
||||
# endif
|
||||
/* SSE4.2 is our minimum requirement for x86-64 CPUs, so auto enable */
|
||||
# define __KERNEL_SSE42__
|
||||
/* no SSE4.2 kernel on x86-64, part of regular kernel */
|
||||
# ifdef WITH_KERNEL_AVX2
|
||||
# define WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
|
||||
# endif
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
/* SPDX-FileCopyrightText: 2011-2013 Intel Corporation
|
||||
* SPDX-FileCopyrightText: 2014-2022 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#if (defined(WITH_KERNEL_SSE2)) || (defined(WITH_KERNEL_NATIVE) && defined(__SSE2__))
|
||||
|
||||
# define __KERNEL_SSE2__
|
||||
# include "util/simd.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
const __m128 _mm_lookupmask_ps[16] = {_mm_castsi128_ps(_mm_set_epi32(0, 0, 0, 0)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(0, 0, 0, -1)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(0, 0, -1, 0)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(0, 0, -1, -1)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(0, -1, 0, 0)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(0, -1, 0, -1)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(0, -1, -1, 0)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(0, -1, -1, -1)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(-1, 0, 0, 0)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(-1, 0, 0, -1)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(-1, 0, -1, 0)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(-1, 0, -1, -1)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(-1, -1, 0, 0)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(-1, -1, 0, -1)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(-1, -1, -1, 0)),
|
||||
_mm_castsi128_ps(_mm_set_epi32(-1, -1, -1, -1))};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif // WITH_KERNEL_SSE2
|
|
@ -457,132 +457,12 @@ __forceinline uint64_t bitscan(uint64_t value)
|
|||
|
||||
#endif /* Intrinsics */
|
||||
|
||||
/* SSE compatibility.
|
||||
*
|
||||
* Various utilities to smooth over differences between SSE versions and
|
||||
* implementations. */
|
||||
#ifdef __KERNEL_SSE2__
|
||||
|
||||
/* Test __KERNEL_SSE42__ for MSVC which does not define __SSE4_2__, and test
|
||||
* __SSE4_1__ and __SSE4_2__ to avoid OpenImageIO conflicts with our emulation macros on other
|
||||
* platforms when compiling code outside the kernel. */
|
||||
# if !(defined(__KERNEL_SSE42__) || defined(__SSE4_1__) || defined(__SSE4_2__))
|
||||
|
||||
/* Emulation of SSE4 functions with SSE2 */
|
||||
|
||||
# define _MM_FROUND_TO_NEAREST_INT 0x00
|
||||
# define _MM_FROUND_TO_NEG_INF 0x01
|
||||
# define _MM_FROUND_TO_POS_INF 0x02
|
||||
# define _MM_FROUND_TO_ZERO 0x03
|
||||
# define _MM_FROUND_CUR_DIRECTION 0x04
|
||||
|
||||
# undef _mm_blendv_ps
|
||||
# define _mm_blendv_ps _mm_blendv_ps_emu
|
||||
__forceinline __m128 _mm_blendv_ps_emu(__m128 value, __m128 input, __m128 mask)
|
||||
{
|
||||
__m128i isignmask = _mm_set1_epi32(0x80000000);
|
||||
__m128 signmask = _mm_castsi128_ps(isignmask);
|
||||
__m128i iandsign = _mm_castps_si128(_mm_and_ps(mask, signmask));
|
||||
__m128i icmpmask = _mm_cmpeq_epi32(iandsign, isignmask);
|
||||
__m128 cmpmask = _mm_castsi128_ps(icmpmask);
|
||||
return _mm_or_ps(_mm_and_ps(cmpmask, input), _mm_andnot_ps(cmpmask, value));
|
||||
}
|
||||
|
||||
# undef _mm_blend_ps
|
||||
# define _mm_blend_ps _mm_blend_ps_emu
|
||||
__forceinline __m128 _mm_blend_ps_emu(__m128 value, __m128 input, const int mask)
|
||||
{
|
||||
assert(mask < 0x10);
|
||||
return _mm_blendv_ps(value, input, _mm_lookupmask_ps[mask]);
|
||||
}
|
||||
|
||||
# undef _mm_blendv_epi8
|
||||
# define _mm_blendv_epi8 _mm_blendv_epi8_emu
|
||||
__forceinline __m128i _mm_blendv_epi8_emu(__m128i value, __m128i input, __m128i mask)
|
||||
{
|
||||
return _mm_or_si128(_mm_and_si128(mask, input), _mm_andnot_si128(mask, value));
|
||||
}
|
||||
|
||||
# undef _mm_min_epi32
|
||||
# define _mm_min_epi32 _mm_min_epi32_emu
|
||||
__forceinline __m128i _mm_min_epi32_emu(__m128i value, __m128i input)
|
||||
{
|
||||
return _mm_blendv_epi8(input, value, _mm_cmplt_epi32(value, input));
|
||||
}
|
||||
|
||||
# undef _mm_max_epi32
|
||||
# define _mm_max_epi32 _mm_max_epi32_emu
|
||||
__forceinline __m128i _mm_max_epi32_emu(__m128i value, __m128i input)
|
||||
{
|
||||
return _mm_blendv_epi8(value, input, _mm_cmplt_epi32(value, input));
|
||||
}
|
||||
|
||||
# ifndef __KERNEL_NEON__
|
||||
# undef _mm_extract_epi32
|
||||
# define _mm_extract_epi32 _mm_extract_epi32_emu
|
||||
__forceinline int _mm_extract_epi32_emu(__m128i input, const int index)
|
||||
{
|
||||
switch (index) {
|
||||
case 0:
|
||||
return _mm_cvtsi128_si32(input);
|
||||
case 1:
|
||||
return _mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(1, 1, 1, 1)));
|
||||
case 2:
|
||||
return _mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(2, 2, 2, 2)));
|
||||
case 3:
|
||||
return _mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(3, 3, 3, 3)));
|
||||
default:
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
# undef _mm_insert_epi32
|
||||
# define _mm_insert_epi32 _mm_insert_epi32_emu
|
||||
__forceinline __m128i _mm_insert_epi32_emu(__m128i value, int input, const int index)
|
||||
{
|
||||
assert(index >= 0 && index < 4);
|
||||
((int *)&value)[index] = input;
|
||||
return value;
|
||||
}
|
||||
|
||||
# undef _mm_insert_ps
|
||||
# define _mm_insert_ps _mm_insert_ps_emu
|
||||
__forceinline __m128 _mm_insert_ps_emu(__m128 value, __m128 input, const int index)
|
||||
{
|
||||
assert(index < 0x100);
|
||||
((float *)&value)[(index >> 4) & 0x3] = ((float *)&input)[index >> 6];
|
||||
return _mm_andnot_ps(_mm_lookupmask_ps[index & 0xf], value);
|
||||
}
|
||||
|
||||
# undef _mm_round_ps
|
||||
# define _mm_round_ps _mm_round_ps_emu
|
||||
__forceinline __m128 _mm_round_ps_emu(__m128 value, const int flags)
|
||||
{
|
||||
switch (flags) {
|
||||
case _MM_FROUND_TO_NEAREST_INT:
|
||||
return _mm_cvtepi32_ps(_mm_cvtps_epi32(value));
|
||||
case _MM_FROUND_TO_NEG_INF:
|
||||
return _mm_cvtepi32_ps(_mm_cvtps_epi32(_mm_add_ps(value, _mm_set1_ps(-0.5f))));
|
||||
case _MM_FROUND_TO_POS_INF:
|
||||
return _mm_cvtepi32_ps(_mm_cvtps_epi32(_mm_add_ps(value, _mm_set1_ps(0.5f))));
|
||||
case _MM_FROUND_TO_ZERO:
|
||||
return _mm_cvtepi32_ps(_mm_cvttps_epi32(value));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
# endif /* !(defined(__KERNEL_SSE42__) || defined(__SSE4_1__) || defined(__SSE4_2__)) */
|
||||
|
||||
/* Older GCC versions do not have _mm256_cvtss_f32 yet, so define it ourselves.
|
||||
* _mm256_castps256_ps128 generates no instructions so this is just as efficient. */
|
||||
# if defined(__KERNEL_AVX__) || defined(__KERNEL_AVX2__)
|
||||
# undef _mm256_cvtss_f32
|
||||
# define _mm256_cvtss_f32(a) (_mm_cvtss_f32(_mm256_castps256_ps128(a)))
|
||||
# endif
|
||||
|
||||
#endif /* __KERNEL_SSE2__ */
|
||||
#if defined(__KERNEL_AVX__) || defined(__KERNEL_AVX2__)
|
||||
# undef _mm256_cvtss_f32
|
||||
# define _mm256_cvtss_f32(a) (_mm_cvtss_f32(_mm256_castps256_ps128(a)))
|
||||
#endif
|
||||
|
||||
/* quiet unused define warnings */
|
||||
#if defined(__KERNEL_SSE2__) || defined(__KERNEL_SSE3__) || defined(__KERNEL_SSSE3__) || \
|
||||
|
|
|
@ -129,7 +129,6 @@ int system_cpu_bits()
|
|||
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
|
||||
|
||||
struct CPUCapabilities {
|
||||
bool sse2;
|
||||
bool sse42;
|
||||
bool avx2;
|
||||
};
|
||||
|
@ -160,7 +159,6 @@ static CPUCapabilities &system_cpu_capabilities()
|
|||
const bool cpu_avx_support = (result[2] & ((int)1 << 28)) != 0;
|
||||
|
||||
/* Simplify to combined capabilities for which we specialize kernels. */
|
||||
caps.sse2 = sse && sse2;
|
||||
caps.sse42 = sse && sse2 && sse3 && ssse3 && sse41 && sse42;
|
||||
|
||||
if (os_uses_xsave_xrestore && cpu_avx_support) {
|
||||
|
@ -195,12 +193,6 @@ static CPUCapabilities &system_cpu_capabilities()
|
|||
return caps;
|
||||
}
|
||||
|
||||
bool system_cpu_support_sse2()
|
||||
{
|
||||
CPUCapabilities &caps = system_cpu_capabilities();
|
||||
return caps.sse2;
|
||||
}
|
||||
|
||||
bool system_cpu_support_sse42()
|
||||
{
|
||||
CPUCapabilities &caps = system_cpu_capabilities();
|
||||
|
@ -214,11 +206,6 @@ bool system_cpu_support_avx2()
|
|||
}
|
||||
#else
|
||||
|
||||
bool system_cpu_support_sse2()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool system_cpu_support_sse42()
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -17,7 +17,6 @@ int system_console_width();
|
|||
|
||||
std::string system_cpu_brand_string();
|
||||
int system_cpu_bits();
|
||||
bool system_cpu_support_sse2();
|
||||
bool system_cpu_support_sse42();
|
||||
bool system_cpu_support_avx2();
|
||||
|
||||
|
|
|
@ -79,6 +79,15 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Queue configuration calls until a valid window frame size is available.
|
||||
* This is needed because LIBDECOR has an issue where windows initialized with a zero
|
||||
* size don't have a usable title bar. see #117583.
|
||||
*/
|
||||
#ifdef USE_LIBDECOR_CONFIG_COPY_WORKAROUND
|
||||
# define USE_LIBDECOR_CONFIG_COPY_QUEUE
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIBDECOR_CONFIG_COPY_WORKAROUND
|
||||
static libdecor_configuration *ghost_wl_libdecor_configuration_copy(
|
||||
const libdecor_configuration *configuration);
|
||||
|
@ -112,6 +121,15 @@ struct GWL_LibDecor_Window {
|
|||
# ifdef USE_LIBDECOR_CONFIG_COPY_WORKAROUND
|
||||
bool configuration_needs_free = false;
|
||||
# endif
|
||||
|
||||
# ifdef USE_LIBDECOR_CONFIG_COPY_QUEUE
|
||||
/**
|
||||
* Queue configurations which cannot be applied because the window size isn't know.
|
||||
* All items in this list are allocated.
|
||||
*/
|
||||
std::vector<libdecor_configuration *> configuration_queue;
|
||||
# endif
|
||||
|
||||
} pending;
|
||||
|
||||
/** The window has been configured (see #xdg_surface_ack_configure). */
|
||||
|
@ -124,7 +142,16 @@ static void gwl_libdecor_window_destroy(GWL_LibDecor_Window *decor)
|
|||
if (decor->pending.configuration_needs_free) {
|
||||
ghost_wl_libdecor_configuration_free(decor->pending.configuration);
|
||||
}
|
||||
|
||||
# endif /* USE_LIBDECOR_CONFIG_COPY_WORKAROUND */
|
||||
|
||||
# ifdef USE_LIBDECOR_CONFIG_COPY_QUEUE
|
||||
for (libdecor_configuration *configuration : decor->pending.configuration_queue) {
|
||||
ghost_wl_libdecor_configuration_free(configuration);
|
||||
}
|
||||
decor->pending.configuration_queue.clear();
|
||||
# endif /* USE_LIBDECOR_CONFIG_COPY_QUEUE */
|
||||
|
||||
libdecor_frame_unref(decor->frame);
|
||||
delete decor;
|
||||
}
|
||||
|
@ -888,13 +915,21 @@ static void gwl_window_frame_update_from_pending_no_lock(GWL_Window *win)
|
|||
|
||||
decor.pending.ack_configure = false;
|
||||
|
||||
libdecor_configuration *configuration = decor.pending.configuration;
|
||||
|
||||
libdecor_state *state = libdecor_state_new(UNPACK2(decor.pending.size));
|
||||
libdecor_frame_commit(decor.frame, state, configuration);
|
||||
|
||||
# ifdef USE_LIBDECOR_CONFIG_COPY_QUEUE
|
||||
GHOST_ASSERT(decor.pending.size[0] != 0 && decor.pending.size[1] != 0, "Invalid size");
|
||||
for (libdecor_configuration *configuration : decor.pending.configuration_queue) {
|
||||
libdecor_frame_commit(decor.frame, state, configuration);
|
||||
ghost_wl_libdecor_configuration_free(configuration);
|
||||
}
|
||||
decor.pending.configuration_queue.clear();
|
||||
# endif
|
||||
|
||||
libdecor_frame_commit(decor.frame, state, decor.pending.configuration);
|
||||
|
||||
libdecor_state_free(state);
|
||||
|
||||
decor.pending.configuration = nullptr;
|
||||
decor.pending.size[0] = 0;
|
||||
decor.pending.size[1] = 0;
|
||||
|
||||
|
@ -906,6 +941,8 @@ static void gwl_window_frame_update_from_pending_no_lock(GWL_Window *win)
|
|||
decor.pending.configuration_needs_free = false;
|
||||
}
|
||||
# endif
|
||||
|
||||
decor.pending.configuration = nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1300,6 +1337,14 @@ static void libdecor_frame_handle_configure(libdecor_frame *frame,
|
|||
* the buffer scale will be 1, rounding is a requirement until then. */
|
||||
gwl_round_int2_by(frame_pending.size, win->frame.buffer_scale);
|
||||
}
|
||||
else {
|
||||
/* These values are cleared after use & will practically always be zero.
|
||||
* Read them because it's possible multiple configure calls run before they can be handled.
|
||||
*/
|
||||
GWL_LibDecor_Window &decor = *win->libdecor;
|
||||
size_next[0] = decor.pending.size[0];
|
||||
size_next[1] = decor.pending.size[1];
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the state. */
|
||||
|
@ -1312,7 +1357,7 @@ static void libdecor_frame_handle_configure(libdecor_frame *frame,
|
|||
}
|
||||
}
|
||||
|
||||
if (size_next[0] && size_next[1]) {
|
||||
{
|
||||
GWL_Window *win = static_cast<GWL_Window *>(data);
|
||||
GWL_LibDecor_Window &decor = *win->libdecor;
|
||||
|
||||
|
@ -1339,6 +1384,23 @@ static void libdecor_frame_handle_configure(libdecor_frame *frame,
|
|||
decor.pending.configuration = nullptr;
|
||||
# endif /* !USE_LIBDECOR_CONFIG_COPY_WORKAROUND */
|
||||
}
|
||||
|
||||
# ifdef USE_LIBDECOR_CONFIG_COPY_QUEUE
|
||||
if (!(size_next[0] && size_next[1])) {
|
||||
/* Always copy. */
|
||||
if (decor.pending.configuration_needs_free == false) {
|
||||
decor.pending.configuration = ghost_wl_libdecor_configuration_copy(
|
||||
decor.pending.configuration);
|
||||
decor.pending.configuration_needs_free = true;
|
||||
}
|
||||
/* Transfer ownership to the queue. */
|
||||
decor.pending.configuration_queue.push_back(decor.pending.configuration);
|
||||
decor.pending.configuration = nullptr;
|
||||
decor.pending.configuration_needs_free = false;
|
||||
/* Wait until we have a valid size. */
|
||||
decor.pending.ack_configure = false;
|
||||
}
|
||||
# endif /* USE_LIBDECOR_CONFIG_COPY_QUEUE */
|
||||
}
|
||||
|
||||
/* Apply & commit the changes. */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Blender 4.1.0 Beta (b'09ff1b1f7e3f')\n"
|
||||
"Project-Id-Version: Blender 4.1.0 Beta (b'e938b516a994')\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"\"POT-Creation-Date: 2019-02-25 20:41:30\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue