Skip to content

Commit

Permalink
Merge pull request #1862 from zenustech/remove-unused-skytex
Browse files Browse the repository at this point in the history
remove-unused-skytex
  • Loading branch information
zhxx1987 authored Mar 26, 2024
2 parents 433eed3 + c9b15a0 commit cf7a818
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zenovis/src/optx/RenderEngineOptx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,15 @@ struct GraphicsManager {
float evnTexStrength = prim_in->userData().get2<float>("evnTexStrength");
bool enableHdr = prim_in->userData().get2<bool>("enable");
if (!path.empty()) {
std::string need_remove_tex;
if (OptixUtil::sky_tex.has_value() && OptixUtil::sky_tex.value() != path) {
need_remove_tex = OptixUtil::sky_tex.value();
}
OptixUtil::sky_tex = path;
OptixUtil::addTexture(path);
if (need_remove_tex.size()) {
OptixUtil::removeTexture(need_remove_tex);
}
}
xinxinoptix::update_hdr_sky(evnTexRotation, evnTex3DRotation, evnTexStrength);
xinxinoptix::using_hdr_sky(enableHdr);
Expand Down
11 changes: 11 additions & 0 deletions zenovis/xinxinoptix/OptiXStuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,17 @@ inline void addTexture(std::string path)
zeno::log_info("-{}", i->first);
}
}
inline void removeTexture(std::string path) {
if (path.size()) {
g_tex.erase(path);
sky_nx_map.erase(path);
sky_ny_map.erase(path);
sky_cdf_map.erase(path);
sky_pdf_map.erase(path);
sky_start_map.erase(path);
sky_avg_map.erase(path);
}
}

struct OptixShaderCore {
raii<OptixModule> module {};
Expand Down

0 comments on commit cf7a818

Please sign in to comment.