-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBindingGroupLayout.cpp
More file actions
37 lines (32 loc) · 1.15 KB
/
BindingGroupLayout.cpp
File metadata and controls
37 lines (32 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "BindingGroupLayout.hpp"
namespace RR::GAPI
{
void BindingGroupLayout::InitReflection(const BindingGroupReflectionDesc& desc)
{
bindingSpace = desc.bindingSpace;
uniformBufferSize = desc.uniformBufferSize;
uniformCbvSlot = desc.uniformCbvSlot;
for (const auto& f : desc.fields)
{
const uint32_t index = static_cast<uint32_t>(fields.size());
fields.push_back(f);
fieldMap[f.nameHash] = index;
}
for (const auto& r : desc.resources)
{
const uint32_t index = static_cast<uint32_t>(resourceSlots.size());
resourceSlots.push_back(r);
resourceMap[r.nameHash] = index;
}
}
uint32_t BindingGroupLayout::FindFieldIndex(Common::HashType nameHash) const
{
const auto it = fieldMap.find(nameHash);
return it != fieldMap.end() ? it->second : INVALID_SLOT;
}
uint32_t BindingGroupLayout::FindResourceSlotIndex(Common::HashType nameHash) const
{
const auto it = resourceMap.find(nameHash);
return it != resourceMap.end() ? it->second : INVALID_SLOT;
}
}