Skip to content

Commit

Permalink
stop enabling timeline semaphores by default
Browse files Browse the repository at this point in the history
comment formatting
use more concise options for PipelineStageFlagBits2
  • Loading branch information
MoritzRoth committed Jul 22, 2023
1 parent 4783bbb commit 2d00de1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion auto_vk
Submodule auto_vk updated 1 files
+1 −0 include/avk/avk.hpp
1 change: 0 additions & 1 deletion auto_vk_toolkit/include/configure_and_compose.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ namespace avk
.setShaderUniformTexelBufferArrayDynamicIndexing(VK_TRUE)
.setShaderStorageTexelBufferArrayDynamicIndexing(VK_TRUE)
.setDescriptorIndexing(VK_TRUE)
.setTimelineSemaphore(VK_TRUE)
.setBufferDeviceAddress(VK_FALSE);

#if VK_HEADER_VERSION >= 162
Expand Down
27 changes: 14 additions & 13 deletions auto_vk_toolkit/include/context_vulkan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,23 @@ namespace avk
avk::command_buffer record_and_submit(std::vector<avk::recorded_commands_t> aRecordedCommandsAndSyncInstructions, const avk::queue& aQueue, vk::CommandBufferUsageFlags aUsageFlags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit);

avk::semaphore record_and_submit_with_semaphore(std::vector<avk::recorded_commands_t> aRecordedCommandsAndSyncInstructions, const avk::queue& aQueue, avk::stage::pipeline_stage_flags aSrcSignalStage, vk::CommandBufferUsageFlags aUsageFlags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit);
/** \brief Records and submits commands to a queue together with a newly created timeline semaphore, which is signalled upon completion.
* \param aRecordedCommandsAndSyncInstructions List of commands to record and submit.
* \param aQueue The queue to submit the commands to.
* \param aSrcSignalStage Defines in which stage it is safe to signal the created timeline semaphore.
* \param aSignalValue The value to SIGNAL the timeline semaphore to.
* \param aInitialValue (optional) The value to INITIALIZE the newly created timeline semaphore with.
* \param aUsageFlags (optional) CommandBuffer usage flags.
* \return The newly created timeline semaphore.

/** @brief Records and submits commands to a queue together with a newly created timeline semaphore, which is signaled upon completion.
* @param aRecordedCommandsAndSyncInstructions List of commands to record and submit.
* @param aQueue The queue to submit the commands to.
* @param aSrcSignalStage Defines in which stage it is safe to signal the created timeline semaphore.
* @param aSignalValue The value to SIGNAL the timeline semaphore to.
* @param aInitialValue (optional) The value to INITIALIZE the newly created timeline semaphore with.
* @param aUsageFlags (optional) CommandBuffer usage flags.
* @return The newly created timeline semaphore.
*/
avk::semaphore record_and_submit_with_timeline_semaphore(std::vector<avk::recorded_commands_t> aRecordedCommandsAndSyncInstructions, const avk::queue& aQueue, avk::stage::pipeline_stage_flags aSrcSignalStage, uint64_t aSignalValue, uint64_t aInitialValue = 0, vk::CommandBufferUsageFlags aUsageFlags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit);

/** \brief Records and submits commands to a queue together with the given timeline semaphore, which is signalled upon completion.
* \param aRecordedCommandsAndSyncInstructions List of commands to record and submit.
* \param aQueue The queue to submit the commands to.
* \param aSignalInfo Used to specify the timeline semaphore, after which stage it's supposed to be triggered, and to which value it should be set.
* \param aUsageFlags (optional) CommandBuffer usage flags.
/** @brief Records and submits commands to a queue together with the given timeline semaphore, which is signaled upon completion.
* @param aRecordedCommandsAndSyncInstructions List of commands to record and submit.
* @param aQueue The queue to submit the commands to.
* @param aSignalInfo Used to specify the timeline semaphore, after which stage it's supposed to be triggered, and to which value it should be set.
* @param aUsageFlags (optional) CommandBuffer usage flags.
*/
void record_and_submit_with_timeline_semaphore(std::vector<avk::recorded_commands_t> aRecordedCommandsAndSyncInstructions, const avk::queue& aQueue, avk::semaphore_signal_info aSignalInfo, vk::CommandBufferUsageFlags aUsageFlags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit);

Expand Down
7 changes: 5 additions & 2 deletions examples/model_loader/source/model_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class model_loader_app : public avk::invokee
std::move(nrmFillCmd),
std::move(idxFillCmd)
// ^ No need for any synchronization in-between, because the commands do not depend on each other.
}, * mQueue, { vk::PipelineStageFlagBits2::eAllTransfer }, 1);
}, *mQueue, avk::stage::all_transfer, 1);
// Wait on the host until the device is done:
timelineSemaphore->wait_until_signaled(1);
}
Expand All @@ -142,7 +142,7 @@ class model_loader_app : public avk::invokee
auto matTSemaphore = avk::context().record_and_submit_with_timeline_semaphore({
std::move(materialCommands),
mMaterialBuffer->fill(gpuMaterials.data(), 0)
}, *mQueue, {vk::PipelineStageFlagBits2::eAllCommands}, 1);
}, *mQueue, avk::stage::all_commands, 1);
matTSemaphore->wait_until_signaled(1);

// Create a buffer for the transformation matrices in a host coherent memory region (one for each frame in flight):
Expand Down Expand Up @@ -460,6 +460,9 @@ int main() // <== Starting point ==
[](avk::validation_layers& config) {
config.enable_feature(vk::ValidationFeatureEnableEXT::eSynchronizationValidation);
},
[](vk::PhysicalDeviceVulkan12Features& features) {
features.setTimelineSemaphore(VK_TRUE);
},
// Pass windows:
mainWnd,
// Pass invokees:
Expand Down

0 comments on commit 2d00de1

Please sign in to comment.