fixed the private purview of modules not resolving interfaces when linked
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
parent
7d6ec52830
commit
e5467124e1
16 changed files with 200 additions and 129 deletions
|
|
@ -209,6 +209,7 @@ add_module(
|
||||||
INTERFACES
|
INTERFACES
|
||||||
system.cppm
|
system.cppm
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
memory
|
||||||
app
|
app
|
||||||
time
|
time
|
||||||
input
|
input
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ private:
|
||||||
#define lt_profile_end_session() ::lt::Instrumentor::end_session()
|
#define lt_profile_end_session() ::lt::Instrumentor::end_session()
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::debug;
|
namespace lt::debug {
|
||||||
|
|
||||||
void Instrumentor::begin_session_impl(const std::string &outputPath)
|
void Instrumentor::begin_session_impl(const std::string &outputPath)
|
||||||
{
|
{
|
||||||
|
|
@ -143,3 +143,4 @@ InstrumentorTimer::~InstrumentorTimer()
|
||||||
|
|
||||||
Instrumentor::submit_scope_profile(m_result);
|
Instrumentor::submit_scope_profile(m_result);
|
||||||
}
|
}
|
||||||
|
} // namespace lt::debug
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::input;
|
namespace lt::input {
|
||||||
|
|
||||||
template<class... Ts>
|
template<class... Ts>
|
||||||
struct overloads: Ts...
|
struct overloads: Ts...
|
||||||
|
|
@ -158,10 +158,8 @@ void System::on_key_press(const lt::surface::KeyPressedEvent &event)
|
||||||
{
|
{
|
||||||
if (event.get_key() > m_keys.size())
|
if (event.get_key() > m_keys.size())
|
||||||
{
|
{
|
||||||
log::debug(
|
log::debug("Key code larger than key container size, implement platform-dependant "
|
||||||
"Key code larger than key container size, implement platform-dependant "
|
"key-code-mapping!");
|
||||||
"key-code-mapping!"
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -173,10 +171,8 @@ void System::on_key_release(const lt::surface::KeyReleasedEvent &event)
|
||||||
{
|
{
|
||||||
if (event.get_key() > m_keys.size())
|
if (event.get_key() > m_keys.size())
|
||||||
{
|
{
|
||||||
log::debug(
|
log::debug("Key code larger than key container size, implement platform-dependant "
|
||||||
"Key code larger than key container size, implement platform-dependant "
|
"key-code-mapping!");
|
||||||
"key-code-mapping!"
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -198,3 +194,5 @@ void System::on_button_release(const lt::surface::ButtonReleasedEvent &event)
|
||||||
{
|
{
|
||||||
m_buttons[event.get_button()] = false;
|
m_buttons[event.get_button()] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::input
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,7 @@ export namespace lt::renderer {
|
||||||
} // namespace lt::renderer
|
} // namespace lt::renderer
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt;
|
namespace lt::renderer {
|
||||||
using namespace lt::renderer;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_instance(Api target_api) -> IInstance *
|
[[nodiscard]] auto get_instance(Api target_api) -> IInstance *
|
||||||
{
|
{
|
||||||
|
|
@ -239,3 +238,5 @@ using namespace lt::renderer;
|
||||||
|
|
||||||
std::unreachable();
|
std::unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::renderer
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ private:
|
||||||
} // namespace lt::renderer
|
} // namespace lt::renderer
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::renderer;
|
namespace lt::renderer {
|
||||||
|
|
||||||
System::System(CreateInfo info)
|
System::System(CreateInfo info)
|
||||||
: m_surface_entity(info.surface_entity)
|
: m_surface_entity(info.surface_entity)
|
||||||
|
|
@ -225,3 +225,5 @@ void System::recreate_swapchain()
|
||||||
m_swapchain = create_swapchain(m_api, m_surface.get(), m_gpu.get(), m_device.get());
|
m_swapchain = create_swapchain(m_api, m_surface.get(), m_gpu.get(), m_device.get());
|
||||||
m_renderer->replace_swapchain(m_swapchain.get());
|
m_renderer->replace_swapchain(m_swapchain.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::renderer
|
||||||
|
|
|
||||||
|
|
@ -732,7 +732,10 @@ public:
|
||||||
|
|
||||||
auto operator=(const Instance &) = delete;
|
auto operator=(const Instance &) = delete;
|
||||||
|
|
||||||
~Instance();
|
~Instance()
|
||||||
|
{
|
||||||
|
// WIP;
|
||||||
|
}
|
||||||
|
|
||||||
void load_functions();
|
void load_functions();
|
||||||
|
|
||||||
|
|
@ -1117,7 +1120,10 @@ public:
|
||||||
|
|
||||||
auto operator=(const Gpu &) -> Gpu & = default;
|
auto operator=(const Gpu &) -> Gpu & = default;
|
||||||
|
|
||||||
~Gpu();
|
~Gpu()
|
||||||
|
{
|
||||||
|
// WIP;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_features() const -> Features;
|
[[nodiscard]] auto get_features() const -> Features;
|
||||||
|
|
||||||
|
|
@ -1693,7 +1699,10 @@ public:
|
||||||
|
|
||||||
auto operator=(const ImageView &) -> ImageView & = delete;
|
auto operator=(const ImageView &) -> ImageView & = delete;
|
||||||
|
|
||||||
~ImageView();
|
~ImageView()
|
||||||
|
{
|
||||||
|
// WIP;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] auto get_vk_handle() -> VkImageView
|
[[nodiscard]] auto get_vk_handle() -> VkImageView
|
||||||
|
|
@ -1718,9 +1727,15 @@ public:
|
||||||
|
|
||||||
ShaderModule() = default;
|
ShaderModule() = default;
|
||||||
|
|
||||||
ShaderModule(Device &device, CreateInfo info);
|
ShaderModule(Device &device, CreateInfo info)
|
||||||
|
{
|
||||||
|
// WIP
|
||||||
|
}
|
||||||
|
|
||||||
~ShaderModule();
|
~ShaderModule()
|
||||||
|
{
|
||||||
|
// WIP
|
||||||
|
}
|
||||||
|
|
||||||
ShaderModule(ShaderModule &&) = default;
|
ShaderModule(ShaderModule &&) = default;
|
||||||
|
|
||||||
|
|
@ -1820,7 +1835,10 @@ public:
|
||||||
|
|
||||||
DescriptorSetLayout() = default;
|
DescriptorSetLayout() = default;
|
||||||
|
|
||||||
DescriptorSetLayout(Device &device, CreateInfo info);
|
DescriptorSetLayout(Device &device, CreateInfo info)
|
||||||
|
{
|
||||||
|
// WIP
|
||||||
|
}
|
||||||
|
|
||||||
DescriptorSetLayout(DescriptorSetLayout &&) = default;
|
DescriptorSetLayout(DescriptorSetLayout &&) = default;
|
||||||
|
|
||||||
|
|
@ -1830,8 +1848,10 @@ public:
|
||||||
|
|
||||||
auto operator=(const DescriptorSetLayout &) -> DescriptorSetLayout & = delete;
|
auto operator=(const DescriptorSetLayout &) -> DescriptorSetLayout & = delete;
|
||||||
|
|
||||||
~DescriptorSetLayout();
|
~DescriptorSetLayout()
|
||||||
|
{
|
||||||
|
// WIP
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
memory::NullOnMove<VkDevice> m_device;
|
memory::NullOnMove<VkDevice> m_device;
|
||||||
|
|
@ -1992,7 +2012,10 @@ public:
|
||||||
|
|
||||||
PipelineLayout() = default;
|
PipelineLayout() = default;
|
||||||
|
|
||||||
PipelineLayout(Device &device, CreateInfo info);
|
PipelineLayout(Device &device, CreateInfo info)
|
||||||
|
{
|
||||||
|
// WIP
|
||||||
|
}
|
||||||
|
|
||||||
PipelineLayout(PipelineLayout &&) = default;
|
PipelineLayout(PipelineLayout &&) = default;
|
||||||
|
|
||||||
|
|
@ -2002,7 +2025,10 @@ public:
|
||||||
|
|
||||||
auto operator=(const PipelineLayout &) -> PipelineLayout & = delete;
|
auto operator=(const PipelineLayout &) -> PipelineLayout & = delete;
|
||||||
|
|
||||||
~PipelineLayout();
|
~PipelineLayout()
|
||||||
|
{
|
||||||
|
// WIP
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] auto get_vk_handle() -> VkPipelineLayout
|
[[nodiscard]] auto get_vk_handle() -> VkPipelineLayout
|
||||||
|
|
@ -2167,23 +2193,51 @@ public:
|
||||||
std::uint32_t first_instance;
|
std::uint32_t first_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
void begin(BeginInfo info = {});
|
CommandBuffer() = default; // WIP
|
||||||
|
|
||||||
void end();
|
CommandBuffer(CommandBuffer &&) = default;
|
||||||
|
|
||||||
void copy(BufferCopyInfo info);
|
CommandBuffer(const CommandBuffer &) = delete;
|
||||||
|
|
||||||
void push_constants(PushConstantsInfo info);
|
auto operator=(CommandBuffer &&) -> CommandBuffer & = default;
|
||||||
|
|
||||||
void image_barrier(ImageBarrierInfo info);
|
auto operator=(const CommandBuffer &) -> CommandBuffer & = delete;
|
||||||
|
|
||||||
void begin_rendering(RenderingInfo info);
|
void begin(BeginInfo info = {})
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void end_rendering();
|
void end()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void bind_pipeline(Pipeline &pipeline, Pipeline::BindPoint bind_point);
|
void copy(BufferCopyInfo info)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void draw(DrawInfo info);
|
void push_constants(PushConstantsInfo info)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void image_barrier(ImageBarrierInfo info)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void begin_rendering(RenderingInfo info)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void end_rendering()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind_pipeline(Pipeline &pipeline, Pipeline::BindPoint bind_point)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw(DrawInfo info)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] auto get_vk_handle() -> VkCommandBuffer
|
[[nodiscard]] auto get_vk_handle() -> VkCommandBuffer
|
||||||
|
|
@ -2222,9 +2276,15 @@ public:
|
||||||
|
|
||||||
CommandPool() = default;
|
CommandPool() = default;
|
||||||
|
|
||||||
CommandPool(Device &device, CreateInfo info);
|
CommandPool(Device &device, CreateInfo info)
|
||||||
|
{
|
||||||
|
// WIP
|
||||||
|
}
|
||||||
|
|
||||||
~CommandPool();
|
~CommandPool()
|
||||||
|
{
|
||||||
|
// WIP
|
||||||
|
}
|
||||||
|
|
||||||
CommandPool(CommandPool &&) = default;
|
CommandPool(CommandPool &&) = default;
|
||||||
|
|
||||||
|
|
@ -2234,7 +2294,11 @@ public:
|
||||||
|
|
||||||
auto operator=(const CommandPool &) -> CommandPool & = delete;
|
auto operator=(const CommandPool &) -> CommandPool & = delete;
|
||||||
|
|
||||||
[[nodiscard]] auto allocate(uint32_t count, BufferLevel level) -> std::vector<CommandBuffer>;
|
[[nodiscard]] auto allocate(uint32_t count, BufferLevel level) -> std::vector<CommandBuffer>
|
||||||
|
{
|
||||||
|
// WIP
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VkDevice m_device {};
|
VkDevice m_device {};
|
||||||
|
|
@ -2487,14 +2551,17 @@ private:
|
||||||
/** ================================ **/
|
/** ================================ **/
|
||||||
/** Private Template Implementations **/
|
/** Private Template Implementations **/
|
||||||
/** ================================ **/
|
/** ================================ **/
|
||||||
using namespace lt::renderer::vk;
|
namespace lt::renderer::vk {
|
||||||
|
|
||||||
|
// This is the only api function that needs to be inside the "header" part of the module,
|
||||||
|
// since it's used in a template that does std::format magic.
|
||||||
|
//
|
||||||
|
// ...And the template implementation needs to be visible by the compiler on the calling site to
|
||||||
|
// generate the templated code
|
||||||
namespace api {
|
namespace api {
|
||||||
PFN_vkSetDebugUtilsObjectNameEXT set_debug_object_name {}; // NOLINT
|
PFN_vkSetDebugUtilsObjectNameEXT set_debug_object_name {}; // NOLINT
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace lt::renderer::vk {
|
|
||||||
|
|
||||||
void vkc(VkResult result)
|
void vkc(VkResult result)
|
||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
|
|
@ -2534,8 +2601,9 @@ void Device::name(T &object, const char *name)
|
||||||
|
|
||||||
} // namespace lt::renderer::vk
|
} // namespace lt::renderer::vk
|
||||||
|
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::renderer::vk;
|
namespace lt::renderer::vk {
|
||||||
|
|
||||||
namespace api {
|
namespace api {
|
||||||
// global functions
|
// global functions
|
||||||
|
|
@ -4286,3 +4354,5 @@ auto enumerate_instance_extension_properties() -> std::vector<VkExtensionPropert
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
// );
|
// );
|
||||||
|
|
||||||
|
} // namespace lt::renderer::vk
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,7 @@ private:
|
||||||
} // namespace lt::renderer::vkb
|
} // namespace lt::renderer::vkb
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::renderer;
|
namespace lt::renderer::vkb {
|
||||||
using namespace lt::renderer::vkb;
|
|
||||||
|
|
||||||
[[nodiscard]] auto to_native_severity(IDebugger::MessageSeverity severity) -> vk::Flags
|
[[nodiscard]] auto to_native_severity(IDebugger::MessageSeverity severity) -> vk::Flags
|
||||||
{
|
{
|
||||||
|
|
@ -190,3 +189,5 @@ Debugger::Debugger(IInstance *instance, CreateInfo info)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::renderer::vkb
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import renderer.vk.gpu;
|
||||||
import renderer.vk.surface;
|
import renderer.vk.surface;
|
||||||
import std;
|
import std;
|
||||||
|
|
||||||
|
|
||||||
namespace lt::renderer::vkb {
|
namespace lt::renderer::vkb {
|
||||||
|
|
||||||
export class Device: public IDevice
|
export class Device: public IDevice
|
||||||
|
|
@ -65,9 +64,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::renderer;
|
namespace lt::renderer::vkb {
|
||||||
using namespace lt::renderer::vkb;
|
|
||||||
|
|
||||||
|
|
||||||
Device::Device(IGpu *gpu, ISurface *surface)
|
Device::Device(IGpu *gpu, ISurface *surface)
|
||||||
: m_gpu(static_cast<Gpu *>(gpu))
|
: m_gpu(static_cast<Gpu *>(gpu))
|
||||||
|
|
@ -153,3 +150,5 @@ void Device::initialize_queue_indices()
|
||||||
"Failed to find presentation queue family"
|
"Failed to find presentation queue family"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::renderer::vkb
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::renderer::vkb;
|
namespace lt::renderer::vkb {
|
||||||
|
|
||||||
Gpu::Gpu(IInstance *instance)
|
Gpu::Gpu(IInstance *instance)
|
||||||
{
|
{
|
||||||
|
|
@ -129,3 +129,5 @@ Gpu::Gpu(IInstance *instance)
|
||||||
// vkc(vk_create_device(m_gpu, &info, nullptr, &device));
|
// vkc(vk_create_device(m_gpu, &info, nullptr, &device));
|
||||||
// return device;
|
// return device;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
} // namespace lt::renderer::vkb
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ private:
|
||||||
} // namespace lt::renderer::vkb
|
} // namespace lt::renderer::vkb
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::renderer::vkb;
|
namespace lt::renderer::vkb {
|
||||||
|
|
||||||
Instance::Instance()
|
Instance::Instance()
|
||||||
{
|
{
|
||||||
|
|
@ -146,3 +146,5 @@ Instance::Instance()
|
||||||
// {
|
// {
|
||||||
// vk_destroy_debug_messenger(m_instance, messenger, m_allocator);
|
// vk_destroy_debug_messenger(m_instance, messenger, m_allocator);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
} // namespace lt::renderer::vkb
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ private:
|
||||||
|
|
||||||
std::uint32_t m_max_frames_in_flight {};
|
std::uint32_t m_max_frames_in_flight {};
|
||||||
|
|
||||||
Device * m_device {};
|
Device *m_device {};
|
||||||
|
|
||||||
Swapchain *m_swapchain {};
|
Swapchain *m_swapchain {};
|
||||||
|
|
||||||
|
|
@ -85,8 +85,7 @@ private:
|
||||||
} // namespace lt::renderer::vkb
|
} // namespace lt::renderer::vkb
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::renderer;
|
namespace lt::renderer::vkb {
|
||||||
using namespace lt::renderer::vkb;
|
|
||||||
|
|
||||||
Renderer::Renderer(
|
Renderer::Renderer(
|
||||||
IGpu *gpu,
|
IGpu *gpu,
|
||||||
|
|
@ -117,13 +116,11 @@ Renderer::Renderer(
|
||||||
.debug_name = "staging buffer",
|
.debug_name = "staging buffer",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
, m_pass(
|
, m_pass(memory::create_ref<Pass>(
|
||||||
memory::create_ref<Pass>(
|
m_device,
|
||||||
m_device,
|
assets::ShaderAsset { "./data/test_assets/sprite.vert.asset" },
|
||||||
assets::ShaderAsset { "./data/test_assets/sprite.vert.asset" },
|
assets::ShaderAsset { "./data/test_assets/triangle.frag.asset" }
|
||||||
assets::ShaderAsset { "./data/test_assets/triangle.frag.asset" }
|
))
|
||||||
)
|
|
||||||
)
|
|
||||||
, m_pool(
|
, m_pool(
|
||||||
m_device->vk(),
|
m_device->vk(),
|
||||||
{
|
{
|
||||||
|
|
@ -170,23 +167,19 @@ Renderer::Renderer(
|
||||||
record_cmd(cmd, image_idx);
|
record_cmd(cmd, image_idx);
|
||||||
|
|
||||||
auto &submit_semaphore = m_submit_semaphores[image_idx];
|
auto &submit_semaphore = m_submit_semaphores[image_idx];
|
||||||
m_device->graphics_queue().submit(
|
m_device->graphics_queue().submit(vk::Queue::SubmitInfo {
|
||||||
vk::Queue::SubmitInfo {
|
.command_buffer = &cmd,
|
||||||
.command_buffer = &cmd,
|
.wait_stages = vk::PipelineStageFlags::color_attachment_output_bit,
|
||||||
.wait_stages = vk::PipelineStageFlags::color_attachment_output_bit,
|
.wait_semaphore = &acquire_semaphore,
|
||||||
.wait_semaphore = &acquire_semaphore,
|
.signal_semaphore = &submit_semaphore,
|
||||||
.signal_semaphore = &submit_semaphore,
|
.signal_fence = &frame_fence,
|
||||||
.signal_fence = &frame_fence,
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
m_device->present_queue().present(
|
m_device->present_queue().present(vk::Queue::PresentInfo {
|
||||||
vk::Queue::PresentInfo {
|
.wait_semaphore = &submit_semaphore,
|
||||||
.wait_semaphore = &submit_semaphore,
|
.swapchain = &m_swapchain->vk(),
|
||||||
.swapchain = &m_swapchain->vk(),
|
.image_idx = image_idx,
|
||||||
.image_idx = image_idx,
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return Result::success;
|
return Result::success;
|
||||||
}
|
}
|
||||||
|
|
@ -321,38 +314,32 @@ void Renderer::record_cmd(vk::CommandBuffer &cmd, std::uint32_t image_idx)
|
||||||
cmd.begin({});
|
cmd.begin({});
|
||||||
|
|
||||||
m_staging_buffer.unmap();
|
m_staging_buffer.unmap();
|
||||||
cmd.copy(
|
cmd.copy({
|
||||||
{
|
.src_buffer = &m_staging_buffer.vk(),
|
||||||
.src_buffer = &m_staging_buffer.vk(),
|
.dst_buffer = &m_vertex_buffer.vk(),
|
||||||
.dst_buffer = &m_vertex_buffer.vk(),
|
.src_offset = m_staging_offset,
|
||||||
.src_offset = m_staging_offset,
|
.dst_offset = m_staging_offset,
|
||||||
.dst_offset = m_staging_offset,
|
.size = m_current_sprite_idx * sizeof(components::Sprite::Vertex),
|
||||||
.size = m_current_sprite_idx * sizeof(components::Sprite::Vertex),
|
});
|
||||||
}
|
cmd.push_constants({
|
||||||
);
|
.layout = &m_pass->get_layout(),
|
||||||
cmd.push_constants(
|
.shader_stages = vk::ShaderStageFlags::vertex_bit,
|
||||||
{
|
.offset = 0u,
|
||||||
.layout = &m_pass->get_layout(),
|
.size = sizeof(FrameConstants),
|
||||||
.shader_stages = vk::ShaderStageFlags::vertex_bit,
|
.data = &m_frame_constants,
|
||||||
.offset = 0u,
|
});
|
||||||
.size = sizeof(FrameConstants),
|
|
||||||
.data = &m_frame_constants,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
using AccessFlagBits = vk::CommandBuffer::ImageBarrierInfo::AccessFlagBits;
|
using AccessFlagBits = vk::CommandBuffer::ImageBarrierInfo::AccessFlagBits;
|
||||||
cmd.image_barrier(
|
cmd.image_barrier({
|
||||||
{
|
.image = &m_swapchain->get_image(image_idx),
|
||||||
.image = &m_swapchain->get_image(image_idx),
|
.range = vk::Image::full_color_range,
|
||||||
.range = vk::Image::full_color_range,
|
.src_stages = vk::PipelineStageFlags::color_attachment_output_bit,
|
||||||
.src_stages = vk::PipelineStageFlags::color_attachment_output_bit,
|
.dst_stages = vk::PipelineStageFlags::color_attachment_output_bit,
|
||||||
.dst_stages = vk::PipelineStageFlags::color_attachment_output_bit,
|
.src_accesses = AccessFlagBits::none,
|
||||||
.src_accesses = AccessFlagBits::none,
|
.dst_accesses = AccessFlagBits::color_attachment_write,
|
||||||
.dst_accesses = AccessFlagBits::color_attachment_write,
|
.src_layout = vk::Image::Layout::undefined,
|
||||||
.src_layout = vk::Image::Layout::undefined,
|
.dst_layout = vk::Image::Layout::color_attachment_optimal,
|
||||||
.dst_layout = vk::Image::Layout::color_attachment_optimal,
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
using Attachment = vk::CommandBuffer::RenderingInfo::AttachmentInfo;
|
using Attachment = vk::CommandBuffer::RenderingInfo::AttachmentInfo;
|
||||||
cmd.begin_rendering(
|
cmd.begin_rendering(
|
||||||
|
|
@ -373,29 +360,25 @@ void Renderer::record_cmd(vk::CommandBuffer &cmd, std::uint32_t image_idx)
|
||||||
cmd.bind_pipeline(m_pass->get_pipeline(), vk::Pipeline::BindPoint::graphics);
|
cmd.bind_pipeline(m_pass->get_pipeline(), vk::Pipeline::BindPoint::graphics);
|
||||||
// cmd.set_viewport();
|
// cmd.set_viewport();
|
||||||
// cmd.set_scissors();
|
// cmd.set_scissors();
|
||||||
cmd.draw(
|
cmd.draw({
|
||||||
{
|
.vertex_count = static_cast<std::uint32_t>(m_current_sprite_idx),
|
||||||
.vertex_count = static_cast<std::uint32_t>(m_current_sprite_idx),
|
.instance_count = 1u,
|
||||||
.instance_count = 1u,
|
.first_vertex = 0u,
|
||||||
.first_vertex = 0u,
|
.first_instance = 0u,
|
||||||
.first_instance = 0u,
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
cmd.end_rendering();
|
cmd.end_rendering();
|
||||||
cmd.image_barrier(
|
cmd.image_barrier({
|
||||||
{
|
.image = &m_swapchain->get_image(image_idx),
|
||||||
.image = &m_swapchain->get_image(image_idx),
|
.src_stages = vk::PipelineStageFlags::color_attachment_output_bit,
|
||||||
.src_stages = vk::PipelineStageFlags::color_attachment_output_bit,
|
.dst_stages = vk::PipelineStageFlags::bottom_of_pipe_bit,
|
||||||
.dst_stages = vk::PipelineStageFlags::bottom_of_pipe_bit,
|
.src_accesses = AccessFlagBits::color_attachment_read
|
||||||
.src_accesses = AccessFlagBits::color_attachment_read
|
| AccessFlagBits::color_attachment_write,
|
||||||
| AccessFlagBits::color_attachment_write,
|
.dst_accesses = {},
|
||||||
.dst_accesses = {},
|
.src_layout = vk::Image::Layout::color_attachment_optimal,
|
||||||
.src_layout = vk::Image::Layout::color_attachment_optimal,
|
.dst_layout = vk::Image::Layout::present_src,
|
||||||
.dst_layout = vk::Image::Layout::present_src,
|
|
||||||
|
|
||||||
}
|
});
|
||||||
);
|
|
||||||
cmd.end();
|
cmd.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -439,3 +422,5 @@ void Renderer::submit_sprite(
|
||||||
.color = sprite.color,
|
.color = sprite.color,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::renderer::vkb
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ private:
|
||||||
} // namespace lt::renderer::vkb
|
} // namespace lt::renderer::vkb
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::renderer::vkb;
|
namespace lt::renderer::vkb {
|
||||||
|
|
||||||
Surface::Surface(IInstance *instance, const ecs::Entity &surface_entity)
|
Surface::Surface(IInstance *instance, const ecs::Entity &surface_entity)
|
||||||
: m_surface_entity(surface_entity)
|
: m_surface_entity(surface_entity)
|
||||||
|
|
@ -81,3 +81,5 @@ Surface::Surface(IInstance *instance, const ecs::Entity &surface_entity)
|
||||||
{
|
{
|
||||||
return m_surface_entity.get<surface::SurfaceComponent>().get_resolution();
|
return m_surface_entity.get<surface::SurfaceComponent>().get_resolution();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::renderer::vkb
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::renderer;
|
namespace lt::renderer::vkb {
|
||||||
using namespace lt::renderer::vkb;
|
|
||||||
|
|
||||||
Swapchain::Swapchain(ISurface *surface, IGpu *gpu, IDevice *device)
|
Swapchain::Swapchain(ISurface *surface, IGpu *gpu, IDevice *device)
|
||||||
: m_surface(static_cast<Surface *>(surface))
|
: m_surface(static_cast<Surface *>(surface))
|
||||||
|
|
@ -168,3 +167,5 @@ Swapchain::Swapchain(ISurface *surface, IGpu *gpu, IDevice *device)
|
||||||
// Fall-back to min_image_count
|
// Fall-back to min_image_count
|
||||||
return min_image_count;
|
return min_image_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::renderer::vkb
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ private:
|
||||||
// -------* IMPLEMENTATION *------- //
|
// -------* IMPLEMENTATION *------- //
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::test;
|
namespace lt::test {
|
||||||
|
|
||||||
/* static */ void Registry::register_suite(SuiteFunction suite)
|
/* static */ void Registry::register_suite(SuiteFunction suite)
|
||||||
{
|
{
|
||||||
|
|
@ -309,3 +309,5 @@ Registry::Registry()
|
||||||
static auto registry = Registry {};
|
static auto registry = Registry {};
|
||||||
return registry;
|
return registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::test
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,10 @@ auto operator""_suite(const char *name, std::size_t size) -> TestSuite
|
||||||
// -------* IMPLEMENTATION *------- //
|
// -------* IMPLEMENTATION *------- //
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::test;
|
namespace lt::test {
|
||||||
|
|
||||||
TestCase::TestCase(std::string_view name): m_name(name)
|
TestCase::TestCase(std::string_view name): m_name(name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::test
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ private:
|
||||||
} // namespace lt::time
|
} // namespace lt::time
|
||||||
|
|
||||||
module :private;
|
module :private;
|
||||||
using namespace lt::time;
|
namespace lt::time {
|
||||||
|
|
||||||
Timer::Timer(Timepoint start): m_start(start)
|
Timer::Timer(Timepoint start): m_start(start)
|
||||||
{
|
{
|
||||||
|
|
@ -41,3 +41,5 @@ void Timer::reset(Timepoint start)
|
||||||
{
|
{
|
||||||
return { std::chrono::steady_clock::now() - m_start };
|
return { std::chrono::steady_clock::now() - m_start };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace lt::time
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue