Skip to content

Commit

Permalink
Added support for building a Python module via pip.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismile committed Jan 1, 2025
1 parent 8fc4cf4 commit c06ee94
Show file tree
Hide file tree
Showing 35 changed files with 2,231 additions and 102 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,13 @@ out/*

# macOS
.DS_Store

# Python
**/__pycache__/*

# setuptools
build*/
*egg-info*
dist/*
tmp/*
vpt/*
2 changes: 1 addition & 1 deletion build-msvc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ if %build_with_openvdb_support% == true (
)
set cmake_args=%cmake_args% -DCMAKE_MODULE_PATH="third_party/openvdb/lib/cmake/OpenVDB"

set oidn_version=2.3.0
set oidn_version=2.3.1
if not exist ".\oidn-%oidn_version%.x64.windows" (
echo ------------------------
echo downloading OpenImageDenoise
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ if $use_custom_openexr; then
fi

if $use_open_image_denoise; then
oidn_version="2.3.0"
oidn_version="2.3.1"
if $use_msys; then
oidn_folder_name="oidn-${oidn_version}.x64.windows"
oidn_archive_name="${oidn_folder_name}.zip"
Expand Down
583 changes: 583 additions & 0 deletions setup.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/Denoiser/Denoiser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ class Denoiser {
virtual void setOutputForegroundMap(bool _shallOutputForegroundMap) {}

/// Renders the GUI. Returns whether re-rendering has become necessary due to the user's actions.
#ifndef DISABLE_IMGUI
virtual bool renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) { return false; }
#endif
virtual void setSettings(const std::unordered_map<std::string, std::string>& settings) {}
};

Expand Down
6 changes: 6 additions & 0 deletions src/Denoiser/EAWDenoiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
#include <Graphics/Vulkan/Render/Renderer.hpp>
#include <Graphics/Vulkan/Render/Data.hpp>
#include <Graphics/Vulkan/Render/ComputePipeline.hpp>
#ifndef DISABLE_IMGUI
#include <ImGui/ImGuiWrapper.hpp>
#include <ImGui/Widgets/PropertyEditor.hpp>
#endif
#include "EAWDenoiser.hpp"

EAWDenoiser::EAWDenoiser(sgl::vk::Renderer* renderer) {
Expand Down Expand Up @@ -118,9 +120,11 @@ void EAWDenoiser::recreateSwapchain(uint32_t width, uint32_t height) {
eawBlitPass->recreateSwapchain(width, height);
}

#ifndef DISABLE_IMGUI
bool EAWDenoiser::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) {
return eawBlitPass->renderGuiPropertyEditorNodes(propertyEditor);
}
#endif



Expand Down Expand Up @@ -386,6 +390,7 @@ void EAWBlitPass::_renderCompute() {
}
}

#ifndef DISABLE_IMGUI
bool EAWBlitPass::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) {
bool reRender = false;

Expand Down Expand Up @@ -417,3 +422,4 @@ bool EAWBlitPass::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEdit

return reRender;
}
#endif
4 changes: 4 additions & 0 deletions src/Denoiser/EAWDenoiser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ class EAWDenoiser : public Denoiser {
void setWeightScalePosition(float scale);
void setWeightScaleNormal(float scale);

#ifndef DISABLE_IMGUI
/// Renders the GUI. Returns whether re-rendering has become necessary due to the user's actions.
bool renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) override;
#endif

private:
std::shared_ptr<EAWBlitPass> eawBlitPass;
Expand All @@ -85,8 +87,10 @@ class EAWBlitPass : public sgl::vk::BlitRenderPass {
inline void setNormalTexture(const sgl::vk::TexturePtr& texture) { normalTexture = texture; setDataDirty(); }
[[nodiscard]] inline int getMaxNumIterations() const { return maxNumIterations; }

#ifndef DISABLE_IMGUI
/// Renders the GUI. Returns whether re-rendering has become necessary due to the user's actions.
bool renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor);
#endif

protected:
void loadShader() override;
Expand Down
6 changes: 6 additions & 0 deletions src/Denoiser/OpenImageDenoiseDenoiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
#include <Graphics/Vulkan/Buffers/Buffer.hpp>
#include <Graphics/Vulkan/Render/CommandBuffer.hpp>
#include <Graphics/Vulkan/Render/Passes/BlitRenderPass.hpp>
#ifndef DISABLE_IMGUI
#include <ImGui/Widgets/PropertyEditor.hpp>
#else
#include "Utils/ImGuiCompat.h"
#endif

#include "OpenImageDenoiseDenoiser.hpp"

Expand Down Expand Up @@ -660,6 +664,7 @@ void OpenImageDenoiseDenoiser::recreateSwapchain(uint32_t width, uint32_t height
}


#ifndef DISABLE_IMGUI
bool OpenImageDenoiseDenoiser::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) {
bool reRender = false;

Expand Down Expand Up @@ -717,6 +722,7 @@ bool OpenImageDenoiseDenoiser::renderGuiPropertyEditorNodes(sgl::PropertyEditor&

return reRender;
}
#endif

void OpenImageDenoiseDenoiser::setSettings(const std::unordered_map<std::string, std::string>& settings) {
auto itFilterQuality = settings.find("filter_quality");
Expand Down
2 changes: 2 additions & 0 deletions src/Denoiser/OpenImageDenoiseDenoiser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ class OpenImageDenoiseDenoiser : public Denoiser {
void denoise() override;
void recreateSwapchain(uint32_t width, uint32_t height) override;

#ifndef DISABLE_IMGUI
/// Renders the GUI. Returns whether re-rendering has become necessary due to the user's actions.
bool renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) override;
#endif
void setSettings(const std::unordered_map<std::string, std::string>& settings) override;

private:
Expand Down
6 changes: 6 additions & 0 deletions src/Denoiser/OptixVptDenoiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
#include <Graphics/Vulkan/Render/CommandBuffer.hpp>
#include <Graphics/Vulkan/Render/Renderer.hpp>
#include <Graphics/Vulkan/Render/ComputePipeline.hpp>
#ifndef DISABLE_IMGUI
#include <ImGui/ImGuiWrapper.hpp>
#include <ImGui/Widgets/PropertyEditor.hpp>
#else
#include "Utils/ImGuiCompat.h"
#endif
#include "OptixVptDenoiser.hpp"

#include <optix.h>
Expand Down Expand Up @@ -559,6 +563,7 @@ void OptixVptDenoiser::runOptixDenoiser() {
#endif
}

#ifndef DISABLE_IMGUI
bool OptixVptDenoiser::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) {
bool reRender = false;

Expand Down Expand Up @@ -592,6 +597,7 @@ bool OptixVptDenoiser::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propert

return reRender;
}
#endif

void OptixVptDenoiser::setSettings(const std::unordered_map<std::string, std::string>& settings) {
auto itModelType = settings.find("model_type");
Expand Down
2 changes: 2 additions & 0 deletions src/Denoiser/OptixVptDenoiser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ class OptixVptDenoiser : public Denoiser {
void denoise() override;
void recreateSwapchain(uint32_t width, uint32_t height) override;

#ifndef DISABLE_IMGUI
/// Renders the GUI. Returns whether re-rendering has become necessary due to the user's actions.
bool renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) override;
#endif
void setSettings(const std::unordered_map<std::string, std::string>& settings) override;

private:
Expand Down
6 changes: 6 additions & 0 deletions src/Denoiser/PyTorchDenoiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@
#include <Graphics/Vulkan/Utils/InteropCuda.hpp>
#endif
#include <Graphics/Vulkan/Render/CommandBuffer.hpp>
#ifndef DISABLE_IMGUI
#include <ImGui/ImGuiWrapper.hpp>
#include <ImGui/Widgets/PropertyEditor.hpp>
#include <ImGui/ImGuiFileDialog/ImGuiFileDialog.h>
#else
#include "Utils/ImGuiCompat.h"
#endif

#include "PyTorchDenoiser.hpp"

Expand Down Expand Up @@ -828,6 +832,7 @@ void PyTorchDenoiser::setOutputForegroundMap(bool _shallOutputForegroundMap) {
addBackground = !_shallOutputForegroundMap;
}

#ifndef DISABLE_IMGUI
bool PyTorchDenoiser::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) {
bool reRender = false;

Expand Down Expand Up @@ -906,6 +911,7 @@ bool PyTorchDenoiser::renderGuiPropertyEditorNodes(sgl::PropertyEditor& property

return reRender;
}
#endif



Expand Down
2 changes: 2 additions & 0 deletions src/Denoiser/PyTorchDenoiser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ class PyTorchDenoiser : public Denoiser {
void setPyTorchDevice(PyTorchDevice pyTorchDeviceNew);
void setOutputForegroundMap(bool _shallOutputForegroundMap) override;

#ifndef DISABLE_IMGUI
/// Renders the GUI. Returns whether re-rendering has become necessary due to the user's actions.
bool renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) override;
#endif

private:
void computeNumChannels();
Expand Down
14 changes: 13 additions & 1 deletion src/Denoiser/SVGF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@
#include <Graphics/Vulkan/Render/Renderer.hpp>
#include <Graphics/Vulkan/Render/Data.hpp>
#include <Graphics/Vulkan/Render/ComputePipeline.hpp>
#include <Graphics/Vulkan/Utils/Device.hpp>
#ifndef DISABLE_IMGUI
#include <ImGui/ImGuiWrapper.hpp>
#include <ImGui/Widgets/PropertyEditor.hpp>
#include <Graphics/Vulkan/Utils/Device.hpp>
#else
#include "Utils/ImGuiCompat.h"
#endif

#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
Expand Down Expand Up @@ -289,11 +293,13 @@ void SVGFDenoiser::recreateSwapchain(uint32_t width, uint32_t height) {

}

#ifndef DISABLE_IMGUI
bool SVGFDenoiser::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) {
return
svgf_reproj_pass->renderGuiPropertyEditorNodes(propertyEditor) ||
svgf_atrous_pass->renderGuiPropertyEditorNodes(propertyEditor);
}
#endif

void SVGFDenoiser::resetFrameNumber() {}

Expand Down Expand Up @@ -439,6 +445,7 @@ void SVGF_ATrous_Pass::_render() {
}
}

#ifndef DISABLE_IMGUI
bool SVGF_ATrous_Pass::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) {
if (propertyEditor.addSliderInt("#Iterations", &maxNumIterations, 0, 5)) {
setDataDirty();
Expand All @@ -448,6 +455,7 @@ bool SVGF_ATrous_Pass::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propert

return false;
}
#endif


// ------------------------------
Expand Down Expand Up @@ -528,6 +536,7 @@ void SVGF_Reproj_Pass::loadShader() {
}


#ifndef DISABLE_IMGUI
bool SVGF_Reproj_Pass::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) {
//if (propertyEditor.addSliderFloat("allowed_normal_dist", &pc.allowed_normal_dist, 0, 2) |
// propertyEditor.addSliderFloat("allowed_z_dist", &pc.allowed_z_dist, 0, 5) |
Expand All @@ -541,6 +550,7 @@ bool SVGF_Reproj_Pass::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propert

return false;
}
#endif



Expand Down Expand Up @@ -603,6 +613,8 @@ void SVGF_Filter_Moments_Pass::loadShader() {
}


#ifndef DISABLE_IMGUI
bool SVGF_Filter_Moments_Pass::renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) {
return false;
}
#endif
9 changes: 8 additions & 1 deletion src/Denoiser/SVGF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ class SVGFDenoiser : public Denoiser {
void denoise() override;
void recreateSwapchain(uint32_t width, uint32_t height) override;

#ifndef DISABLE_IMGUI
/// Renders the GUI. Returns whether re-rendering has become necessary due to the user's actions.
bool renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor) override;

#endif
};

class SVGF_Reproj_Pass : public sgl::vk::ComputePass {
Expand All @@ -118,8 +119,10 @@ class SVGF_Reproj_Pass : public sgl::vk::ComputePass {
public:
explicit SVGF_Reproj_Pass(sgl::vk::Renderer* renderer, SVGF_Texture_Pack* textures);

#ifndef DISABLE_IMGUI
/// Renders the GUI. Returns whether re-rendering has become necessary due to the user's actions.
bool renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor);
#endif

protected:
void loadShader() override;
Expand All @@ -139,8 +142,10 @@ class SVGF_Filter_Moments_Pass : public sgl::vk::ComputePass {
public:
explicit SVGF_Filter_Moments_Pass(sgl::vk::Renderer* renderer, SVGF_Texture_Pack* textures);

#ifndef DISABLE_IMGUI
/// Renders the GUI. Returns whether re-rendering has become necessary due to the user's actions.
bool renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor);
#endif

protected:
void loadShader() override;
Expand Down Expand Up @@ -171,8 +176,10 @@ class SVGF_ATrous_Pass : public sgl::vk::ComputePass {
public:
explicit SVGF_ATrous_Pass(sgl::vk::Renderer* renderer, SVGF_Texture_Pack* textures);

#ifndef DISABLE_IMGUI
/// Renders the GUI. Returns whether re-rendering has become necessary due to the user's actions.
bool renderGuiPropertyEditorNodes(sgl::PropertyEditor& propertyEditor);
#endif

protected:
void loadShader() override;
Expand Down
Loading

0 comments on commit c06ee94

Please sign in to comment.