Skip to content

Commit c760f26

Browse files
committed
Merge branch 'next_release'
2 parents 7e64fd1 + d0212ed commit c760f26

File tree

7 files changed

+84
-30
lines changed

7 files changed

+84
-30
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
4646
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
4747
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
4848

49-
project(VisRTX VERSION 0.6.0 LANGUAGES C CXX)
49+
project(VisRTX VERSION 0.6.1 LANGUAGES C CXX)
5050

5151
include(GNUInstallDirs)
5252

@@ -71,7 +71,7 @@ endif()
7171

7272
# ANARI-SDK
7373
set(ANARI_REQUIRED_VERSION 0.7.0)
74-
find_package(anari ${ANARI_REQUIRED_VERSION} EXACT REQUIRED)
74+
find_package(anari ${ANARI_REQUIRED_VERSION} REQUIRED)
7575

7676
# CUDA
7777
find_package(CUDAToolkit 11.3.1)

cmake/VisRTXConfig.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
include(CMakeFindDependencyMacro)
3333

34-
find_dependency(anari @ANARI_REQUIRED_VERSION@ EXACT)
34+
find_dependency(anari @ANARI_REQUIRED_VERSION@)
3535

3636
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_Exports.cmake")
3737

devices/gl/CMakeLists.txt

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2828
# POSSIBILITY OF SUCH DAMAGE.
2929

30+
include(GenerateExportHeader)
31+
3032
set(CMAKE_CXX_STANDARD 11)
3133

3234
project(anari_library_visgl LANGUAGES CXX)
@@ -87,23 +89,39 @@ add_library(${PROJECT_NAME} SHARED
8789
src/glad/src/gl.c
8890
)
8991

92+
generate_export_header(${PROJECT_NAME}
93+
EXPORT_MACRO_NAME "VISGL_DEVICE_INTERFACE"
94+
)
95+
9096
target_include_directories(${PROJECT_NAME}
9197
PUBLIC
9298
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
93-
generated
94-
src
95-
src/glad/include
96-
src/egl/
97-
src/glx/
99+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/generated>
100+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
101+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/glad/include>
102+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/egl>
103+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/glx>
104+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
98105
)
99106

100107
target_link_libraries(${PROJECT_NAME}
101108
PUBLIC
102109
anari::anari
103-
OpenGL::OpenGL
104110
Threads::Threads
105111
)
106112

113+
if(WIN32)
114+
target_link_libraries(${PROJECT_NAME}
115+
PUBLIC
116+
OpenGL::GL
117+
)
118+
else()
119+
target_link_libraries(${PROJECT_NAME}
120+
PUBLIC
121+
OpenGL::OpenGL
122+
)
123+
endif()
124+
107125
if(OpenGL_EGL_FOUND)
108126
target_sources(${PROJECT_NAME} PRIVATE
109127
src/egl/egl_context.cpp
@@ -130,7 +148,7 @@ if(OpenGL_GLX_FOUND AND X11_FOUND)
130148
)
131149
target_include_directories(${PROJECT_NAME}
132150
PUBLIC
133-
X11_INCLUDE_DIR
151+
${X11_INCLUDE_DIR}
134152
)
135153

136154
target_compile_definitions(${PROJECT_NAME}
@@ -144,8 +162,36 @@ PRIVATE
144162
"anari_library_visgl_EXPORTS"
145163
)
146164

