Skip to content

Commit 1577e5f

Browse files
committed
[iceshard] Minor improvements after collections refactor.
* More temporary fixes for GfxRunner.
1 parent 5ac1f81 commit 1577e5f

File tree

5 files changed

+22
-15
lines changed

5 files changed

+22
-15
lines changed

source/code/framework/framework_base/private/framework_main.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ auto ice_resume(
542542
runtime.input_tracker->register_device_type(ice::input::DeviceType::Keyboard, ice::input::get_default_device_factory());
543543

544544
//runtime.gfx_rendergraph_runtime = state.game->rendergraph(runtime.gfx_runner->device());
545-
ice::wait_for(runtime.gfx_runner->update_rendergraph(state.game->rendergraph(runtime.gfx_runner->context())));
545+
runtime.gfx_runner->update_rendergraph(state.game->rendergraph(runtime.gfx_runner->context()));
546546
runtime.gfx_wait.set();
547547
}
548548

@@ -660,7 +660,7 @@ auto ice_update(
660660

661661
//runtime.gfx_wait.wait();
662662
runtime.gfx_runner->context().recreate_swapchain();
663-
ice::wait_for(runtime.gfx_runner->update_rendergraph(state.game->rendergraph(runtime.gfx_runner->context())));
663+
runtime.gfx_runner->update_rendergraph(state.game->rendergraph(runtime.gfx_runner->context()));
664664
}
665665

666666
// Since the frame updates the values we are safe to access them any time. They won't change until a new frame is awaited, and awaitng frames is happening on the same thread.

source/code/iceshard/engine/public/ice/ecs/ecs_query_operations.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ namespace ice::ecs
329329
ice::ecs::detail::ArchetypeInstanceInfo const* arch = nullptr;
330330
ice::ecs::detail::DataBlock const* block = nullptr;
331331

332-
ice::u32 const arch_count = ice::count(query.archetype_instances);
332+
ice::u32 const arch_count = query.archetype_instances.size().u32();
333333
for (; arch_idx < arch_count; ++arch_idx)
334334
{
335335
arch = query.archetype_instances[arch_idx];
@@ -552,7 +552,7 @@ namespace ice::ecs
552552

553553
void* helper_pointer_array[component_count]{ nullptr };
554554

555-
ice::u32 const arch_count = ice::count(query.archetype_instances);
555+
ice::u32 const arch_count = query.archetype_instances.size().u32();
556556
for (ice::u32 arch_idx = 0; arch_idx < arch_count; ++arch_idx)
557557
{
558558
ice::ecs::detail::ArchetypeInstanceInfo const* arch = query.archetype_instances[arch_idx];

source/code/iceshard/engine/public/ice/gfx/gfx_runner.hxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ namespace ice::gfx
2323
{
2424
virtual ~GfxRunner() noexcept = default;
2525

26+
virtual bool has_rendergraph() const noexcept = 0;
27+
2628
//! \brief Sets a rendergraph to used for execution each frame.
27-
virtual auto update_rendergraph(
29+
virtual void update_rendergraph(
2830
ice::UniquePtr<ice::gfx::GfxGraphRuntime> rendergraph
29-
) noexcept -> ice::Task<> = 0;
31+
) noexcept = 0;
3032

3133
virtual auto update_data(
3234
ice::EngineFrame& frame,

source/code/iceshard/iceshard/private/iceshard_gfx_runner.cxx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,10 @@ namespace ice::gfx
113113
_context->device().destroy_fence(_present_fence);
114114
}
115115

116-
auto IceshardGfxRunner::update_rendergraph(
116+
void IceshardGfxRunner::update_rendergraph(
117117
ice::UniquePtr<ice::gfx::GfxGraphRuntime> rendergraph
118-
) noexcept -> ice::Task<>
118+
) noexcept
119119
{
120-
co_await _scheduler;
121-
122120
if (_rendergraph != nullptr)
123121
{
124122
ice::gfx::GfxFrameStages gpu_stages{
@@ -135,8 +133,8 @@ namespace ice::gfx
135133
}
136134
}
137135
}
138-
139-
_rendergraph = ice::move(rendergraph);
136+
137+
_scheduled_rendergraph = ice::move(rendergraph);
140138
}
141139

142140
auto IceshardGfxRunner::update_data(
@@ -214,7 +212,7 @@ namespace ice::gfx
214212
}
215213

216214
// Check if we have a scheduled render graph and if we can replace
217-
if (_scheduled_rendergraph != nullptr && _rendergraph->ready())
215+
if (_scheduled_rendergraph != nullptr && (_rendergraph == nullptr || _rendergraph->ready()))
218216
{
219217
_rendergraph = ice::move(_scheduled_rendergraph);
220218
}
@@ -227,6 +225,11 @@ namespace ice::gfx
227225
ice::execute_tasks(tasks);
228226
}
229227

228+
if (_rendergraph->ready() == false)
229+
{
230+
co_return;
231+
}
232+
230233
if (_queue_transfer.not_empty() || _gfx_tasks.running_tasks() > 0)
231234
{
232235
IPT_ZONE_SCOPED_NAMED("gfx_await_tasks");

source/code/iceshard/iceshard/private/iceshard_gfx_runner.hxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ namespace ice::gfx
4646
) noexcept;
4747
~IceshardGfxRunner() noexcept override;
4848

49-
auto update_rendergraph(
49+
bool has_rendergraph() const noexcept override { return _rendergraph != nullptr; }
50+
51+
void update_rendergraph(
5052
ice::UniquePtr<ice::gfx::GfxGraphRuntime> rendergraph
51-
) noexcept -> ice::Task<> override;
53+
) noexcept;
5254

5355
auto update_data(
5456
ice::EngineFrame& frame,

0 commit comments

Comments
 (0)