new descriptor layout 2
This commit is contained in:
parent
74832c6824
commit
d1b8e45fb6
13 changed files with 412 additions and 128 deletions
|
|
@ -34,19 +34,16 @@ export namespace Crafter {
|
|||
bool occured = true;
|
||||
};
|
||||
|
||||
|
||||
class DescriptorPool {
|
||||
public:
|
||||
Event<void> onDescriptorRefresh;
|
||||
std::uint32_t setIndex = 0;
|
||||
std::vector<VkDescriptorSet> sets;
|
||||
VkDescriptorPool descriptorPool = VK_NULL_HANDLE;
|
||||
|
||||
template <typename Shader>
|
||||
consteval static void GetOccuringDescriptors(std::array<DescriptorEntry, 20>& types) {
|
||||
for (const DescriptorBinding& binding : Shader::descriptors) {
|
||||
for (const VkDescriptorSetLayoutBinding& binding : Shader::descriptors) {
|
||||
for (DescriptorEntry& type : types) {
|
||||
if (type.type == binding.type) {
|
||||
if (type.type == binding.descriptorType) {
|
||||
type.occured = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -77,10 +74,10 @@ export namespace Crafter {
|
|||
}
|
||||
|
||||
([&] {
|
||||
for (const DescriptorBinding& binding : Shaders::descriptors) {
|
||||
for (const VkDescriptorSetLayoutBinding& binding : Shaders::descriptors) {
|
||||
bool found = false;
|
||||
for(VkDescriptorPoolSize& type : types) {
|
||||
if(type.type == binding.type && type.descriptorCount != 12345) {
|
||||
if(type.type == binding.descriptorType && type.descriptorCount != 12345) {
|
||||
type.descriptorCount += 1;
|
||||
found = true;
|
||||
}
|
||||
|
|
@ -88,7 +85,7 @@ export namespace Crafter {
|
|||
if(!found) {
|
||||
for(std::uint32_t i = 0; i < GetUniqueDiscriptorCount<Shaders...>(); i++){
|
||||
if(types[i].descriptorCount == 12345) {
|
||||
types[i].type = binding.type;
|
||||
types[i].type = binding.descriptorType;
|
||||
types[i].descriptorCount = 1;
|
||||
break;
|
||||
}
|
||||
|
|
@ -125,10 +122,6 @@ export namespace Crafter {
|
|||
};
|
||||
|
||||
VulkanDevice::CheckVkResult(vkAllocateDescriptorSets(VulkanDevice::device, &allocInfo, sets.data()));
|
||||
|
||||
setIndex = 0;
|
||||
|
||||
onDescriptorRefresh.Invoke();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue