Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
134d34a
OGSMOD-8014 - Fix cmake module issue
hodoulp Sep 17, 2025
5b52ab7
Merge branch 'main' into hodoulp/cmake_module
hodoulp Sep 17, 2025
6a1610c
Provide built in support for copying output between passes.
AdamFelt Sep 27, 2025
9b1c94c
Merge remote-tracking branch 'origin/main' into felta/Improve-Buffer-…
AdamFelt Oct 6, 2025
207dccf
Add an enabled property to frame pass.
AdamFelt Oct 6, 2025
c5e494d
Fix unit tests
AdamFelt Oct 8, 2025
3b4769b
Remove InputAOV and Task reporting from FramePass::Update()
AdamFelt Oct 8, 2025
114e579
Remove the CopyTask as it is no longer needed
AdamFelt Oct 8, 2025
a07bd8c
Merge remote-tracking branch 'origin/main' into felta/Improve-Buffer-…
AdamFelt Oct 8, 2025
6a5fd3f
Temporarily modify a test because it is not working properly or testi…
AdamFelt Oct 8, 2025
dd96c7c
Incorperate a fix found by Sebastien in this branch
AdamFelt Oct 9, 2025
54584c3
Fix for Embree errors
AdamFelt Oct 9, 2025
ffc155e
Add robustness and sanity checking when getting the Hgi instance.
AdamFelt Oct 13, 2025
1a8dfeb
Merge branch 'main' into felta/Improve-Buffer-Transition
AdamFelt Oct 13, 2025
cc61ac8
Fix merge error
AdamFelt Oct 14, 2025
0268550
We can just use the default HdxFullScreenShader
AdamFelt Oct 14, 2025
b2c2f74
Improve function comments.
AdamFelt Oct 14, 2025
f58d4b0
Remove unused code.
AdamFelt Oct 14, 2025
049f4a8
Not my change.
AdamFelt Oct 14, 2025
44974b5
Fix build errors and more validity checking
AdamFelt Oct 15, 2025
ecd489b
Protect against Embree still rendering.
AdamFelt Oct 15, 2025
3c81144
Trying to fix build error.
AdamFelt Oct 16, 2025
4d3a12a
Another attempt at a fix.
AdamFelt Oct 16, 2025
374ae01
Add WaitForGPUIdle to several tests that were missing it.
AdamFelt Oct 17, 2025
0288104
Merge remote-tracking branch 'origin/main' into felta/Improve-Buffer-…
AdamFelt Oct 17, 2025
e991466
Code review feedback improvements
AdamFelt Oct 28, 2025
20363c3
Merge remote-tracking branch 'origin/main' into felta/Improve-Buffer-…
AdamFelt Oct 28, 2025
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
19 changes: 16 additions & 3 deletions include/hvt/engine/framePass.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ class HVT_API FramePass
public:
using Ptr = std::shared_ptr<FramePass>;

/// A list of frame passes paired with the Hydra tasks used to implement them.
using RenderTasks = std::vector<std::pair<FramePass*, PXR_NS::HdTaskSharedPtrVector>>;

/// Constructor
/// \param name An identifier.
/// \note An easy identifier can be a short description of the frame pass purpose.
Expand Down Expand Up @@ -384,6 +381,19 @@ class HVT_API FramePass
/// Returns the default selection accessor.
SelectionSettingsProviderWeakPtr GetSelectionSettingsAccessor() const;

/// Returns true if the frame pass should be rendered.
bool IsEnabled() const { return _enabled; }

/// Enables or disables the frame pass rendering.
void SetEnabled(bool enabled) { _enabled = enabled; }

// Returns the collection of render buffer bindings to use for the next render pass.
/// \param aovs The list of aovs to reuse and continue to fill from the previous pass.
/// \param copyContents Controls whether the results from the end of the tasks (non-MSAA) are copied
/// to the next pass. Set to false for simple task lists to avoid copying when unnecessary.
hvt::RenderBufferBindings GetRenderBufferBindingsForNextPass(
std::vector<pxr::TfToken> const& aovs, bool copyContents = true);

protected:
/// \brief Build a frame pass unique identifier.
///
Expand All @@ -404,6 +414,9 @@ class HVT_API FramePass
static PXR_NS::SdfPath _BuildUID(std::string const& name, std::string const& customPart);

private:

bool _enabled { true };

/// \brief Short identifier.
/// \note It should never be changed.
const std::string _name;
Expand Down
26 changes: 24 additions & 2 deletions include/hvt/engine/renderBufferSettingsProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <pxr/imaging/hd/aov.h>
#include <pxr/imaging/hd/renderBuffer.h>
#include <pxr/imaging/hgi/texture.h>

