Skip to content

Commit 498b153

Browse files
Hydrogent: a few minor updates/fixes
1 parent 63f9f82 commit 498b153

15 files changed

+52
-40
lines changed

Hydrogent/interface/HnRenderPass.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ struct HnRenderPassParams
7373
{
7474
return (Selection == rhs.Selection &&
7575
Type == rhs.Type &&
76-
UsdPsoFlags == rhs.UsdPsoFlags);
76+
UsdPsoFlags == rhs.UsdPsoFlags &&
77+
AlphaMode == rhs.AlphaMode);
7778
}
7879

7980
static const char* GetSelectionTypeString(SelectionType Type);

Hydrogent/interface/HnRenderPassState.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class HnRenderPassState final : public pxr::HdRenderPassState
141141
}
142142
bool GetUseReverseDepth() const
143143
{
144-
return GetDepthFunc() == pxr::HdCmpFuncGreater;
144+
return GetDepthFunc() == pxr::HdCmpFuncGreater || GetDepthFunc() == pxr::HdCmpFuncGEqual;
145145
}
146146

147147
static constexpr Uint32 ClearDepthBit = 1u << 31u;

Hydrogent/interface/Tasks/HnBeginFrameTask.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ namespace USD
4848
{
4949

5050
class HnCamera;
51-
class HnRenderDelegate;
5251

5352
struct HnBeginFrameTaskParams
5453
{
@@ -99,15 +98,16 @@ struct HnBeginFrameTaskParams
9998
constexpr bool operator==(const RendererParams& rhs) const
10099
{
101100
// clang-format off
102-
return OcclusionStrength == rhs.OcclusionStrength &&
103-
EmissionScale == rhs.EmissionScale &&
104-
IBLScale == rhs.IBLScale &&
105-
UnshadedColor == rhs.UnshadedColor &&
106-
PointSize == rhs.PointSize &&
107-
LoadingAnimationColor0 == rhs.LoadingAnimationColor0 &&
108-
LoadingAnimationColor1 == rhs.LoadingAnimationColor1 &&
109-
LoadingAnimationWorldScale == rhs.LoadingAnimationWorldScale &&
110-
LoadingAnimationSpeed == rhs.LoadingAnimationSpeed;
101+
return OcclusionStrength == rhs.OcclusionStrength &&
102+
EmissionScale == rhs.EmissionScale &&
103+
IBLScale == rhs.IBLScale &&
104+
UnshadedColor == rhs.UnshadedColor &&
105+
PointSize == rhs.PointSize &&
106+
LoadingAnimationColor0 == rhs.LoadingAnimationColor0 &&
107+
LoadingAnimationColor1 == rhs.LoadingAnimationColor1 &&
108+
LoadingAnimationWorldScale == rhs.LoadingAnimationWorldScale &&
109+
LoadingAnimationSpeed == rhs.LoadingAnimationSpeed &&
110+
LoadingAnimationTransitionDuration == rhs.LoadingAnimationTransitionDuration;
111111
// clang-format on
112112
}
113113
};

Hydrogent/interface/Tasks/HnBeginOITPassTask.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ struct HnBeginOITPassTaskParams
5555
}
5656
};
5757

58-
/// Updates OIT layers
58+
/// Begins OIT pass
59+
/// - Binds OIT resources
60+
/// - Clears OIT layers
5961
class HnBeginOITPassTask final : public HnTask
6062
{
6163
public:

Hydrogent/interface/Tasks/HnEndOITPassTask.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ struct HnEndOITPassTaskParams
5050
}
5151
};
5252

53-
/// Updates OIT layers
53+
/// Ends OIT pass
54+
/// - Applies OIT attenuation to the color, base color, material and IBL targets
5455
class HnEndOITPassTask final : public HnTask
5556
{
5657
public:

Hydrogent/interface/Tasks/HnPostProcessTask.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 Diligent Graphics LLC
2+
* Copyright 2023-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -171,8 +171,10 @@ struct HnPostProcessTaskParams
171171
};
172172

173173
/// Performs post processing:
174-
/// - Tone mapping
174+
/// - SSR, SSAO, TAA, DOF, Bloom, Tone mapping
175175
/// - Selection outline
176+
/// - Coordinate grid
177+
/// - Motion vectors
176178
/// - Converts output to sRGB, if needed
177179
class HnPostProcessTask final : public HnTask
178180
{

Hydrogent/interface/Tasks/HnRenderRprimsTask.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 Diligent Graphics LLC
2+
* Copyright 2023-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -72,7 +72,7 @@ struct HnRenderRprimsTaskParams
7272
DEFINE_FLAG_ENUM_OPERATORS(HnRenderRprimsTaskParams::RENDER_MODE_FLAGS);
7373

7474
/// Renders the Rprims by executing the render pass.
75-
/// The task should be executed after the HnSetupRenderingTask that prepares
75+
/// The task should be executed after the HnBeginMainPassTask that prepares
7676
/// the render targets and sets the required task context and render pass state
7777
/// parameters.
7878
class HnRenderRprimsTask final : public HnTask

Hydrogent/interface/Tasks/HnTaskManager.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,14 @@ class HnTaskManager
111111
/// * Binds and clears OIT layers for rendering
112112
/// - RenderRprimsOITLayers
113113
/// - EndOITPass
114+
/// * Applies OIT attenuation to color, base color, material and IBL targets
114115
/// - RenderRprimsAdditive
115116
/// * Renders all Rprims with additive material tag
116117
/// - RenderRprimsTranslucent
117118
/// * Renders all Rprims with translucent material tag
118-
/// - TaskUID_RenderRprimsTranslucentMeshId
119-
/// * Renders all Rprims with translucent material tag (Mesh ID, Motion Vectors, Depth)
119+
/// * If OIT is enabled, does not write Mesh ID, Motion Vectors, Normals, Depth
120+
/// - RenderRprimsTranslucentMeshId
121+
/// * Renders all Rprims with translucent material tag (Mesh ID, Motion Vectors, Normals, Depth)
120122
/// - RenderRprimsAdditiveSelected
121123
/// * Renders only selected Rprims with the additive material tag (depth only)
122124
/// - RenderRprimsTranslucentSelected
@@ -140,10 +142,10 @@ class HnTaskManager
140142
/// | RenderBoundBox | | | V | | | | |
141143
/// | RenderRprimsAdditive | V | V | V | V | V | | V |
142144
/// | BeginOITPass | | | | | | | |
143-
/// | RenderRprimsOITLayers | | | | | | | |
145+
/// | RenderRprimsOITLayers | V | V | | | | | |
144146
/// | EndOITPass | | | | | | | |
145147
/// | RenderRprimsTranslucent | V | V | V | V | V | | V |
146-
/// | RenderRprimsTranslucentMeshId | V | V | | V | | | V |
148+
/// | RenderRprimsTranslucentMeshId | V | V | | V | MV, N | | V |
147149
/// | RenderRprimsAdditiveSelected | V | | | | | V | |
148150
/// | RenderRprimsTranslucentSelected | V | | | | | V | |
149151
/// | ReadRprimId | | | | | | | |

Hydrogent/src/HnRenderDelegate.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,7 @@ void HnRenderDelegate::CommitResources(pxr::HdChangeTracker* tracker)
760760
{
761761
m_ShadowAtlasVersion = ShadowAtlasVersion;
762762

763+
// Release the frame attribs SRBs to update the shadow map SRV.
763764
static_assert(static_cast<size_t>(FrameAttribsSRBType::Count) == 2, "Did you add a new FrameAttribsSRBType? You may need to update this code.");
764765
for (FrameAttribsSRBType Type : {FrameAttribsSRBType::Opaque, FrameAttribsSRBType::Transparent})
765766
_GetFrameAttribsSRB(Type).Release();
@@ -769,8 +770,7 @@ void HnRenderDelegate::CommitResources(pxr::HdChangeTracker* tracker)
769770
const bool EnableOIT = m_USDRenderer->GetSettings().OITLayerCount > 0;
770771
if (EnableOIT)
771772
{
772-
// OIT resource version is made dirty by HnBeginOITPassTask when the frame size changes.
773-
// OIT resources will be set in the SRB by HnBeginOITPassTask::Execute().
773+
// OIT resource version is made dirty by HnBeginOITPassTask::Prepare() when the frame size changes.
774774
if (m_OITResourcesVersion != m_RenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::OITResources))
775775
{
776776
m_OITResourcesVersion = m_RenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::OITResources);
@@ -832,6 +832,7 @@ void HnRenderDelegate::CommitResources(pxr::HdChangeTracker* tracker)
832832
{
833833
if (!TransparentPassFrameAttribsSRB)
834834
{
835+
// OIT resources are set in the transparent pass SRB by HnBeginOITPassTask::Execute().
835836
TransparentPassFrameAttribsSRB = CreateFrameAttribsSRB(m_USDRenderer->GetPRBFrameAttribsSize(), pShadowSRV);
836837
}
837838
}

Hydrogent/src/HnRenderPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ struct HnRenderPass::RenderState
181181
if (Type == PBR_Renderer::RenderPassType::OITLayers && pRWOITLayersSRB == nullptr)
182182
{
183183
pRWOITLayersSRB = RPState.GetRWOITLayersSRB();
184-
VERIFY_EXPR(pRWOITLayersSRB != nullptr);
184+
VERIFY_EXPR(pRWOITLayersSRB != nullptr, "RW OIT layers SRB is null. It should have been set in the render pass state by HnBeginOITPassTask::Execute().");
185185
pCtx->CommitShaderResources(pRWOITLayersSRB, RESOURCE_STATE_TRANSITION_MODE_VERIFY);
186186
}
187187

0 commit comments

Comments
 (0)