Skip to content

Commit

Permalink
Passing AI_SESSION_INTERACTIVE when creating AiRenderSession and rena…
Browse files Browse the repository at this point in the history
…ming _render_session to _renderSession. (#822)

Fixes #821
  • Loading branch information
sirpalee authored Jun 30, 2021
1 parent 4074c8a commit e3c1355
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
34 changes: 17 additions & 17 deletions render_delegate/render_delegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ HdArnoldRenderDelegate::HdArnoldRenderDelegate(HdArnoldRenderContext context) :

#ifdef AI_MULTIPLE_RENDER_SESSIONS
_universe = AiUniverse();
_render_session = AiRenderSession(_universe);
_renderSession = AiRenderSession(_universe, AI_SESSION_INTERACTIVE);
#else
_universe = nullptr;
#endif
Expand All @@ -400,7 +400,7 @@ HdArnoldRenderDelegate::HdArnoldRenderDelegate(HdArnoldRenderContext context) :

#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderSetHintStr(
_render_session, str::render_context, _context == HdArnoldRenderContext::Hydra ? str::hydra : str::husk);
_renderSession, str::render_context, _context == HdArnoldRenderContext::Hydra ? str::hydra : str::husk);
#else
AiRenderSetHintStr(str::render_context, _context == HdArnoldRenderContext::Hydra ? str::hydra : str::husk);
#endif
Expand Down Expand Up @@ -429,14 +429,14 @@ HdArnoldRenderDelegate::HdArnoldRenderDelegate(HdArnoldRenderContext context) :
// We need access to both beauty and P at the same time.
if (_context == HdArnoldRenderContext::Husk) {
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderSetHintBool(_render_session, str::progressive, false);
AiRenderSetHintBool(_renderSession, str::progressive, false);
#else
AiRenderSetHintBool(str::progressive, false);
#endif
AiNodeSetBool(_options, str::enable_progressive_render, false);
} else {
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderSetHintBool(_render_session, str::progressive_show_all_outputs, true);
AiRenderSetHintBool(_renderSession, str::progressive_show_all_outputs, true);
#else
AiRenderSetHintBool(str::progressive_show_all_outputs, true);
#endif
Expand All @@ -451,7 +451,7 @@ HdArnoldRenderDelegate::~HdArnoldRenderDelegate()
}
_renderParam->Interrupt();
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderSessionDestroy(_render_session);
AiRenderSessionDestroy(_renderSession);
#endif
hdArnoldUninstallNodes();
AiUniverseDestroy(_universe);
Expand Down Expand Up @@ -503,7 +503,7 @@ void HdArnoldRenderDelegate::_SetRenderSetting(const TfToken& _key, const VtValu
if (_context != HdArnoldRenderContext::Husk) {
_CheckForBoolValue(value, [&](const bool b) {
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderSetHintBool(_render_session, str::progressive, b);
AiRenderSetHintBool(_renderSession, str::progressive, b);
#else
AiRenderSetHintBool(str::progressive, b);
#endif
Expand All @@ -514,7 +514,7 @@ void HdArnoldRenderDelegate::_SetRenderSetting(const TfToken& _key, const VtValu
if (_context != HdArnoldRenderContext::Husk) {
_CheckForIntValue(value, [&](const int i) {
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderSetHintInt(_render_session, str::progressive_min_AA_samples, i);
AiRenderSetHintInt(_renderSession, str::progressive_min_AA_samples, i);
#else
AiRenderSetHintInt(str::progressive_min_AA_samples, i);
#endif
Expand All @@ -524,7 +524,7 @@ void HdArnoldRenderDelegate::_SetRenderSetting(const TfToken& _key, const VtValu
if (_context != HdArnoldRenderContext::Husk) {
if (value.IsHolding<float>()) {
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderSetHintFlt(_render_session, str::interactive_target_fps, value.UncheckedGet<float>());
AiRenderSetHintFlt(_renderSession, str::interactive_target_fps, value.UncheckedGet<float>());
#else
AiRenderSetHintFlt(str::interactive_target_fps, value.UncheckedGet<float>());
#endif
Expand All @@ -534,7 +534,7 @@ void HdArnoldRenderDelegate::_SetRenderSetting(const TfToken& _key, const VtValu
if (_context != HdArnoldRenderContext::Husk) {
if (value.IsHolding<float>()) {
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderSetHintFlt(_render_session, str::interactive_target_fps_min, value.UncheckedGet<float>());
AiRenderSetHintFlt(_renderSession, str::interactive_target_fps_min, value.UncheckedGet<float>());
#else
AiRenderSetHintFlt(str::interactive_target_fps_min, value.UncheckedGet<float>());
#endif
Expand All @@ -544,7 +544,7 @@ void HdArnoldRenderDelegate::_SetRenderSetting(const TfToken& _key, const VtValu
if (_context != HdArnoldRenderContext::Husk) {
if (value.IsHolding<float>()) {
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderSetHintFlt(_render_session, str::interactive_fps_min, value.UncheckedGet<float>());
AiRenderSetHintFlt(_renderSession, str::interactive_fps_min, value.UncheckedGet<float>());
#else
AiRenderSetHintFlt(str::interactive_fps_min, value.UncheckedGet<float>());
#endif
Expand Down Expand Up @@ -677,15 +677,15 @@ VtValue HdArnoldRenderDelegate::GetRenderSetting(const TfToken& _key) const
} else if (key == str::t_enable_progressive_render) {
bool v = true;
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderGetHintBool(_render_session, str::progressive, v);
AiRenderGetHintBool(_renderSession, str::progressive, v);
#else
AiRenderGetHintBool(str::progressive, v);
#endif
return VtValue(v);
} else if (key == str::t_progressive_min_AA_samples) {
int v = -4;
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderGetHintInt(_render_session, str::progressive_min_AA_samples, v);
AiRenderGetHintInt(_renderSession, str::progressive_min_AA_samples, v);
#else
AiRenderGetHintInt(str::progressive_min_AA_samples, v);
#endif
Expand All @@ -697,23 +697,23 @@ VtValue HdArnoldRenderDelegate::GetRenderSetting(const TfToken& _key) const
} else if (key == str::t_interactive_target_fps) {
float v = 1.0f;
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderGetHintFlt(_render_session, str::interactive_target_fps, v);
AiRenderGetHintFlt(_renderSession, str::interactive_target_fps, v);
#else
AiRenderGetHintFlt(str::interactive_target_fps, v);
#endif
return VtValue(v);
} else if (key == str::t_interactive_target_fps_min) {
float v = 1.0f;
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderGetHintFlt(_render_session, str::interactive_target_fps_min, v);
AiRenderGetHintFlt(_renderSession, str::interactive_target_fps_min, v);
#else
AiRenderGetHintFlt(str::interactive_target_fps_min, v);
#endif
return VtValue(v);
} else if (key == str::t_interactive_fps_min) {
float v = 1.0f;
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderGetHintFlt(_render_session, str::interactive_fps_min, v);
AiRenderGetHintFlt(_renderSession, str::interactive_fps_min, v);
#else
AiRenderGetHintFlt(str::interactive_fps_min, v);
#endif
Expand Down Expand Up @@ -753,7 +753,7 @@ VtDictionary HdArnoldRenderDelegate::GetRenderStats() const

float total_progress = 100.0f;
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AiRenderGetHintFlt(_render_session, str::total_progress, total_progress);
AiRenderGetHintFlt(_renderSession, str::total_progress, total_progress);
#else
AiRenderGetHintFlt(str::total_progress, total_progress);
#endif
Expand Down Expand Up @@ -960,7 +960,7 @@ AtString HdArnoldRenderDelegate::GetLocalNodeName(const AtString& name) const
AtUniverse* HdArnoldRenderDelegate::GetUniverse() const { return _universe; }

#ifdef AI_MULTIPLE_RENDER_SESSIONS
AtRenderSession* HdArnoldRenderDelegate::GetRenderSession() const { return _render_session; }
AtRenderSession* HdArnoldRenderDelegate::GetRenderSession() const { return _renderSession; }
#endif

AtNode* HdArnoldRenderDelegate::GetOptions() const { return _options; }
Expand Down
2 changes: 1 addition & 1 deletion render_delegate/render_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ class HdArnoldRenderDelegate final : public HdRenderDelegate {
SdfPath _id; ///< Path of the Render Delegate.
AtUniverse* _universe; ///< Universe used by the Render Delegate.
#ifdef AI_MULTIPLE_RENDER_SESSIONS
AtRenderSession* _render_session; ///< Render session used by the Render Delegate.
AtRenderSession* _renderSession; ///< Render session used by the Render Delegate.
#endif
AtNode* _options; ///< Pointer to the Arnold Options Node.
AtNode* _fallbackShader; ///< Pointer to the fallback Arnold Shader.
Expand Down

0 comments on commit e3c1355

Please sign in to comment.