| 263 | } |
| 264 | |
| 265 | HnRenderPass::EXECUTE_RESULT HnRenderPass::Execute(HnRenderPassState& RPState, const pxr::TfTokenVector& Tags) |
| 266 | { |
| 267 | UpdateDrawList(Tags); |
| 268 | if (m_DrawList.empty()) |
| 269 | return EXECUTE_RESULT_OK; |
| 270 | |
| 271 | RenderState State{*this, RPState}; |
| 272 | |
| 273 | const std::string DebugGroupName = std::string{"Render Pass - "} + m_MaterialTag.GetString() + " - " + HnRenderPassParams::GetSelectionTypeString(m_Params.Selection); |
| 274 | ScopedDebugGroup DebugGroup{State.pCtx, DebugGroupName.c_str()}; |
| 275 | |
| 276 | RPState.Commit(State.pCtx); |
| 277 | |
| 278 | { |
| 279 | PBR_Renderer::DebugViewType DebugView = State.RenderParam.GetDebugView(); |
| 280 | if (m_DebugView != DebugView) |
| 281 | { |
| 282 | m_DrawListItemsDirtyFlags |= DRAW_LIST_ITEM_DIRTY_FLAG_PSO; |
| 283 | m_DebugView = DebugView; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | { |
| 288 | HN_RENDER_MODE RenderMode = State.RenderParam.GetRenderMode(); |
| 289 | if (m_RenderMode != RenderMode) |
| 290 | { |
| 291 | m_RenderMode = RenderMode; |
| 292 | m_DrawListItemsDirtyFlags |= DRAW_LIST_ITEM_DIRTY_FLAG_PSO | DRAW_LIST_ITEM_DIRTY_FLAG_MESH_DATA; |
| 293 | // Reset fallback PSO so that it is updated in UpdateDrawListGPUResources |
| 294 | m_FallbackPSO = nullptr; |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | { |
| 299 | bool UseShadows = State.RenderParam.GetUseShadows(); |
| 300 | if (m_UseShadows != UseShadows) |
| 301 | { |
| 302 | m_DrawListItemsDirtyFlags |= DRAW_LIST_ITEM_DIRTY_FLAG_PSO; |
| 303 | m_UseShadows = UseShadows; |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | { |
| 308 | const Uint32 MaterialVersion = State.RenderParam.GetAttribVersion(HnRenderParam::GlobalAttrib::Material); |
| 309 | const Uint32 MeshCullingVersion = State.RenderParam.GetAttribVersion(HnRenderParam::GlobalAttrib::MeshCulling); |
| 310 | if (m_GlobalAttribVersions.Material != MaterialVersion || |
| 311 | m_GlobalAttribVersions.MeshCulling != MeshCullingVersion) |
| 312 | { |
| 313 | // Attributes of some material have changed. We don't know which meshes may be affected, |
| 314 | // so we need to process the entire draw list. |
| 315 | |
| 316 | // Also update draw list items when mesh culling changes as it affects the PSO. |
| 317 | |
| 318 | m_DrawListItemsDirtyFlags |= DRAW_LIST_ITEM_DIRTY_FLAG_PSO; |
| 319 | |
| 320 | m_GlobalAttribVersions.Material = MaterialVersion; |
| 321 | m_GlobalAttribVersions.MeshCulling = MeshCullingVersion; |
| 322 | } |
nothing calls this directly
no test coverage detected