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

implement flush texture using render delegate commands #1341

Merged
merged 3 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
implement flush texture using render delegate commands
  • Loading branch information
cpichard committed Nov 1, 2022
commit fa4298100163ead3d3a6e7ba4d5cabf58a40f309
21 changes: 21 additions & 0 deletions render_delegate/render_delegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,5 +1506,26 @@ void HdArnoldRenderDelegate::ClearCryptomatteDrivers()
_cryptomatteDrivers.clear();
}

#if PXR_VERSION >= 2108
HdCommandDescriptors HdArnoldRenderDelegate::GetCommandDescriptors() const
{
HdCommandDescriptors descriptors;
descriptors.emplace_back(TfToken("flush_texture"), "Flush textures");
return descriptors;
}

bool HdArnoldRenderDelegate::InvokeCommand(const TfToken& command, const HdCommandArgs& args)
{
if (command == TfToken("flush_texture")) {
// Pause render
_renderParam->Pause();
// Flush texture
AiUniverseCacheFlush(_universe, AI_CACHE_TEXTURE);
// Restart the render
_renderParam->Resume();
}
return false;
}
#endif // PXR_VERSION

PXR_NAMESPACE_CLOSE_SCOPE
11 changes: 11 additions & 0 deletions render_delegate/render_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,17 @@ class HdArnoldRenderDelegate final : public HdRenderDelegate {
GfVec2i GetResolution() const {return _resolution;}

bool IsBatchContext() const {return _isBatch;}

#if PXR_VERSION >= 2108
/// Get the descriptors for the commands supported by this render delegate.
HDARNOLD_API
virtual HdCommandDescriptors GetCommandDescriptors() const override;

/// Invoke a HdArnoldRenderDelegate command
HDARNOLD_API
virtual bool InvokeCommand(const TfToken& command, const HdCommandArgs& args = HdCommandArgs()) override;
#endif

private:
HdArnoldRenderDelegate(const HdArnoldRenderDelegate&) = delete;
HdArnoldRenderDelegate& operator=(const HdArnoldRenderDelegate&) = delete;
Expand Down