Skip to content

Commit

Permalink
* vk renderer2: started work on scratch commands
Browse files Browse the repository at this point in the history
  • Loading branch information
harrand committed Mar 4, 2023
1 parent 99f1356 commit 5466333
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ add_library(topaz STATIC
src/tz/gl/impl/vulkan/renderer.inl
src/tz/gl/impl/vulkan/renderer2.cpp
src/tz/gl/impl/vulkan/renderer2.hpp
src/tz/gl/impl/vulkan/renderer2.inl
# tz::gl (OpenGL Frontend)
src/tz/gl/impl/opengl/component.cpp
src/tz/gl/impl/opengl/component.hpp
Expand Down
12 changes: 11 additions & 1 deletion src/tz/gl/impl/vulkan/renderer2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,17 @@ namespace tz::gl
void renderer_command_processor::scratch_initialise_static_resources()
{
TZ_PROFZONE("renderer_command_processor - scratch initialise static resources", 0xFFAAAA00);
// NYI
// now the scratch buffer might've already been recorded earlier with commands. if so, we need to realloc it.
if(this->scratch_command_buffer().command_count() > 0)
{
// allocate already purges previous alloc, so just need to call free_commands aswell.
this->allocate_commands(command_type::scratch);
}
this->do_scratch_work([](vk2::CommandBufferRecording& record)
{
(void)record;
tz::error("NYI");
});
}

std::span<vk2::CommandBuffer> renderer_command_processor::work_command_buffers()
Expand Down
3 changes: 3 additions & 0 deletions src/tz/gl/impl/vulkan/renderer2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define TZ_GL_IMPL_VULKAN_RENDERER2_HPP
#include "tz/gl/api/renderer.hpp"
#include "tz/core/memory/maybe_owned_ptr.hpp"
#include "tz/core/types.hpp"
#include "tz/gl/impl/vulkan/component.hpp"
#include "tz/gl/impl/common/renderer.hpp"

Expand Down Expand Up @@ -77,6 +78,7 @@ namespace tz::gl
renderer_command_processor(const tz::gl::renderer_info& info);
~renderer_command_processor();
renderer_command_processor() = default;
void do_scratch_work(tz::action<vk2::CommandBufferRecording&> auto record_commands);

enum class command_type
{
Expand Down Expand Up @@ -125,4 +127,5 @@ namespace tz::gl
static_assert(tz::gl::renderer_type<renderer_vulkan2>);
}

#include "tz/gl/impl/vulkan/renderer2.inl"
#endif // TZ_GL_IMPL_VULKAN_RENDERER2_HPP
13 changes: 13 additions & 0 deletions src/tz/gl/impl/vulkan/renderer2.inl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace tz::gl
{
void renderer_command_processor::do_scratch_work(tz::action<vk2::CommandBufferRecording&> auto record_commands)
{
// firstly record the commands requested.
{
vk2::CommandBufferRecording rec = this->scratch_command_buffer().record();
record_commands(rec);
}
// then, execute them.
tz::error("NYI");
}
}

0 comments on commit 5466333

Please sign in to comment.