Cleanups and checks.

This commit is contained in:
Anish Bhobe 2024-07-23 21:15:20 +02:00
parent 4dd8effd7b
commit cc67b17ae4
4 changed files with 36 additions and 3 deletions

View File

@ -79,6 +79,34 @@ Frame::~Frame()
DEBUG("Destoryed Frame"); DEBUG("Destoryed Frame");
} }
Frame::Frame(Frame &&other) noexcept
: m_Device(other.m_Device)
, m_Pool(Take(other.m_Pool))
, m_CommandBuffer(Take(other.m_CommandBuffer))
, m_FrameAvailableFence(Take(other.m_FrameAvailableFence))
, m_ImageAcquireSem(Take(other.m_ImageAcquireSem))
, m_RenderFinishSem(Take(other.m_RenderFinishSem))
, m_FrameIdx(other.m_FrameIdx)
, m_ImageIdx(other.m_ImageIdx)
{
}
Frame &
Frame::operator=(Frame &&other) noexcept
{
if (this == &other)
return *this;
m_Device = other.m_Device;
m_Pool = Take(other.m_Pool);
m_CommandBuffer = Take(other.m_CommandBuffer);
m_FrameAvailableFence = Take(other.m_FrameAvailableFence);
m_ImageAcquireSem = Take(other.m_ImageAcquireSem);
m_RenderFinishSem = Take(other.m_RenderFinishSem);
m_FrameIdx = other.m_FrameIdx;
m_ImageIdx = other.m_ImageIdx;
return *this;
}
// Frame Manager // Frame Manager
FrameManager::FrameManager(const Device *device, u32 queueFamilyIndex, u32 framesInFlight) FrameManager::FrameManager(const Device *device, u32 queueFamilyIndex, u32 framesInFlight)

View File

@ -32,6 +32,11 @@ struct Frame
Frame(const Device *device, u32 queueFamilyIndex, u32 frameCount); Frame(const Device *device, u32 queueFamilyIndex, u32 frameCount);
~Frame(); ~Frame();
Frame(Frame &&other) noexcept;
Frame &operator=(Frame &&other) noexcept;
DISALLOW_COPY_AND_ASSIGN(Frame);
}; };
struct FrameManager struct FrameManager

View File

@ -243,7 +243,6 @@ main(int, char **)
vertexStaging.Write(&device, 0, vertices.size() * sizeof vertices[0], vertices.data()); vertexStaging.Write(&device, 0, vertices.size() * sizeof vertices[0], vertices.data());
imageStaging.Init(&device, imageFile.GetSize(), "Image Staging"); imageStaging.Init(&device, imageFile.GetSize(), "Image Staging");
INFO("fine {}", imageFile.GetSize());
imageStaging.Write(&device, 0, imageFile.GetSize(), imageFile.m_Data); imageStaging.Write(&device, 0, imageFile.GetSize(), imageFile.m_Data);
vk::ImageMemoryBarrier imageReadyToWrite = { vk::ImageMemoryBarrier imageReadyToWrite = {
@ -668,7 +667,7 @@ CreatePipeline(const Device *device, const Swapchain *swapchain)
.viewMask = 0, .viewMask = 0,
.colorAttachmentCount = 1, .colorAttachmentCount = 1,
.pColorAttachmentFormats = &swapchain->m_Format, .pColorAttachmentFormats = &swapchain->m_Format,
.depthAttachmentFormat = vk::Format::eD32Sfloat, .depthAttachmentFormat = vk::Format::eD24UnormS8Uint,
}; };
vk::GraphicsPipelineCreateInfo pipelineCreateInfo = { vk::GraphicsPipelineCreateInfo pipelineCreateInfo = {

View File

@ -335,7 +335,8 @@ main(int, char **)
gui::Draw(cmd, currentAttachment); gui::Draw(cmd, currentAttachment);
cmd.pipelineBarrier(vk::PipelineStageFlagBits::eColorAttachmentOutput, vk::PipelineStageFlagBits::eAllCommands, cmd.pipelineBarrier(vk::PipelineStageFlagBits::eColorAttachmentOutput, vk::PipelineStageFlagBits::eAllCommands,
{}, 0, nullptr, 0, nullptr, postRenderBarriers.size(), postRenderBarriers.data()); {}, 0, nullptr, 0, nullptr, Cast<u32>(postRenderBarriers.size()),
postRenderBarriers.data());
vk::ImageBlit blitRegion = { vk::ImageBlit blitRegion = {
.srcSubresource = .srcSubresource =