9 Commits

Author SHA1 Message Date
Kbz-8
e7bc48eb70 bumping mlx version 2025-10-22 13:38:53 +02:00
kbz_8
cfb9affde5 fixing render finished semaphore based on max frame in flight issue (#155) 2025-10-22 13:37:25 +02:00
Kbz-8
db236fd2b5 fixing render finished semaphore based on max frame in flight issue 2025-10-22 13:30:55 +02:00
kbz_8
3b133e08b6 Indev (#154)
adding unit test CI
fixing windows build
fixing issue with descriptor pools when over 1024 images rendered
2025-10-22 12:25:32 +02:00
kbz_8
3244bd3b30 Merge branch 'master' into indev 2025-10-22 12:19:25 +02:00
Kbz-8
e5826b8a78 fixing descriptor pools issue, adding unit tests shortcut to makefile 2025-10-22 12:09:28 +02:00
kbz_8
c7c60c240a Bump actions/first-interaction from 1 to 2 (#146)
Bumps
[actions/first-interaction](https://github.com/actions/first-interaction)
from 1 to 2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/actions/first-interaction/releases">actions/first-interaction's
releases</a>.</em></p>
<blockquote>
<h2>v2.0.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Installed <code>@​actions/core</code> by <a
href="https://github.com/TheGuptaEmpire"><code>@​TheGuptaEmpire</code></a>
in <a
href="https://redirect.github.com/actions/first-interaction/pull/274">actions/first-interaction#274</a></li>
<li>Update README.md by <a
href="https://github.com/Alirezaaraby"><code>@​Alirezaaraby</code></a>
in <a
href="https://redirect.github.com/actions/first-interaction/pull/75">actions/first-interaction#75</a></li>
<li>DOC: adjust the example to show a full yaml file by <a
href="https://github.com/tacaswell"><code>@​tacaswell</code></a> in <a
href="https://redirect.github.com/actions/first-interaction/pull/36">actions/first-interaction#36</a></li>
<li>Demonstrate |- multiline YAML string in README by <a
href="https://github.com/simonw"><code>@​simonw</code></a> in <a
href="https://redirect.github.com/actions/first-interaction/pull/16">actions/first-interaction#16</a></li>
<li>Update README.md by <a
href="https://github.com/nebuk89"><code>@​nebuk89</code></a> in <a
href="https://redirect.github.com/actions/first-interaction/pull/317">actions/first-interaction#317</a></li>
<li>Convert from Container to TypeScript Action by <a
href="https://github.com/ncalteen"><code>@​ncalteen</code></a> in <a
href="https://redirect.github.com/actions/first-interaction/pull/311">actions/first-interaction#311</a></li>
<li>Bump <code>@​octokit/types</code> from 13.8.0 to 14.1.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/first-interaction/pull/323">actions/first-interaction#323</a></li>
<li>Bump undici from 5.28.5 to 5.29.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/first-interaction/pull/319">actions/first-interaction#319</a></li>
<li>Bump the npm-development group with 16 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/first-interaction/pull/320">actions/first-interaction#320</a></li>
<li>Bump <code>@​actions/github</code> from 6.0.0 to 6.0.1 in the
npm-production group by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/first-interaction/pull/321">actions/first-interaction#321</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/TheGuptaEmpire"><code>@​TheGuptaEmpire</code></a>
made their first contribution in <a
href="https://redirect.github.com/actions/first-interaction/pull/274">actions/first-interaction#274</a></li>
<li><a
href="https://github.com/Alirezaaraby"><code>@​Alirezaaraby</code></a>
made their first contribution in <a
href="https://redirect.github.com/actions/first-interaction/pull/75">actions/first-interaction#75</a></li>
<li><a href="https://github.com/tacaswell"><code>@​tacaswell</code></a>
made their first contribution in <a
href="https://redirect.github.com/actions/first-interaction/pull/36">actions/first-interaction#36</a></li>
<li><a href="https://github.com/simonw"><code>@​simonw</code></a> made
their first contribution in <a
href="https://redirect.github.com/actions/first-interaction/pull/16">actions/first-interaction#16</a></li>
<li><a href="https://github.com/nebuk89"><code>@​nebuk89</code></a> made
their first contribution in <a
href="https://redirect.github.com/actions/first-interaction/pull/317">actions/first-interaction#317</a></li>
<li><a href="https://github.com/ncalteen"><code>@​ncalteen</code></a>
made their first contribution in <a
href="https://redirect.github.com/actions/first-interaction/pull/311">actions/first-interaction#311</a></li>
<li><a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
made their first contribution in <a
href="https://redirect.github.com/actions/first-interaction/pull/323">actions/first-interaction#323</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/first-interaction/compare/v1.3.0...v2.0.0">https://github.com/actions/first-interaction/compare/v1.3.0...v2.0.0</a></p>
<h2>v1.3.0</h2>
<h1>Upgrade our base image from node v14 -&gt; v20</h1>
<p>Add dependency on <code>@octokit/rest</code> and
<code>@actions/http-client</code>.</p>
<p>👉 See the PR for details: <a
href="https://redirect.github.com/actions/first-interaction/pull/287">actions/first-interaction#287</a></p>
<h2>v1.2.0</h2>
<h1>Upgrade our codeql actions from v1 -&gt; v2</h1>
<p>Updates <code>github/codeql-action/init</code>,
<code>github/codeql-action/autobuild</code>, and
<code>github/codeql-action/analyze</code> to <code>v2</code>.</p>
<p>👉 See the PR for details: <a
href="https://redirect.github.com/actions/first-interaction/pull/275">actions/first-interaction#275</a></p>
<h2>v1.1.1</h2>
<p>Update bundled <code>@actions/toolkit</code> packages to fix <a
href="https://redirect.github.com/actions/first-interaction/issues/101">actions/first-interaction#101</a></p>
<h2>v1.1.0</h2>
<p>No release notes provided.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="2d4393e6bc"><code>2d4393e</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/first-interaction/issues/321">#321</a>
from actions/dependabot/npm_and_yarn/npm-production-b...</li>
<li><a
href="4dbde70384"><code>4dbde70</code></a>
Rebuild dist</li>
<li><a
href="329f5ebce9"><code>329f5eb</code></a>
Bump <code>@​actions/github</code> from 6.0.0 to 6.0.1 in the
npm-production group</li>
<li><a
href="a7b6951cb1"><code>a7b6951</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/first-interaction/issues/320">#320</a>
from actions/dependabot/npm_and_yarn/npm-development-...</li>
<li><a
href="15ecaf52fe"><code>15ecaf5</code></a>
Rebuild dist</li>
<li><a
href="12e4e8b26d"><code>12e4e8b</code></a>
Bump the npm-development group with 16 updates</li>
<li><a
href="cf67d10ea1"><code>cf67d10</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/first-interaction/issues/319">#319</a>
from actions/dependabot/npm_and_yarn/undici-5.29.0</li>
<li><a
href="b2d4b15c5a"><code>b2d4b15</code></a>
Licensed cache</li>
<li><a
href="27d1ab5737"><code>27d1ab5</code></a>
Rebuild</li>
<li><a
href="6418932147"><code>6418932</code></a>
Bump undici from 5.28.5 to 5.29.0</li>
<li>Additional commits viewable in <a
href="https://github.com/actions/first-interaction/compare/v1...v2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/first-interaction&package-manager=github_actions&previous-version=1&new-version=2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
2025-07-28 13:01:36 +02:00
dependabot[bot]
2ce5fdeb66 Bump actions/first-interaction from 1 to 2
Bumps [actions/first-interaction](https://github.com/actions/first-interaction) from 1 to 2.
- [Release notes](https://github.com/actions/first-interaction/releases)
- [Commits](https://github.com/actions/first-interaction/compare/v1...v2)

---
updated-dependencies:
- dependency-name: actions/first-interaction
  dependency-version: '2'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-22 00:41:08 +00:00
kbz_8
4ea92d825a Indev (#142) 2025-06-23 20:46:06 +02:00
7 changed files with 52 additions and 31 deletions

View File

@@ -9,7 +9,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
- uses: actions/first-interaction@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: |

View File

@@ -38,6 +38,9 @@ GCH = runtime/Includes/PreCompiled.h.gch
CCH = runtime/Includes/PreCompiled.h.pch
PCH =
# Personal path, should be overriden with env var
UNIT_TESTS_PATH = ../UnitTester/build/Bin/linux_x86_64/MacroUnitTest
NZSLC ?= nzslc
ifeq ($(TOOLCHAIN), gcc)
@@ -161,6 +164,9 @@ clean-shaders:
shaders: clean-shaders $(SPVS)
tests: debug
@$(UNIT_TESTS_PATH) --headless --path="./$(NAME)"
clean:
@$(RM) $(OBJ_DIR)
@printf "Cleaned $(_BOLD)$(OBJ_DIR)$(_RESET)\n"

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/10 08:49:17 by maldavid #+# #+# */
/* Updated: 2025/03/12 22:01:07 by maldavid ### ########.fr */
/* Updated: 2025/10/22 13:38:43 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -206,7 +206,7 @@
typedef void (*mlx_function)(void);
#define MLX_VERSION MLX_MAKE_VERSION(2, 0, 0)
#define MLX_VERSION MLX_MAKE_VERSION(2, 2, 0)
#define MLX_TARGET_VULKAN_API_VERSION MLX_MAKE_VERSION(1, 0, 0)
// Checking common assumptions

View File

@@ -50,7 +50,7 @@ namespace mlx
~DescriptorPoolManager() = default;
private:
std::vector<DescriptorPool> m_pools;
std::vector<std::unique_ptr<DescriptorPool>> m_pools;
};
class DescriptorSet : public std::enable_shared_from_this<DescriptorSet>

View File

@@ -38,8 +38,8 @@ namespace mlx
private:
Swapchain m_swapchain;
std::vector<VkSemaphore> m_render_finished_semaphores;
std::array<VkSemaphore, MAX_FRAMES_IN_FLIGHT> m_image_available_semaphores;
std::array<VkSemaphore, MAX_FRAMES_IN_FLIGHT> m_render_finished_semaphores;
std::array<VkCommandBuffer, MAX_FRAMES_IN_FLIGHT> m_cmd_buffers;
std::array<VkFence, MAX_FRAMES_IN_FLIGHT> m_cmd_fences;
NonOwningPtr<Window> p_window;

View File

@@ -114,11 +114,8 @@ namespace mlx
void DescriptorPool::ReturnDescriptorSet(std::shared_ptr<DescriptorSet> set)
{
//std::size_t i = 0;
auto it = std::find_if(m_used_sets.begin(), m_used_sets.end(), [&](const std::shared_ptr<DescriptorSet>& rhs_set)
{
//i++;
//std::cout << m_used_sets.size() << " " << i << std::endl;
return set == rhs_set;
});
if(it == m_used_sets.end())
@@ -132,18 +129,18 @@ namespace mlx
MLX_PROFILE_FUNCTION();
for(auto& pool : m_pools)
{
if(pool.GetNumberOfSetsAllocated() < MAX_SETS_PER_POOL)
return pool;
if(pool->GetNumberOfSetsAllocated() < MAX_SETS_PER_POOL)
return *pool;
}
m_pools.emplace_back().Init();
return m_pools.back();
m_pools.emplace_back(std::make_unique<DescriptorPool>())->Init();
return *m_pools.back();
}
void DescriptorPoolManager::Destroy()
{
MLX_PROFILE_FUNCTION();
for(auto& pool : m_pools)
pool.Destroy();
pool->Destroy();
m_pools.clear();
}

View File

@@ -20,29 +20,42 @@ namespace mlx
MLX_PROFILE_FUNCTION();
p_window = window;
m_swapchain.Init(p_window);
for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
{
m_image_available_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice());
DebugLog("Vulkan: image available semaphore created");
m_render_finished_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice());
DebugLog("Vulkan: render finished semaphore created");
m_cmd_buffers[i] = kvfCreateCommandBuffer(RenderCore::Get().GetDevice());
DebugLog("Vulkan: command buffer created");
m_cmd_fences[i] = kvfCreateFence(RenderCore::Get().GetDevice());
DebugLog("Vulkan: fence created");
}
Init(NonOwningPtr<Texture>{ nullptr });
}
void Renderer::Init(NonOwningPtr<Texture> render_target)
{
MLX_PROFILE_FUNCTION();
p_render_target = render_target;
std::function<void(const EventBase&)> functor = [this](const EventBase& event)
{
if(event.What() == Event::ResizeEventCode)
{
for(std::size_t i = 0; i < m_render_finished_semaphores.size(); i++)
{
kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_render_finished_semaphores[i]);
DebugLog("Vulkan: render finished semaphore destroyed");
}
m_render_finished_semaphores.clear();
for(std::size_t i = 0; i < (p_window ? m_swapchain.GetImagesCount() : 1); i++)
{
m_render_finished_semaphores.push_back(kvfCreateSemaphore(RenderCore::Get().GetDevice()));
DebugLog("Vulkan: render finished semaphore created");
}
}
};
EventBus::RegisterListener({ functor, "mlx_renderer_" + std::to_string(reinterpret_cast<std::uintptr_t>(this)) });
if(render_target)
p_render_target = render_target;
for(std::size_t i = 0; i < (p_window ? m_swapchain.GetImagesCount() : 1); i++)
{
m_render_finished_semaphores.push_back(kvfCreateSemaphore(RenderCore::Get().GetDevice()));
DebugLog("Vulkan: render finished semaphore created");
}
for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
{
m_image_available_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice());
DebugLog("Vulkan: image available semaphore created");
m_render_finished_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice());
DebugLog("Vulkan: render finished semaphore created");
m_cmd_buffers[i] = kvfCreateCommandBuffer(RenderCore::Get().GetDevice());
DebugLog("Vulkan: command buffer created");
m_cmd_fences[i] = kvfCreateFence(RenderCore::Get().GetDevice());
@@ -66,14 +79,15 @@ namespace mlx
void Renderer::EndFrame()
{
MLX_PROFILE_FUNCTION();
std::size_t render_finished_index = (p_window ? m_swapchain.GetImageIndex() : 0);
VkPipelineStageFlags wait_stages[] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
kvfEndCommandBuffer(m_cmd_buffers[m_current_frame_index]);
if(p_window)
kvfSubmitCommandBuffer(RenderCore::Get().GetDevice(), m_cmd_buffers[m_current_frame_index], KVF_GRAPHICS_QUEUE, m_render_finished_semaphores[m_current_frame_index], m_image_available_semaphores[m_current_frame_index], m_cmd_fences[m_current_frame_index], wait_stages);
kvfSubmitCommandBuffer(RenderCore::Get().GetDevice(), m_cmd_buffers[m_current_frame_index], KVF_GRAPHICS_QUEUE, m_render_finished_semaphores[render_finished_index], m_image_available_semaphores[m_current_frame_index], m_cmd_fences[m_current_frame_index], wait_stages);
else
kvfSubmitCommandBuffer(RenderCore::Get().GetDevice(), m_cmd_buffers[m_current_frame_index], KVF_GRAPHICS_QUEUE, VK_NULL_HANDLE, VK_NULL_HANDLE, m_cmd_fences[m_current_frame_index], wait_stages);
if(p_window)
m_swapchain.Present(m_render_finished_semaphores[m_current_frame_index]);
m_swapchain.Present(m_render_finished_semaphores[render_finished_index]);
m_current_frame_index = (m_current_frame_index + 1) % MAX_FRAMES_IN_FLIGHT;
}
@@ -81,12 +95,16 @@ namespace mlx
{
MLX_PROFILE_FUNCTION();
RenderCore::Get().WaitDeviceIdle();
for(std::size_t i = 0; i < m_render_finished_semaphores.size(); i++)
{
kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_render_finished_semaphores[i]);
DebugLog("Vulkan: render finished semaphore destroyed");
}
m_render_finished_semaphores.clear();
for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
{
kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_image_available_semaphores[i]);
DebugLog("Vulkan: image available semaphore destroyed");
kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_render_finished_semaphores[i]);
DebugLog("Vulkan: render finished semaphore destroyed");
kvfDestroyCommandBuffer(RenderCore::Get().GetDevice(), m_cmd_buffers[i]);
DebugLog("Vulkan: command buffer destroyed");
kvfDestroyFence(RenderCore::Get().GetDevice(), m_cmd_fences[i]);