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

Function CreateBindingSetAndLayout

src/common/utils.cpp:68–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66 }
67
68 bool CreateBindingSetAndLayout(
69 nvrhi::IDevice* device,
70 nvrhi::ShaderType visibility,
71 uint32_t registerSpace,
72 const nvrhi::BindingSetDesc& bindingSetDesc,
73 nvrhi::BindingLayoutHandle& bindingLayout,
74 nvrhi::BindingSetHandle& bindingSet,
75 bool registerSpaceIsDescriptorSet)
76 {
77 auto convertSetToLayout = [](const std::vector<BindingSetItem>& setDesc, std::vector<BindingLayoutItem>& layoutDesc)
78 {
79 for (auto& item : setDesc)
80 {
81 BindingLayoutItem layoutItem{};
82 layoutItem.slot = item.slot;
83 layoutItem.type = item.type;
84 layoutItem.size = 1;
85 if (item.type == ResourceType::PushConstants)
86 layoutItem.size = uint32_t(item.range.byteSize);
87 layoutDesc.push_back(layoutItem);
88 }
89 };
90
91 if (!bindingLayout)
92 {
93 nvrhi::BindingLayoutDesc bindingLayoutDesc;
94 bindingLayoutDesc.visibility = visibility;
95 bindingLayoutDesc.registerSpace = registerSpace;
96 bindingLayoutDesc.registerSpaceIsDescriptorSet = registerSpaceIsDescriptorSet;
97 convertSetToLayout(bindingSetDesc.bindings, bindingLayoutDesc.bindings);
98
99 bindingLayout = device->createBindingLayout(bindingLayoutDesc);
100
101 if (!bindingLayout)
102 return false;
103 }
104
105 if (!bindingSet)
106 {
107 bindingSet = device->createBindingSet(bindingSetDesc, bindingLayout);
108
109 if (!bindingSet)
110 return false;
111 }
112
113 return true;
114 }
115
116 void ClearColorAttachment(ICommandList* commandList, IFramebuffer* framebuffer, uint32_t attachmentIndex, Color color)
117 {

Callers

nothing calls this directly

Calls 3

push_backMethod · 0.80
createBindingLayoutMethod · 0.45
createBindingSetMethod · 0.45

Tested by

no test coverage detected