Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting OptiX ray tracer on Linux. Prepare Docker build #219

Merged
merged 1 commit into from
Feb 3, 2025
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions EvoEngine_App/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ message("=========Checking Apps=========")
add_custom_target(AppResourceCopy)
add_dependencies(AppResourceCopy EvoEngine_SDK)

string (FIND "${EVOENGINE_DEFS}" "CUDA" CUDA_SUBSTRING_INDEX)
if(NOT CUDA_SUBSTRING_INDEX EQUAL -1)
mark_as_advanced(CUDA_SDK_ROOT_DIR)
enable_language(CUDA)
message("CUDA enabled.")
endif()


evoengine_copy_resources(AppResourceCopy ${CMAKE_CURRENT_BINARY_DIR})
evoengine_clear_shader_binaries(AppResourceCopy)
add_custom_command(TARGET AppResourceCopy POST_BUILD
Expand Down
3 changes: 2 additions & 1 deletion EvoEngine_Plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ function(register_evoengine_plugin plugin_name default_enable)
set(EVOENGINE_PLUGINS_RESOURCES ${EVOENGINE_PLUGINS_RESOURCES} PARENT_SCOPE)
endfunction()

register_evoengine_plugin(CudaModule ON)

if (WIN32)
register_evoengine_plugin(MeshRepair ON)
register_evoengine_plugin(TextureBaking ON)
register_evoengine_plugin(CudaModule ON)
register_evoengine_plugin(Gpr ON)
register_evoengine_plugin(BillboardClouds ON)
endif()
Expand Down
13 changes: 7 additions & 6 deletions EvoEngine_Plugins/CudaModule/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ endif()

message("Found CUDA.")

set(CMAKE_CUDA_ARCHITECTURES 75-real 75-virtual)
mark_as_advanced(CUDA_SDK_ROOT_DIR)
enable_language(CUDA)

Expand Down Expand Up @@ -53,16 +54,16 @@ set(CUDA_MODULE_INCLUDES
include_directories(${EVOENGINE_SDK_INCLUDES})
include_directories(${CUDA_MODULE_INCLUDES})

cuda_compile_and_embed(CAMERA_RENDERING_PTX ${RAY_TRACER_DIRECTORY}/src/ptx/CameraRendering.cu)
cuda_compile_and_embed(ILLUMINATION_ESTIMATION_PTX ${RAY_TRACER_DIRECTORY}/src/ptx/IlluminationEstimation.cu)
cuda_compile_and_embed(POINT_CLOUD_SCANNING_PTX ${RAY_TRACER_DIRECTORY}/src/ptx/PointCloudScanning.cu)
cuda_compile_and_embed(camera_rendering_ptx ${RAY_TRACER_DIRECTORY}/src/ptx/CameraRendering.cu)
cuda_compile_and_embed(illumination_estimation_ptx ${RAY_TRACER_DIRECTORY}/src/ptx/IlluminationEstimation.cu)
cuda_compile_and_embed(point_cloud_scanning_ptx ${RAY_TRACER_DIRECTORY}/src/ptx/PointCloudScanning.cu)

add_library(CudaModulePlugin
STATIC
#Default
${CAMERA_RENDERING_PTX}
${ILLUMINATION_ESTIMATION_PTX}
${POINT_CLOUD_SCANNING_PTX}
${camera_rendering_ptx}
${illumination_estimation_ptx}
${point_cloud_scanning_ptx}

#C++
${RAY_TRACER_HEADERS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct CameraProperties {

void SetDenoiserStrength(float value);

void Resize(const glm::uvec2& newSize);
void Resize(const glm::uvec2& new_size);

void Set(const glm::vec3& position, const glm::quat& rotation);
void SetSkybox(const std::shared_ptr<CudaImage>& cubemap);
Expand Down Expand Up @@ -235,7 +235,8 @@ struct RayTracedMaterial {

void UploadForSbt();

void BindTexture(unsigned int id, cudaGraphicsResource_t& graphics_resource, cudaTextureObject_t& texture_object);
static void BindTexture(unsigned int id, cudaGraphicsResource_t& graphics_resource,
cudaTextureObject_t& texture_object);
};

enum class CurveMode { Linear, Quadratic, Cubic };
Expand Down Expand Up @@ -334,10 +335,11 @@ class OptiXRayTracer {
CameraProperties& camera_properties, const RayProperties& ray_properties);

void EstimateIllumination(const size_t& size, const EnvironmentProperties& environment_properties,
const RayProperties& ray_properties, CudaBuffer& light_probes, unsigned seed,
const RayProperties& ray_properties, const CudaBuffer& light_probes, unsigned seed,
float push_normal_distance);

void ScanPointCloud(const size_t& size, const EnvironmentProperties& environment_properties, CudaBuffer& samples);
void ScanPointCloud(const size_t& size, const EnvironmentProperties& environment_properties,
const CudaBuffer& samples);

OptiXRayTracer();
~OptiXRayTracer();
Expand Down Expand Up @@ -392,11 +394,11 @@ class OptiXRayTracer {
/*! assembles the full pipeline of all programs */
void AssemblePipelines();

void CreateRayGenProgram(RayTracerPipeline& targetPipeline, char entryFunctionName[]) const;
void CreateRayGenProgram(RayTracerPipeline& target_pipeline, char entry_function_name[]) const;

void CreateModule(RayTracerPipeline& targetPipeline, char ptxCode[], char launchParamsName[]) const;
void CreateModule(RayTracerPipeline& target_pipeline, char ptx_code[], char launch_params_name[]) const;

void AssemblePipeline(RayTracerPipeline& targetPipeline) const;
void AssemblePipeline(RayTracerPipeline& target_pipeline) const;

#pragma endregion

Expand Down
Loading