Skip to content

File render_pass.hpp

File List > illixr > vk > render_pass.hpp

Go to the documentation of this file

#pragma once

#define GLFW_INCLUDE_VULKAN
#if defined(_WIN32) || defined(_WIN64)
#    include 
#endif
#include "illixr/data_format/misc.hpp"
#include "illixr/data_format/poses/head_pose.hpp"
#include "illixr/phonebook.hpp"
#include "vulkan_objects.hpp"

#ifdef USING_OPENXR
#    ifdef ENABLE_MONADO
#        define BUFFER_TYPE std::array
#    else
#        define BUFFER_TYPE std::array
#    endif
#else
#    define BUFFER_TYPE data_format::pose::fast_head_pose_type
#endif

#include 
#include 

// Forward declaration - full definition in illixr_framebuffer.h
struct illixr_framebuffer;

namespace ILLIXR::vulkan {

// render_pass defines the interface for a render pass. For now, it is only used for timewarp and
// app.
class render_pass : public phonebook::service {
public:
    virtual void record_command_buffer(VkCommandBuffer commandBuffer, VkFramebuffer framebuffer, int buffer_ind, bool left) = 0;

    virtual void update_uniforms(const BUFFER_TYPE& render_pose) {
        (void) render_pose;
    };

    virtual void destroy() { };

    virtual bool is_external() = 0;

    ~render_pass() override = default;

    VkPipeline pipeline_ = VK_NULL_HANDLE;
};

// timewarp defines the interface for a warping render pass as a service.
class timewarp : public render_pass {
public:
    virtual void setup(VkRenderPass render_pass, uint32_t subpass,
                       std::shared_ptr<vulkan::buffer_pool<BUFFER_TYPE>> buffer_pool, bool input_texture_vulkan_coordinates,
                       struct illixr_framebuffer* framebuffer_array = nullptr, VkExtent2D extent = {}) = 0;
};

// app defines the interface for an application render pass as a service.
class app : public render_pass {
public:
    virtual void setup(VkRenderPass render_pass, uint32_t subpass,
                       std::shared_ptr<buffer_pool<data_format::pose::fast_head_pose_type>> buffer_pool) = 0;
};
} // namespace ILLIXR::vulkan