diff --git a/.gitmodules b/.gitmodules index af8eeca..90ed53d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "3rdparty/nvpro_core"] path = 3rdparty/nvpro_core - url = https://github.com/nvpro-samples/nvpro_core.git + url = https://gitee.com/ZC__Wang/nvpro_core.git diff --git a/3rdparty/nvpro_core b/3rdparty/nvpro_core index e15f603..c454752 160000 --- a/3rdparty/nvpro_core +++ b/3rdparty/nvpro_core @@ -1 +1 @@ -Subproject commit e15f6038b54c39b4ad756c9e14a8354b56b4d82f +Subproject commit c4547527036daa1dea26de7f83c03dad77495fc3 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aeb6ad..50923ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,7 @@ cmake_minimum_required(VERSION 3.15) set(CMAKE_CXX_STANDARD 20) -set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "F:/Backup/GitHub/pytorch/torch/share/cmake/Torch") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -set(CUDNN_LIBRARY_PATH "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/cudnn.lib") -set(CUDNN_INCLUDE_PATH "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/include") -set(CAFFE2_USE_CUDNN 1) # to make use of CuDNN library on newer version of LibTorch, we have to make this definition, see https://discuss.pytorch.org/t/use-cudnn-set-to-zero-after-upgrade-to-libtorch-2-0/175413/6 project(eval_def_generator) add_executable(${PROJECT_NAME}) @@ -24,24 +20,7 @@ add_custom_command( project(implicit_conversion_rendering) -if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fext-numeric-literals) - if(NOT DEFINED WIN32_LEAN_AND_MEAN) - add_definitions(-DWIN32_LEAN_AND_MEAN) - endif() - if(NOT DEFINED WINVER) - add_definitions(-DWINVER=0x0A00) - endif() - if(NOT DEFINED _WIN32_WINNT) - add_definitions(-D_WIN32_WINNT=0x0A00) - endif() - if(NOT DEFINED NTDDI_VERSION) - add_definitions(-DNTDDI_VERSION=0x0A000007) - endif() -endif() - add_executable(${PROJECT_NAME}) -include(cmake/func.cmake) include(cmake/Graphnode.cmake) if(NOT BASE_DIRECTORY) @@ -64,6 +43,8 @@ set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}) # library for graphics rendering message(STATUS "-------------------------------") +_add_package_GLM() +_add_package_VMA() _add_package_VulkanSDK() _add_package_ImGUI() message(STATUS "--> using package ImGUI::GraphNode") @@ -80,7 +61,7 @@ endif() if(NOT EXISTS ${OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/shaders) file(MAKE_DIRECTORY ${OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/shaders) endif() -compile_glsl_directory_by_shaderc( +compile_glsl_directory( SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/shader" DST "${OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/shaders" VULKAN_TARGET "vulkan1.3" diff --git a/cmake/func.cmake b/cmake/func.cmake deleted file mode 100644 index 3f51bd2..0000000 --- a/cmake/func.cmake +++ /dev/null @@ -1,135 +0,0 @@ -function(compile_glsl_by_shaderc) - set(oneValueArgs DST VULKAN_TARGET DEPENDENCY) - set(multiValueArgs SOURCE_FILES HEADER_FILES FLAGS) - cmake_parse_arguments(COMPILE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) - - # Check if the GLSL compiler is present - if(NOT GLSLC) - message(ERROR "Could not find GLSLC to compile shaders") - return() - endif() - - # By default use Vulkan 1.1 - if(NOT DEFINED COMPILE_VULKAN_TARGET) - set(COMPILE_VULKAN_TARGET vulkan1.1) - endif() - - # If destination is not present, same as source - if(NOT DEFINED COMPILE_DST) - message(ERROR " --- DST not defined") - return() - endif() - - # Make the output directory if needed - file(MAKE_DIRECTORY ${COMPILE_DST}) - - # If no flag set -g (debug) - if(NOT DEFINED COMPILE_FLAGS) - set(COMPILE_FLAGS -g) - endif() - - # Compiling all GLSL sources - foreach(GLSL_SRC ${COMPILE_SOURCE_FILES}) - - # Find the dependency files for the GLSL source - # or use all headers as dependencies. - if(COMPILE_DEPENDENCY) - get_glsl_dependencies(SRC ${GLSL_SRC} FLAGS ${COMPILE_FLAGS}) - else() - set(GLSL_DEPENDENCY ${HEADER_FILES}) - endif() - - # Default compiler command, always adding debug information (Add and option to opt-out?) - set(COMPILE_CMD ${COMPILE_FLAGS} --target-env=${COMPILE_VULKAN_TARGET}) - - # Compilation to headers need a variable name, the output will be a .h - get_filename_component(FILE_NAME ${GLSL_SRC} NAME) - set(GLSL_OUT "${COMPILE_DST}/${FILE_NAME}.spv") - list(APPEND _SPVS ${GLSL_OUT}) - - - # Appending the output name and the file source - list(APPEND COMPILE_CMD -o ${GLSL_OUT} ${GLSL_SRC} ) - - # The custom command is added to the build system, check for the presence of the output - # but also for changes done in GLSL headers - add_custom_command( - PRE_BUILD - OUTPUT ${GLSL_OUT} - COMMAND echo ${GLSLC} ${COMPILE_CMD} - COMMAND ${GLSLC} ${COMPILE_CMD} - MAIN_DEPENDENCY ${GLSL_SRC} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${GLSL_DEPENDENCY} - ) - endforeach() - - # Setting OUT variables - set(GLSL_SOURCES ${COMPILE_SOURCE_FILES} PARENT_SCOPE) - set(GLSL_HEADERS ${COMPILE_HEADER_FILES} PARENT_SCOPE) - set(SPV_OUTPUT ${_SPVS} PARENT_SCOPE) - -endfunction() - -# ------------------------------------------------------------------------ -# ------------------------------------------------------------------------ -# ------------------------------------------------------------------------ - -function(compile_glsl_directory_by_shaderc) - set(oneValueArgs SRC DST VULKAN_TARGET DEPENDENCY) - set(multiValueArgs FLAGS) - cmake_parse_arguments(COMPILE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) - - # Collecting all source files - file(GLOB_RECURSE GLSL_SOURCE_FILES - "${COMPILE_SRC}/*.comp" # Compute - "${COMPILE_SRC}/*.frag" # Fragment - "${COMPILE_SRC}/*.geom" # Geometry - "${COMPILE_SRC}/*.mesh" # Mesh - "${COMPILE_SRC}/*.rahit" # Ray any hit - "${COMPILE_SRC}/*.rcall" # Ray callable - "${COMPILE_SRC}/*.rchit" # Ray closest hit - "${COMPILE_SRC}/*.rgen" # Ray generation - "${COMPILE_SRC}/*.rint" # Ray intersection - "${COMPILE_SRC}/*.rmiss" # Ray miss - "${COMPILE_SRC}/*.task" # Task - "${COMPILE_SRC}/*.tesc" # Tessellation control - "${COMPILE_SRC}/*.tese" # Tessellation evaluation - "${COMPILE_SRC}/*.vert" # Vertex - ) - - # Collecting headers for dependencies - file(GLOB_RECURSE GLSL_HEADER_FILES - "${COMPILE_SRC}/*.glsl" # Auto detect - used for header - "${COMPILE_SRC}/*.h" - ) - - # By default use Vulkan 1.1 - if(NOT DEFINED COMPILE_VULKAN_TARGET) - set(COMPILE_VULKAN_TARGET vulkan1.1) - endif() - - # If destination is not present, same as source - if(NOT DEFINED COMPILE_DST) - set(COMPILE_DST ${COMPILE_SRC}) - endif() - - # If no flag set -g (debug) - if(NOT DEFINED COMPILE_FLAGS) - set(COMPILE_FLAGS -g) - endif() - - # Compiling all GLSL - compile_glsl_by_shaderc(SOURCE_FILES ${GLSL_SOURCE_FILES} - HEADER_FILES ${GLSL_HEADER_FILES} - DST ${COMPILE_DST} - VULKAN_TARGET ${COMPILE_VULKAN_TARGET} - DEPENDENCY ${COMPILE_DEPENDENCY} - FLAGS ${COMPILE_FLAGS} - ) - - # Setting OUT variables - set(GLSL_SOURCES ${GLSL_SOURCE_FILES} PARENT_SCOPE) - set(GLSL_HEADERS ${GLSL_HEADER_FILES} PARENT_SCOPE) - set(SPV_OUTPUT ${SPV_OUTPUT} PARENT_SCOPE) # propagate value set in compile_glsl -endfunction() \ No newline at end of file diff --git a/src/shader/evaluation/eval_defs.glsl b/src/shader/evaluation/eval_defs.glsl index 04211fd..4ab47e3 100644 --- a/src/shader/evaluation/eval_defs.glsl +++ b/src/shader/evaluation/eval_defs.glsl @@ -17,4 +17,12 @@ res = evalCylinderByAnalytic(ray); \ } +#define calBounding(primitiveType, matrixModel, res) \ +{ \ + if(primitiveType == 0) \ + res = calSphereBounding(matrixModel); \ + else \ + res = evalCylinderByAnalytic(ray); \ +} + #endif