diff --git a/CLW/CMakeLists.txt b/CLW/CMakeLists.txt index d853cef5..6d42036d 100644 --- a/CLW/CMakeLists.txt +++ b/CLW/CMakeLists.txt @@ -11,11 +11,26 @@ set(SOURCES CLWPlatform.cpp CLWProgram.cpp ParameterHolder.cpp - ReferenceCounter.cpp) + ReferenceCounter.cpp + CLW.h + CLWBuffer.h + CLWCommandQueue.h + CLWContext.h + CLWDevice.h + CLWEvent.h + CLWExcept.h + CLWImage2D.h + CLWKernel.h + CLWParallelPrimitives.h + CLWPlatform.h + CLWProgram.h + ParameterHolder.h + ReferenceCounter.h + ) set(SHADER CL/CLW.cl) - -add_library(CLW STATIC ${SOURCES}) +source_group("CL" ${SHADER}) +add_library(CLW STATIC ${SOURCES} ${SHADER}) if (UNIX) target_compile_options(CLW PUBLIC -std=c++11 -fPIC) @@ -32,12 +47,12 @@ endif(RR_ALLOW_CPU_DEVICES) #CLW always embed its kernels target_compile_definitions(CLW PRIVATE RR_EMBED_KERNELS=1) add_custom_command( - OUTPUT ${CLW_BINARY_DIR}/clwkernels_cl.h - COMMAND ${PYTHON_EXECUTABLE} ${STRINGIFY_SCRIPT} ${CLW_SOURCE_DIR}/CL/ .cl opencl > ${CLW_BINARY_DIR}/clwkernels_cl.h - MAIN_DEPENDENCY ${SHADER} + OUTPUT "${CLW_BINARY_DIR}/clwkernels_cl.h" + COMMAND "${PYTHON_EXECUTABLE}" "${STRINGIFY_SCRIPT}" "${CLW_SOURCE_DIR}/CL/" .cl opencl > "${CLW_BINARY_DIR}/clwkernels_cl.h" + MAIN_DEPENDENCY "${SHADER}" COMMENT "Generating CLW kernel cache" VERBATIM) -target_include_directories(CLW PRIVATE ${CLW_BINARY_DIR}) +target_include_directories(CLW PRIVATE "${CLW_BINARY_DIR}") target_include_directories(CLW PUBLIC .) add_custom_target(clw_kernel_cache_h DEPENDS "${CLW_BINARY_DIR}/clwkernels_cl.h") diff --git a/Calc/CMakeLists.txt b/Calc/CMakeLists.txt index c26eaead..09c12019 100644 --- a/Calc/CMakeLists.txt +++ b/Calc/CMakeLists.txt @@ -1,22 +1,54 @@ project(Calc CXX) set(SOURCES src/calc.cpp) - +set(PUBLIC_HEADERS + inc/buffer.h + inc/calc.h + inc/calc_common.h + inc/device.h + inc/event.h + inc/except.h + inc/executable.h + inc/primitives.h + ) + if (RR_USE_OPENCL) list(APPEND SOURCES src/calc_clw.cpp - src/device_clw.cpp) + src/device_clw.cpp + src/calc_clw.h + src/calc_clw_common.h + src/device_clw.h + src/except_clw.h + ) + list(APPEND PUBLIC_HEADERS + inc/calc_cl.h + inc/device_cl.h + ) elseif (RR_USE_VULKAN) list(APPEND SOURCES src/calc_vkw.cpp - src/device_vkw.cpp) + src/device_vkw.cpp + src/calc_vkw.h + src/device_vkw.h + src/event_vk.h + src/common_vk.h + src/except_vk.h + src/executable_vk.h + src/function_vk.h + ) + list(APPEND PUBLIC_HEADERS + inc/buffer_vk.h + inc/calc_vk.h + inc/device_vk.h + ) endif (RR_USE_OPENCL) if (RR_SHARED_CALC) - add_library(Calc SHARED ${SOURCES}) + add_library(Calc SHARED ${SOURCES} ${PUBLIC_HEADERS}) target_compile_definitions(Calc PUBLIC CALC_EXPORT_API) else (NOT RR_SHARED_CALC) - add_library(Calc STATIC ${SOURCES}) + add_library(Calc STATIC ${SOURCES} ${PUBLIC_HEADERS}) target_compile_definitions(Calc PUBLIC CALC_STATIC_LIBRARY) endif (RR_SHARED_CALC) @@ -39,7 +71,7 @@ endif (RR_USE_OPENCL) if (RR_USE_VULKAN) #Need to add Anvil to include path target_include_directories(Calc - PRIVATE ${RadeonRaysSDK_SOURCE_DIR}/Anvil/deps - PRIVATE ${RadeonRaysSDK_SOURCE_DIR}/Anvil/include) + PRIVATE "${RadeonRaysSDK_SOURCE_DIR}/Anvil/deps" + PRIVATE "${RadeonRaysSDK_SOURCE_DIR}/Anvil/include") target_link_libraries(Calc PUBLIC Vulkan::Vulkan) endif (RR_USE_VULKAN) diff --git a/RadeonRays/CMakeLists.txt b/RadeonRays/CMakeLists.txt index d1a35110..b635cd01 100644 --- a/RadeonRays/CMakeLists.txt +++ b/RadeonRays/CMakeLists.txt @@ -89,12 +89,30 @@ if (RR_USE_OPENCL) list (APPEND DEVICE_SOURCES src/device/calc_intersection_device_cl.cpp src/device/calc_intersection_device_cl.h) + set(KERNEL_SOURCES + src/kernels/CL/build_hlbvh.cl + src/kernels/CL/common.cl + src/kernels/CL/intersect_bvh2level_skiplinks.cl + src/kernels/CL/intersect_bvh2_bittrail.cl + src/kernels/CL/intersect_bvh2_lds.cl + src/kernels/CL/intersect_bvh2_lds_fp16.cl + src/kernels/CL/intersect_bvh2_short_stack.cl + src/kernels/CL/intersect_bvh2_skiplinks.cl + src/kernels/CL/intersect_hlbvh_stack.cl) endif (RR_USE_OPENCL) if (RR_USE_VULKAN) list (APPEND DEVICE_SOURCES src/device/calc_intersection_device_vk.cpp src/device/calc_intersection_device_vk.h) + set(KERNEL_SOURCES + src/kernels/GLSL/bvh.comp + src/kernels/GLSL/bvh2.comp + src/kernels/GLSL/bvh2l.comp + src/kernels/GLSL/bvh2_fp16.comp + src/kernels/GLSL/fatbvh.comp + src/kernels/GLSL/hlbvh.comp + src/kernels/GLSL/hlbvh_build.comp) endif (RR_USE_VULKAN) source_group("accelerator" FILES ${ACCELERATOR_SOURCES}) @@ -102,11 +120,12 @@ source_group("api" FILES ${API_SOURCES}) source_group("async" FILES ${ASYNC_SOURCES}) source_group("device" FILES ${DEVICE_SOURCES}) source_group("except" FILES ${EXCEPT_SOURCES}) -source_group("intersecotr" FILES ${INTERSECTOR_SOURCES}) +source_group("intersector" FILES ${INTERSECTOR_SOURCES}) source_group("primitive" FILES ${PRIMITIVE_SOURCES}) source_group("translator" FILES ${TRANSLATOR_SOURCES}) source_group("util" FILES ${UTIL_SOURCES}) source_group("world" FILES ${WORLD_SOURCES}) +source_group("kernels" FILES ${KERNEL_SOURCES}) #Gather all sources together set(SOURCES @@ -120,7 +139,8 @@ set(SOURCES ${PRIMITIVE_SOURCES} ${TRANSLATOR_SOURCES} ${UTIL_SOURCES} - ${WORLD_SOURCES}) + ${WORLD_SOURCES} + ${KERNEL_SOURCES}) if (RR_EMBED_KERNELS) add_subdirectory(src/kernels) @@ -183,8 +203,8 @@ endif (RR_USE_OPENCL) if (RR_USE_VULKAN) #Need to add Anvil to include path target_include_directories(RadeonRays - PRIVATE ${RadeonRaysSDK_SOURCE_DIR}/Anvil/deps - PRIVATE ${RadeonRaysSDK_SOURCE_DIR}/Anvil/include) + PRIVATE "${RadeonRaysSDK_SOURCE_DIR}/Anvil/deps" + PRIVATE "${RadeonRaysSDK_SOURCE_DIR}/Anvil/include") target_link_libraries(RadeonRays PUBLIC Vulkan::Vulkan Anvil) target_compile_definitions(RadeonRays PUBLIC USE_VULKAN=1) diff --git a/RadeonRays/include/radeon_rays.h b/RadeonRays/include/radeon_rays.h index 10feb6ee..346f6c03 100644 --- a/RadeonRays/include/radeon_rays.h +++ b/RadeonRays/include/radeon_rays.h @@ -42,6 +42,8 @@ THE SOFTWARE. #else #define RRAPI __attribute__((visibility ("default"))) #endif +#else + #define RRAPI #endif namespace RadeonRays { diff --git a/UnitTest/CMakeLists.txt b/UnitTest/CMakeLists.txt index c1a03896..76e179e0 100644 --- a/UnitTest/CMakeLists.txt +++ b/UnitTest/CMakeLists.txt @@ -3,25 +3,49 @@ project(UnitTest CXX) set(SOURCES test_main.cpp tiny_obj_loader.cpp - utils.cpp) + utils.cpp + clw_test.h + tiny_obj_loader.h + utils.h + ) + +if (RR_USE_OPENCL) + list(APPEND SOURCES + calc_test_cl.h + clw_test_cl.h + radeon_rays_apitest_cl.h + radeon_rays_conformance_test_cl.h + radeon_rays_test_cl.h + radeon_rays_performance_test_cl.h) +endif (RR_USE_OPENCL) if (RR_USE_VULKAN) #Anvil specify vulkan-1 lib directly so we need to add correct paths if (WIN32) - link_directories ($ENV{VK_SDK_PATH}/Lib - $ENV{VULKAN_SDK}/Lib) + link_directories ("$ENV{VK_SDK_PATH}/Lib" + "$ENV{VULKAN_SDK}/Lib") else() - link_directories ($ENV{VK_SDK_PATH}/x86_64/lib - $ENV{VULKAN_SDK}/x86_64/lib) + link_directories ("$ENV{VK_SDK_PATH}/x86_64/lib" + "$ENV{VULKAN_SDK}/x86_64/lib") endif (WIN32) + list(APPEND SOURCES + calc_test_vk.h + radeon_rays_apitest_vk.h + radeon_rays_conformance_test_vk.h + radeon_rays_performance_test_vk.h) endif (RR_USE_VULKAN) +if (RR_USE_EMBREE) + list(APPEND SOURCES + radeon_rays_apitest_embree.h + radeon_rays_conformance_test_embree.h) +endif (RR_USE_EMBREE) add_executable(UnitTest ${SOURCES}) target_link_libraries(UnitTest PRIVATE GTest RadeonRays Calc) #Add root for unittests. They use private headers -target_include_directories(UnitTest PRIVATE ${RadeonRaysSDK_SOURCE_DIR}) +target_include_directories(UnitTest PRIVATE "${RadeonRaysSDK_SOURCE_DIR}") if (RR_SHARED_CALC) target_compile_definitions(UnitTest PRIVATE CALC_IMPORT_API)