165+
if (MSVC)
166+
target_compile_options(${PROJECT_NAME}
167+
PRIVATE
168+
"/bigobj"
169+
)
170+
endif()
171+
147172
install(TARGETS ${PROJECT_NAME}
173+
EXPORT VisGL_Exports
148174
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
149175
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
150176
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
151177
)
178+
179+
if (VISRTX_USE_SOVERSION)
180+
set_target_properties(${PROJECT_NAME}
181+
PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
182+
183+
install(TARGETS ${PROJECT_NAME}
184+
EXPORT VisGL_Exports
185+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
186+
NAMELINK_SKIP
187+
# on Windows put the dlls into bin
188+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
189+
# ... and the import lib into the devel package
190+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
191+
)
192+
endif()
193+
194+
install(EXPORT VisGL_Exports
195+
DESTINATION ${VISRTX_CMAKE_INSTALL_DESTINATION}
196+
NAMESPACE VisGL::
197+
)

devices/gl/src/ConcurrentArray.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
#include <atomic>
3737
#include <mutex>
3838

39+
#ifdef _WIN32
40+
#include <intrin.h>
41+
#endif
42+
3943
// This is an array of exponentially growing chunks
4044
// Only addition of elements needs to be protected
4145
// by a lock while elements remain accessible even
@@ -52,7 +56,22 @@ class ConcurrentArray
5256

5357
static uint64_t msb(uint64_t x)
5458
{
59+
#ifdef _WIN64
60+
unsigned long index;
61+
_BitScanReverse64(&index, x);
62+
return index;
63+
#elif defined(_WIN32)
64+
unsigned long index;
65+
if (x >> 32) {
66+
_BitScanReverse(&index, x >> 32);
67+
return index + 32;
68+
} else {
69+
_BitScanReverse(&index, x);
70+
return index;
71+
}
72+
#else
5573
return UINT64_C(63) - __builtin_clzll(x);
74+
#endif
5675
}
5776
static uint64_t block(uint64_t i)
5877
{

devices/gl/src/VisGLLibrary.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,7 @@
3131

3232
#include "VisGLDevice.h"
3333
#include "anari/backend/LibraryImpl.h"
34-
35-
#ifdef _WIN32
36-
#ifdef DEVICE_STATIC_DEFINE
37-
#define DEVICE_INTERFACE
38-
#else
39-
#ifdef anari_library_VisGL_EXPORTS
40-
#define DEVICE_INTERFACE __declspec(dllexport)
41-
#else
42-
#define DEVICE_INTERFACE __declspec(dllimport)
43-
#endif
44-
#endif
45-
#elif defined __GNUC__
46-
#define DEVICE_INTERFACE __attribute__((__visibility__("default")))
47-
#else
48-
#define DEVICE_INTERFACE
49-
#endif
34+
#include "anari_library_visgl_export.h"
5035

5136
namespace visgl {
5237

@@ -82,7 +67,7 @@ const char **VisGLLibrary::getDeviceExtensions(const char * /*deviceType*/)
8267

8368
// Define library entrypoint //////////////////////////////////////////////////
8469

85-
extern "C" DEVICE_INTERFACE ANARI_DEFINE_LIBRARY_ENTRYPOINT(
70+
extern "C" VISGL_DEVICE_INTERFACE ANARI_DEFINE_LIBRARY_ENTRYPOINT(
8671
visgl, handle, scb, scbPtr)
8772
{
8873
return (ANARILibrary) new visgl::VisGLLibrary(handle, scb, scbPtr);

devices/rtx/VisRTXDevice.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,11 @@ VisRTXDevice::VisRTXDevice(ANARILibrary l) : helium::BaseDevice(l)
418418

419419
VisRTXDevice::~VisRTXDevice()
420420
{
421-
if (m_state.get() == nullptr)
422-
return;
423-
424421
reportMessage(ANARI_SEVERITY_DEBUG, "destroying VisRTX device");
425422

423+
if (!m_initialized)
424+
return;
425+
426426
auto &state = *deviceState();
427427

428428
clearCommitBuffer();

devices/rtx/optix_visrtx.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
#include <stdexcept>
4848
#include <vector>
4949

50+
#ifdef OPAQUE
51+
#undef OPAQUE
52+
#endif
53+
5054
constexpr int PAYLOAD_VALUES = 5;
5155
constexpr int ATTRIBUTE_VALUES = 4;
5256

0 commit comments

Comments
 (0)