#if defined(__clang__)
#pragma clang diagnostic pop
Expand All @@ -47,8 +48,29 @@
namespace HVT_NS
{

using RenderBufferBindings =
std::vector<std::pair<PXR_NS::TfToken const&, PXR_NS::HdRenderBuffer*>>;
struct RenderBufferBinding
{
PXR_NS::TfToken aovName;
PXR_NS::HgiTextureHandle texture;
PXR_NS::HdRenderBuffer* buffer = nullptr;
std::string rendererName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: use a TfToken for the renderName instead of a string.

Since TfToken creation is somewhat expensive, it could be created once in FramePass::Initialize(), then stored as a FramePass or RenderBufferManager member variable and assigned in the RenderBufferBinding without having to deal with the string representation after FramePass::Initialize().

Comparisons and assignments of TfTokens are cheap, once converted from a string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, could be. This is not executed in a deep or large loop so there will be no real performance improvement. I wish the name from Hydra was a token to begin with, or there was a way to get the more accurate name "HdStormRenderDelegate". We could store it in the frame pass, but I would like to make this change in a second PR not this one.


RenderBufferBinding() = default;

/// Compares the property values.
bool operator==(RenderBufferBinding const& other) const
{
if (aovName != other.aovName || texture != other.texture || buffer != other.buffer ||
rendererName != other.rendererName)
return false;

return true;
}

/// Compares the property values, and negates.
bool operator!=(RenderBufferBinding const& other) const { return !(*this == other); }
};
using RenderBufferBindings = std::vector<RenderBufferBinding>;

using RenderBufferSettingsProviderWeakPtr = std::weak_ptr<class RenderBufferSettingsProvider>;

Expand Down
10 changes: 0 additions & 10 deletions include/hvt/engine/taskCreationHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,4 @@ HVT_API extern PXR_NS::SdfPath CreateSkyDomeTask(TaskManagerPtr& taskManager,
RenderBufferSettingsProviderWeakPtr const& renderSettingsProvider,
FnGetLayerSettings const& getLayerSettings, PXR_NS::SdfPath const& atPos,
TaskManager::InsertionOrder order);

/// Creates a copy task and inserts it before the atPos.
/// \param taskManager The task manager to update.
/// \param atPos The identifier of the task where to insert this new task. If empty, it inserts at
/// the end of the task's list.
/// \return The task unique identifier.
/// \note The task is usually the last one before the present task.
HVT_API extern PXR_NS::SdfPath CreateCopyTask(
TaskManagerPtr& taskManager, PXR_NS::SdfPath const& atPos = PXR_NS::SdfPath());

} // namespace HVT_NS
5 changes: 4 additions & 1 deletion include/hvt/engine/viewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ class HVT_API Viewport
/// \param modelInfo The model information.
/// \param enableFrameCancellation To enable the frame cancellation.
/// \param usePresentationTask To enable the use of the PresentTask.
virtual FramePass::RenderTasks Update(const ViewParams& viewInfo, const ModelParams& modelInfo,
virtual void Update(const ViewParams& viewInfo, const ModelParams& modelInfo,
bool enableFrameCancellation, bool usePresentationTask) = 0;

// Render the contents of the viewport.
virtual void Render() = 0;

/// Creates the render pipeline (using a shared model render pass or not).
/// \param renderIndex The render index to use where a null one means to create it.
/// \param is3DCamera To define if the camera is in 3D mode.
Expand Down
158 changes: 0 additions & 158 deletions include/hvt/tasks/copyTask.h

This file was deleted.

26 changes: 19 additions & 7 deletions source/engine/framePass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,20 +246,32 @@ std::tuple<SdfPathVector, SdfPathVector> FramePass::CreatePresetTasks(PresetTask

if (!IsStormRenderDelegate(GetRenderIndex()) && _bufferManager->IsAovSupported())
{
// Initialize the AOV system to render color, depth and ID buffers.
_bufferManager->SetRenderOutputs(
{ HdAovTokens->color, HdAovTokens->depth, HdAovTokens->primId, HdAovTokens->elementId,
HdAovTokens->instanceId },
{},
_passParams.renderParams.viewport); // NOTE: this is the non-adjusted viewport.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never understood the exact reason why initializing AOV buffers was necessary when using a renderer other than Storm.

I can see similar code being executed with the TaskController, from the constructor:
HdxTaskController::HdxTaskController -> HdxTaskController::_CreateRenderGraph() -> HdxTaskController::SetRenderOutputs("color")

Since I do not understand why this line had been added to the TaskController, I am slightly worried removing it here might break something.

However, on the other hand, I can see that _bufferManager->SetRenderOutputs is called early, in the beggining of FramePass::GetRenderTasks. Furthermore, all task update code (the commit functions) are called at the very end of FramePass::GetRenderTasks, which means not much is happening before SetRenderOutputs is called. So maybe it does not change anything to make this call later, given the order of things with the FramePass.

In conclusion, removing _bufferManager->SetRenderOutputs from this task creation function in the FramePass is probably safe, and this call might only be needed with the TaskController because it has a different task parameter update sequence, requiring the early call to HdxTaskController::SetRenderOutputs("color").

See:
https://git.autodesk.com/autodesk-forks/USD/blob/d34c093b8126e5b82fa35b478586539f82ceadd7/pxr/imaging/hdx/taskController.cpp#L292C13-L292C29

// Set the buffer paths for use with the selection and picking tasks.
_selectionHelper->SetVisualizeAOV(_bufferManager->GetViewportAov());
}

return { taskIds, renderTaskIds };
}

hvt::RenderBufferBindings FramePass::GetRenderBufferBindingsForNextPass(
std::vector<pxr::TfToken> const& aovs, bool copyContents)
{
std::string renderName = GetRenderIndex()->GetRenderDelegate()->GetRendererDisplayName();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::string renderName = GetRenderIndex()->GetRenderDelegate()->GetRendererDisplayName();
std::string const& renderName = GetRenderIndex()->GetRenderDelegate()->GetRendererDisplayName();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, a TfToken would be preferable here I think. The TfToken for the rendererName could be stored in the FramePass of the RenderBufferManager in FramePass::Initialize.


hvt::RenderBufferBindings inputAOVs;
for (auto& aov : aovs)
{
pxr::HgiTextureHandle aovTexture;
if (copyContents)
aovTexture = GetRenderTexture(aov);

pxr::HdRenderBuffer* aovBuffer = GetRenderBuffer(aov);
inputAOVs.push_back({ aov, aovTexture, aovBuffer, renderName });
}

return inputAOVs;
}

void FramePass::UpdateScene(UsdTimeCode /*frame*/) {}

HdTaskSharedPtrVector FramePass::GetRenderTasks(RenderBufferBindings const& inputAOVs)
Expand Down
Loading