Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
with:
image: rockylinux:8
dpcpp-version: intel/2025.1
cmd: |
module load intel/2022.1
export CC=icx
export CXX=icpx
export LDFLAGS="-static-intel"
Expand Down
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@

## Global CMake options ##

if (RKCOMMON_TASKING_SYSTEM STREQUAL "OpenMP")
cmake_minimum_required(VERSION 3.9) # NOTE(jda): rely on OpenMP targets
else()
cmake_minimum_required(VERSION 3.5)
endif()
cmake_minimum_required(VERSION 3.10)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ used by various components of Intel® Rendering Toolkit (Render Kit).

### Requirements

- CMake
- CMake v3.10 or higher
- C++11 compiler
- TBB 4.4.3 or higher (by default, other tasking system options available via
the `RKCOMMON_TASKING_SYSTEM` CMake variable)
Expand Down
3 changes: 1 addition & 2 deletions cmake/FindTBB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
#
#===============================================================================

# We use INTERFACE libraries, which are only supported in 3.x
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.10)

# These two are used to automatically find the root and include directories.
set(_TBB_INCLUDE_SUBDIR "include")
Expand Down
43 changes: 2 additions & 41 deletions cmake/rkcommon_macros.cmake
Original file line number Diff line number Diff line change
@@ -1,45 +1,6 @@
## Copyright 2009 Intel Corporation
## SPDX-License-Identifier: Apache-2.0

# use a backported version of find_dependency(), renamed as
# find_dependency_39(), from CMake 3.9.0, which correctly supports passing
# components to find_package(). this allows us to maintain our current minimum
# CMake version of 3.1.
macro(find_dependency_39 dep)
if (NOT ${dep}_FOUND)
set(cmake_fd_quiet_arg)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(cmake_fd_quiet_arg QUIET)
endif()
set(cmake_fd_required_arg)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
set(cmake_fd_required_arg REQUIRED)
endif()

get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY
_CMAKE_${dep}_TRANSITIVE_DEPENDENCY
)

find_package(${dep} ${ARGN}
${cmake_fd_quiet_arg}
${cmake_fd_required_arg}
)

if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive)
set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE)
endif()

if (NOT ${dep}_FOUND)
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
return()
endif()
set(cmake_fd_required_arg)
set(cmake_fd_quiet_arg)
set(cmake_fd_exact_arg)
endif()
endmacro()

## Macro for printing CMake variables ##
macro(print var)
message("${var} = ${${var}}")
Expand Down Expand Up @@ -210,7 +171,7 @@ macro(rkcommon_create_tasking_target FROM_INSTALL)
# If not found try getting older TBB via module (FindTBB.cmake)
unset(TBB_DIR CACHE)
if (${FROM_INSTALL})
find_dependency_39(TBB 4.4 REQUIRED tbb tbbmalloc)
find_dependency(TBB 4.4 REQUIRED tbb tbbmalloc)
else()
find_package(TBB 4.4 REQUIRED tbb tbbmalloc)
endif()
Expand All @@ -220,7 +181,7 @@ macro(rkcommon_create_tasking_target FROM_INSTALL)
endif()
endif()
elseif(RKCOMMON_TASKING_OPENMP)
find_dependency_39(OpenMP)
find_dependency(OpenMP)
if (OPENMP_FOUND)
list(APPEND RKCOMMON_TASKING_LIBS OpenMP::OpenMP_CXX)
set(RKCOMMON_TASKING_DEFINITIONS RKCOMMON_TASKING_OMP)
Expand Down
13 changes: 9 additions & 4 deletions rkcommon/math/LinearSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,15 @@ namespace rkcommon {
template <typename T>
inline LinearSpace3<T> frame(const T &N)
{
const T dx0 = cross(T(one, zero, zero), N);
const T dx1 = cross(T(zero, one, zero), N);
const T dx = normalize(dot(dx0, dx0) > dot(dx1, dx1) ? dx0 : dx1);
const T dy = normalize(cross(N, dx));
// Duff et al., "Building an Orthonormal Basis, Revisited", JCGT 2017
const typename T::Scalar sgn = N.z < (typename T::Scalar)zero
? -(typename T::Scalar)one
: (typename T::Scalar)one;
const typename T::Scalar a = -(typename T::Scalar)one / (sgn + N.z);
const typename T::Scalar b = N.x * N.y * a;
const T dx =
T((typename T::Scalar)one + sgn * N.x * N.x * a, sgn * b, -sgn * N.x);
const T dy = T(b, sgn + N.y * N.y * a, -N.y);
return LinearSpace3<T>(dx, dy, N);
}

Expand Down
11 changes: 7 additions & 4 deletions rkcommon/math/LinearSpace.ih
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,13 @@ __define_comp_ops();
*/ \
inline univary LinearSpace3f frame(const univary vec3f N) \
{ \
const univary vec3f dx0 = make_vec3f(0.0f, N.z, -N.y); \
const univary vec3f dx1 = make_vec3f(-N.z, 0.0f, N.x); \
const univary vec3f dx = normalize(abs(N.x) < abs(N.y) ? dx0 : dx1); \
const univary vec3f dy = cross(N, dx); \
/* Duff et al., "Building an Orthonormal Basis, Revisited", JCGT 2017 */ \
const univary float sgn = N.z < 0.0f ? -1.0f : 1.0f; \
const univary float a = -1.0f / (sgn + N.z); \
const univary float b = N.x * N.y * a; \
const univary vec3f dx = \
make_vec3f(1.0f + sgn * N.x * N.x * a, sgn * b, -sgn * N.x); \
const univary vec3f dy = make_vec3f(b, sgn + N.y * N.y * a, -N.y); \
return make_LinearSpace3f(dx, dy, N); \
} \
inline univary LinearSpace3f rcp(const univary LinearSpace3f l) \
Expand Down