MCPcopy Create free account
hub / github.com/NVIDIA-RTX/NVRHI / createBindingSet

Method createBindingSet

src/validation/validation-device.cpp:1818–1893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1816 }
1817
1818 BindingSetHandle DeviceWrapper::createBindingSet(const BindingSetDesc& desc, IBindingLayout* layout)
1819 {
1820 if (layout == nullptr)
1821 {
1822 error("Cannot create a binding set without a valid layout");
1823 return nullptr;
1824 }
1825
1826 const BindingLayoutDesc* layoutDesc = layout->getDesc();
1827 if (!layoutDesc)
1828 {
1829 error("Cannot create a binding set from a bindless layout");
1830 return nullptr;
1831 }
1832
1833 std::stringstream errorStream;
1834 bool anyErrors = false;
1835 bool const ignoreRegisterSpaces = (m_Device->getGraphicsAPI() == GraphicsAPI::D3D11);
1836
1837 BindingSummary layoutBindings;
1838 BindingLocationSet layoutDuplicates;
1839
1840 FillBindingLayoutSummary(m_MessageCallback, *layoutDesc, ignoreRegisterSpaces,
1841 layoutBindings, layoutDuplicates);
1842
1843 BindingSummary setBindings;
1844 BindingLocationSet setDuplicates;
1845
1846 FillBindingSetSummary(m_MessageCallback, desc, ignoreRegisterSpaces, layoutDesc->registerSpace,
1847 setBindings, setDuplicates);
1848
1849 BindingLocationSet declaredNotBound;
1850 BindingLocationSet boundNotDeclared;
1851
1852 declaredNotBound = SetDifference(layoutBindings.locations, setBindings.locations);
1853 boundNotDeclared = SetDifference(setBindings.locations, layoutBindings.locations);
1854
1855 if (!declaredNotBound.empty())
1856 {
1857 errorStream << "Bindings declared in the layout are not present in the binding set: " << declaredNotBound << std::endl;
1858 anyErrors = true;
1859 }
1860
1861 if (!boundNotDeclared.empty())
1862 {
1863 errorStream << "Bindings in the binding set are not declared in the layout: " << boundNotDeclared << std::endl;
1864 anyErrors = true;
1865 }
1866
1867 if (!setDuplicates.empty())
1868 {
1869 errorStream << "Binding set contains duplicate bindings: " << setDuplicates << std::endl;
1870 anyErrors = true;
1871 }
1872
1873 for (size_t index = 0; index < desc.bindings.size(); index++)
1874 {
1875 if (!validateBindingSetItem(desc.bindings[index], nullptr, errorStream))

Callers 1

Calls 8

FillBindingLayoutSummaryFunction · 0.85
FillBindingSetSummaryFunction · 0.85
SetDifferenceFunction · 0.85
unwrapResourceFunction · 0.85
sizeMethod · 0.80
getDescMethod · 0.45
getGraphicsAPIMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected