Skip to content
Snippets Groups Projects

Resolve "Cmd/Sync-Rework"

Merged Ghost User requested to merge 66-cmd-sync-rework into develop
4 files
+ 28
6
Compare changes
  • Side-by-side
  • Inline
Files
4
  • e1a19e9d
    [#66] Remove unnecessary width/height from mesh drawcall · e1a19e9d
    Alexander Gauggel authored
+ 46
39
@@ -22,13 +22,11 @@
#include "Sampler.hpp"
#include "DescriptorWrites.hpp"
#include "Event.hpp"
#include "DrawcallRecording.hpp"
#include "CommandRecordingFunctionTypes.hpp"
namespace vkcv
{
struct VertexBufferBinding {
vk::DeviceSize offset;
BufferHandle buffer;
};
// forward declarations
class PassManager;
@@ -37,15 +35,13 @@ namespace vkcv
class BufferManager;
class SamplerManager;
class ImageManager;
class CommandStreamManager;
struct SubmitInfo {
QueueType queueType;
std::vector<vk::Semaphore> waitSemaphores;
std::vector<vk::Semaphore> signalSemaphores;
};
typedef typename event_function<const vk::CommandBuffer&>::type RecordCommandFunction;
typedef typename event_function<>::type FinishCommandFunction;
class Core final
{
@@ -65,27 +61,30 @@ namespace vkcv
Context m_Context;
SwapChain m_swapchain;
std::vector<vk::ImageView> m_swapchainImageViews;
const Window& m_window;
std::unique_ptr<PassManager> m_PassManager;
std::unique_ptr<PipelineManager> m_PipelineManager;
std::unique_ptr<DescriptorManager> m_DescriptorManager;
std::unique_ptr<BufferManager> m_BufferManager;
std::unique_ptr<SamplerManager> m_SamplerManager;
std::unique_ptr<ImageManager> m_ImageManager;
SwapChain m_swapchain;
std::vector<vk::ImageView> m_swapchainImageViews;
std::vector<vk::Image> m_swapchainImages;
std::vector<vk::ImageLayout> m_swapchainImageLayouts;
const Window& m_window;
CommandResources m_CommandResources;
SyncResources m_SyncResources;
uint32_t m_currentSwapchainImageIndex;
std::unique_ptr<PassManager> m_PassManager;
std::unique_ptr<PipelineManager> m_PipelineManager;
std::unique_ptr<DescriptorManager> m_DescriptorManager;
std::unique_ptr<BufferManager> m_BufferManager;
std::unique_ptr<SamplerManager> m_SamplerManager;
std::unique_ptr<ImageManager> m_ImageManager;
std::unique_ptr<CommandStreamManager> m_CommandStreamManager;
ImageHandle m_DepthImage;
CommandResources m_CommandResources;
SyncResources m_SyncResources;
uint32_t m_currentSwapchainImageIndex;
std::function<void(int, int)> e_resizeHandle;
static std::vector<vk::ImageView> createImageViews( Context &context, SwapChain& swapChain);
void recordSwapchainImageLayoutTransition(vk::CommandBuffer cmdBuffer, vk::ImageLayout newLayout);
public:
/**
* Destructor of #Core destroys the Vulkan objects contained in the core's context.
@@ -211,29 +210,23 @@ namespace vkcv
* @return
*/
[[nodiscard]]
ResourcesHandle createResourceDescription(const std::vector<DescriptorSetConfig> &descriptorSets);
void writeResourceDescription(ResourcesHandle handle, size_t setIndex, const DescriptorWrites& writes);
DescriptorSetHandle createDescriptorSet(const std::vector<DescriptorBinding> &bindings);
void writeResourceDescription(DescriptorSetHandle handle, size_t setIndex, const DescriptorWrites& writes);
vk::DescriptorSetLayout getDescriptorSetLayout(ResourcesHandle handle, size_t setIndex);
DescriptorSet getDescriptorSet(const DescriptorSetHandle handle) const;
/**
* @brief start recording command buffers and increment frame index
*/
void beginFrame();
bool beginFrame(uint32_t& width, uint32_t& height);
/**
* @brief render a beautiful triangle
*/
void renderMesh(
const PassHandle &renderpassHandle,
const PipelineHandle &pipelineHandle,
const size_t pushConstantSize,
const void* pushConstantData,
const std::vector<VertexBufferBinding> &vertexBufferBindings,
const BufferHandle &indexBuffer,
const size_t indexCount,
const vkcv::ResourcesHandle resourceHandle,
const size_t resourceDescriptorSetIndex);
void recordDrawcallsToCmdStream(
const CommandStreamHandle cmdStreamHandle,
const PassHandle renderpassHandle,
const PipelineHandle pipelineHandle,
const PushConstantData &pushConstantData,
const std::vector<DrawcallInfo> &drawcalls,
const std::vector<ImageHandle> &renderTargets);
/**
* @brief end recording and present image
@@ -251,6 +244,20 @@ namespace vkcv
* @param record Record-command-function
* @param finish Finish-command-function or nullptr
*/
void submitCommands(const SubmitInfo &submitInfo, const RecordCommandFunction& record, const FinishCommandFunction& finish);
void recordAndSubmitCommands(
const SubmitInfo &submitInfo,
const RecordCommandFunction &record,
const FinishCommandFunction &finish);
CommandStreamHandle createCommandStream(QueueType queueType);
void recordCommandsToStream(
const CommandStreamHandle cmdStreamHandle,
const RecordCommandFunction &record,
const FinishCommandFunction &finish);
void submitCommandStream(const CommandStreamHandle handle);
void prepareSwapchainImageForPresent(const CommandStreamHandle handle);
void prepareImageForSampling(const CommandStreamHandle cmdStream, const ImageHandle image);
};
}
Loading