@@ -119,12 +119,12 @@ SampleBase::CommandLineStatus USDViewer::ProcessCommandLine(int argc, const char
119
119
ArgsParser.Parse (" usd_path" , ' u' , m_UsdFileName);
120
120
ArgsParser.Parse (" vertex_pool" , m_UseVertexPool);
121
121
ArgsParser.Parse (" index_pool" , m_UseIndexPool);
122
- ArgsParser.Parse (" texture_atlas " , m_UseTextureAtlas );
122
+ ArgsParser.Parse (" atlas_dim " , m_TextureAtlasDim );
123
123
LOG_INFO_MESSAGE (" USD Viewer Arguments:" ,
124
124
" \n USD Path: " , m_UsdFileName,
125
125
" \n Use vertex pool: " , m_UseVertexPool ? " Yes" : " No" ,
126
126
" \n Use index pool: " , m_UseIndexPool ? " Yes" : " No" ,
127
- " \n Use tex atlas: " , m_UseTextureAtlas ? " Yes " : " No " );
127
+ " \n Tex atlas dim : " , m_TextureAtlasDim );
128
128
129
129
std::string ModelsDir;
130
130
ArgsParser.Parse (" usd_dir" , ' d' , ModelsDir);
@@ -238,8 +238,23 @@ void USDViewer::LoadStage()
238
238
DelegateCI.pRenderStateCache = nullptr ;
239
239
DelegateCI.UseVertexPool = m_UseVertexPool;
240
240
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);
243
258
m_Stage.RenderIndex .reset (pxr::HdRenderIndex::New (m_Stage.RenderDelegate .get (), pxr::HdDriverVector{}));
244
259
245
260
const pxr::SdfPath SceneDelegateId = pxr::SdfPath::AbsoluteRootPath ();
@@ -694,6 +709,7 @@ void USDViewer::UpdateUI()
694
709
{
695
710
const auto MemoryStats = m_Stage.RenderDelegate ->GetMemoryStats ();
696
711
ImGui::TextDisabled (" Task time\n "
712
+ " Binding\n "
697
713
" Num draws\n "
698
714
" Tris\n "
699
715
" Lines\n "
@@ -715,7 +731,17 @@ void USDViewer::UpdateUI()
715
731
const std::string IndPoolCommittedSizeStr = GetMemorySizeString (MemoryStats.IndexPool .CommittedSize ).c_str ();
716
732
const std::string IndPoolUsedSizeStr = GetMemorySizeString (MemoryStats.IndexPool .UsedSize ).c_str ();
717
733
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
+
718
743
ImGui::TextDisabled (" %.1f ms\n "
744
+ " %s\n "
719
745
" %d\n "
720
746
" %d\n "
721
747
" %d\n "
@@ -731,6 +757,7 @@ void USDViewer::UpdateUI()
731
757
" %s / %s (%d allocs)\n "
732
758
" %s (%.1lf%%, %d allocs)" ,
733
759
m_Stats.TaskRunTime * 1000 .f ,
760
+ TextureBindingModeStr,
734
761
m_Stats.NumDrawCommands ,
735
762
m_Stats.NumTriangles ,
736
763
m_Stats.NumLines ,
0 commit comments