MCPcopy Create free account
hub / github.com/NVIDIA-RTX/Donut / Scene

Method Scene

src/engine/Scene.cpp:82–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80};
81
82Scene::Scene(
83 nvrhi::IDevice* device,
84 ShaderFactory& shaderFactory,
85 std::shared_ptr<IFileSystem> fs,
86 std::shared_ptr<TextureCache> textureCache,
87 std::shared_ptr<DescriptorTableManager> descriptorTable,
88 std::shared_ptr<SceneTypeFactory> sceneTypeFactory)
89 : m_fs(std::move(fs))
90 , m_SceneTypeFactory(std::move(sceneTypeFactory))
91 , m_TextureCache(std::move(textureCache))
92 , m_DescriptorTable(std::move(descriptorTable))
93 , m_Device(device)
94{
95 m_Resources = std::make_shared<Resources>();
96
97 if (!m_SceneTypeFactory)
98 m_SceneTypeFactory = std::make_shared<SceneTypeFactory>();
99
100 m_GltfImporter = std::make_shared<GltfImporter>(m_fs, m_SceneTypeFactory);
101
102 m_EnableBindlessResources = !!m_DescriptorTable;
103 m_RayTracingSupported = m_Device->queryFeatureSupport(nvrhi::Feature::RayTracingAccelStruct);
104
105 m_SkinningShader = shaderFactory.CreateAutoShader("donut/skinning_cs", "main", DONUT_MAKE_PLATFORM_SHADER(g_skinning_cs), nullptr, nvrhi::ShaderType::Compute);
106
107 {
108 nvrhi::BindingLayoutDesc layoutDesc;
109 layoutDesc.visibility = nvrhi::ShaderType::Compute;
110 layoutDesc.bindings = {
111 nvrhi::BindingLayoutItem::PushConstants(0, sizeof(SkinningConstants)),
112 nvrhi::BindingLayoutItem::RawBuffer_SRV(0),
113 nvrhi::BindingLayoutItem::RawBuffer_SRV(1),
114 nvrhi::BindingLayoutItem::RawBuffer_UAV(0)
115 };
116
117 m_SkinningBindingLayout = m_Device->createBindingLayout(layoutDesc);
118 }
119
120 {
121 nvrhi::ComputePipelineDesc pipelineDesc;
122 pipelineDesc.bindingLayouts = { m_SkinningBindingLayout };
123 pipelineDesc.CS = m_SkinningShader;
124 m_SkinningPipeline = m_Device->createComputePipeline(pipelineDesc);
125 }
126}
127
128bool Scene::Load(const std::filesystem::path& jsonFileName)
129{

Callers

nothing calls this directly

Calls 1

CreateAutoShaderMethod · 0.80

Tested by

no test coverage detected