Files
Seele/src/Engine/Graphics/GraphicsResources.cpp
T

105 lines
3.0 KiB
C++
Raw Normal View History

#include "GraphicsResources.h"
2020-04-12 15:47:19 +02:00
using namespace Seele;
using namespace Seele::Gfx;
void DescriptorLayout::addDescriptorBinding(uint32 bindingIndex, SeDescriptorType type, uint32 arrayCount)
{
if (descriptorBindings.size() <= bindingIndex)
{
descriptorBindings.resize(bindingIndex + 1);
}
DescriptorBinding binding;
binding.binding = bindingIndex;
binding.descriptorType = type;
binding.descriptorCount = arrayCount;
descriptorBindings[bindingIndex] = binding;
}
PDescriptorSet DescriptorLayout::allocatedDescriptorSet()
{
PDescriptorSet result;
allocator->allocateDescriptorSet(result);
return result;
}
void PipelineLayout::addDescriptorLayout(uint32 setIndex, PDescriptorLayout layout)
{
if (descriptorSetLayouts.size() <= setIndex)
{
descriptorSetLayouts.resize(setIndex + 1);
}
if (descriptorSetLayouts[setIndex] != nullptr)
{
2020-04-12 15:47:19 +02:00
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-04-12 15:47:19 +02:00
void PipelineLayout::addPushConstants(const SePushConstantRange &pushConstant)
{
pushConstants.add(pushConstant);
}
2020-04-01 02:17:49 +02:00
2020-04-12 15:47:19 +02:00
UniformBuffer::UniformBuffer()
{
}
UniformBuffer::~UniformBuffer()
{
}
2020-04-01 02:17:49 +02:00
RenderTargetLayout::RenderTargetLayout()
2020-04-12 15:47:19 +02:00
: inputAttachments(), colorAttachments(), depthAttachment()
2020-04-01 02:17:49 +02:00
{
}
2020-04-12 15:47:19 +02:00
RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment depthAttachment)
: inputAttachments(), colorAttachments(), depthAttachment(depthAttachment)
2020-04-01 02:17:49 +02:00
{
}
2020-04-12 15:47:19 +02:00
RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment colorAttachment, PRenderTargetAttachment depthAttachment)
: inputAttachments(), depthAttachment(depthAttachment)
2020-04-01 02:17:49 +02:00
{
colorAttachments.add(colorAttachment);
}
2020-04-12 15:47:19 +02:00
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachmet)
: inputAttachments(), colorAttachments(colorAttachments), depthAttachment(depthAttachment)
2020-04-01 02:17:49 +02:00
{
}
2020-04-12 15:47:19 +02:00
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> inputAttachments, Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachment)
: inputAttachments(inputAttachments), colorAttachments(colorAttachments), depthAttachment(depthAttachment)
2020-04-01 02:17:49 +02:00
{
}
2020-04-12 15:47:19 +02:00
Window::Window(const WindowCreateInfo &createInfo)
: sizeX(createInfo.width), sizeY(createInfo.height), bFullscreen(createInfo.bFullscreen), title(createInfo.title), pixelFormat(createInfo.pixelFormat)
{
}
Window::~Window()
{
}
Viewport::Viewport(PWindow owner, const ViewportCreateInfo &viewportInfo)
: sizeX(viewportInfo.sizeX), sizeY(viewportInfo.sizeY), offsetX(viewportInfo.offsetX), offsetY(viewportInfo.offsetY), owner(owner)
{
}
Viewport::~Viewport()
{
}