@@ -119,12 +119,12 @@ SampleBase::CommandLineStatus USDViewer::ProcessCommandLine(int argc, const char
119119 ArgsParser.Parse (" usd_path" , ' u' , m_UsdFileName);
120120 ArgsParser.Parse (" vertex_pool" , m_UseVertexPool);
121121 ArgsParser.Parse (" index_pool" , m_UseIndexPool);
122- ArgsParser.Parse (" texture_atlas " , m_UseTextureAtlas );
122+ ArgsParser.Parse (" atlas_dim " , m_TextureAtlasDim );
123123 LOG_INFO_MESSAGE (" USD Viewer Arguments:" ,
124124 " \n USD Path: " , m_UsdFileName,
125125 " \n Use vertex pool: " , m_UseVertexPool ? " Yes" : " No" ,
126126 " \n Use index pool: " , m_UseIndexPool ? " Yes" : " No" ,
127- " \n Use tex atlas: " , m_UseTextureAtlas ? " Yes " : " No " );
127+ " \n Tex atlas dim : " , m_TextureAtlasDim );
128128
129129 std::string ModelsDir;
130130 ArgsParser.Parse (" usd_dir" , ' d' , ModelsDir);
@@ -238,8 +238,23 @@ void USDViewer::LoadStage()
238238 DelegateCI.pRenderStateCache = nullptr ;
239239 DelegateCI.UseVertexPool = m_UseVertexPool;
240240 DelegateCI.UseIndexPool = m_UseIndexPool;
241- DelegateCI.TextureAtlasDim = m_UseTextureAtlas ? 2048 : 0 ;
242- m_Stage.RenderDelegate = USD::HnRenderDelegate::Create (DelegateCI);
241+ if (m_pDevice->GetDeviceInfo ().Features .BindlessResources )
242+ {
243+ m_BindingMode = USD::HN_MATERIAL_TEXTURES_BINDING_MODE_DYNAMIC;
244+
245+ DelegateCI.TexturesArraySize = 256 ;
246+ }
247+ else
248+ {
249+ m_BindingMode = m_TextureAtlasDim != 0 ?
250+ USD::HN_MATERIAL_TEXTURES_BINDING_MODE_ATLAS :
251+ USD::HN_MATERIAL_TEXTURES_BINDING_MODE_LEGACY;
252+
253+ DelegateCI.TextureAtlasDim = m_TextureAtlasDim;
254+ }
255+ DelegateCI.TextureBindingMode = m_BindingMode;
256+
257+ m_Stage.RenderDelegate = USD::HnRenderDelegate::Create (DelegateCI);
243258 m_Stage.RenderIndex .reset (pxr::HdRenderIndex::New (m_Stage.RenderDelegate .get (), pxr::HdDriverVector{}));
244259
245260 const pxr::SdfPath SceneDelegateId = pxr::SdfPath::AbsoluteRootPath ();
@@ -694,6 +709,7 @@ void USDViewer::UpdateUI()
694709 {
695710 const auto MemoryStats = m_Stage.RenderDelegate ->GetMemoryStats ();
696711 ImGui::TextDisabled (" Task time\n "
712+ " Binding\n "
697713 " Num draws\n "
698714 " Tris\n "
699715 " Lines\n "
@@ -715,7 +731,17 @@ void USDViewer::UpdateUI()
715731 const std::string IndPoolCommittedSizeStr = GetMemorySizeString (MemoryStats.IndexPool .CommittedSize ).c_str ();
716732 const std::string IndPoolUsedSizeStr = GetMemorySizeString (MemoryStats.IndexPool .UsedSize ).c_str ();
717733 const std::string AtlasCommittedSizeStr = GetMemorySizeString (MemoryStats.Atlas .CommittedSize ).c_str ();
734+
735+ const char * TextureBindingModeStr = " " ;
736+ switch (m_BindingMode)
737+ {
738+ case USD::HN_MATERIAL_TEXTURES_BINDING_MODE_LEGACY: TextureBindingModeStr = " Legacy" ; break ;
739+ case USD::HN_MATERIAL_TEXTURES_BINDING_MODE_ATLAS: TextureBindingModeStr = " Atlas" ; break ;
740+ case USD::HN_MATERIAL_TEXTURES_BINDING_MODE_DYNAMIC: TextureBindingModeStr = " Dynamic" ; break ;
741+ }
742+
718743 ImGui::TextDisabled (" %.1f ms\n "
744+ " %s\n "
719745 " %d\n "
720746 " %d\n "
721747 " %d\n "
@@ -731,6 +757,7 @@ void USDViewer::UpdateUI()
731757 " %s / %s (%d allocs)\n "
732758 " %s (%.1lf%%, %d allocs)" ,
733759 m_Stats.TaskRunTime * 1000 .f ,
760+ TextureBindingModeStr,
734761 m_Stats.NumDrawCommands ,
735762 m_Stats.NumTriangles ,
736763 m_Stats.NumLines ,
0 commit comments