2020-03-08 13:38:40 +01:00
|
|
|
#include "GraphicsResources.h"
|
|
|
|
|
|
2020-03-20 01:27:40 +01:00
|
|
|
using namespace Seele::Gfx;
|
2020-03-08 13:38:40 +01:00
|
|
|
|
2020-03-20 01:27:40 +01:00
|
|
|
void DescriptorLayout::addDescriptorBinding(uint32 bindingIndex, SeDescriptorType type, uint32 arrayCount)
|
2020-03-08 13:38:40 +01:00
|
|
|
{
|
|
|
|
|
if (descriptorBindings.size() <= bindingIndex)
|
|
|
|
|
{
|
|
|
|
|
descriptorBindings.resize(bindingIndex + 1);
|
|
|
|
|
}
|
|
|
|
|
DescriptorBinding binding;
|
|
|
|
|
binding.binding = bindingIndex;
|
|
|
|
|
binding.descriptorType = type;
|
|
|
|
|
binding.descriptorCount = arrayCount;
|
|
|
|
|
descriptorBindings[bindingIndex] = binding;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-20 01:27:40 +01:00
|
|
|
PDescriptorSet DescriptorLayout::allocatedDescriptorSet()
|
2020-03-08 13:38:40 +01:00
|
|
|
{
|
|
|
|
|
PDescriptorSet result;
|
|
|
|
|
allocator->allocateDescriptorSet(result);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-20 01:27:40 +01:00
|
|
|
void PipelineLayout::addDescriptorLayout(uint32 setIndex, PDescriptorLayout layout)
|
2020-03-08 13:38:40 +01:00
|
|
|
{
|
|
|
|
|
if (descriptorSetLayouts.size() <= setIndex)
|
|
|
|
|
{
|
|
|
|
|
descriptorSetLayouts.resize(setIndex + 1);
|
|
|
|
|
}
|
|
|
|
|
if (descriptorSetLayouts[setIndex] != nullptr)
|
|
|
|
|
{
|
|
|
|
|
auto& thisBindings = descriptorSetLayouts[setIndex]->descriptorBindings;
|
|
|
|
|
auto& otherBindings = layout->descriptorBindings;
|
|
|
|
|
thisBindings.resize(otherBindings.size());
|
|
|
|
|
for (size_t i = 0; i < otherBindings.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (otherBindings[i].descriptorType != SE_DESCRIPTOR_TYPE_MAX_ENUM)
|
|
|
|
|
{
|
|
|
|
|
assert(thisBindings[i].descriptorType != SE_DESCRIPTOR_TYPE_MAX_ENUM ? thisBindings[i].descriptorType == otherBindings[i].descriptorType : true);
|
|
|
|
|
thisBindings[i] = otherBindings[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
descriptorSetLayouts[setIndex] = layout;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-20 01:27:40 +01:00
|
|
|
void PipelineLayout::addPushConstants(const SePushConstantRange& pushConstant)
|
2020-03-08 13:38:40 +01:00
|
|
|
{
|
|
|
|
|
pushConstants.add(pushConstant);
|
|
|
|
|
}
|