Skip to content

Commit

Permalink
[vulkan] increased fence wait time from 1 to 5 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
PanosK92 committed Dec 23, 2024
1 parent 90ab6bb commit 5a6be43
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion runtime/RHI/RHI_Implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ static const char* vkresult_to_string(const VkResult result)
{ \
Log::SetLogToFile(true); \
SP_LOG_ERROR("%s", vkresult_to_string(vk_result)); \
SP_ASSERT(false); \
SP_ASSERT(false && "Vulkan call failed"); \
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion runtime/RHI/RHI_SyncPrimitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace Spartan
~RHI_SyncPrimitive();

// sync
void Wait(const uint64_t value = 0, const uint64_t timeout_nanoseconds = 1000000000 /* 1 second */);
void Wait(const uint64_t value = 0, const uint64_t timeout_nanoseconds = 5000000000 /* 5 seconds */);
void Signal(const uint64_t value);

// value
Expand Down
18 changes: 9 additions & 9 deletions runtime/RHI/Vulkan/Vulkan_CommandList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1593,13 +1593,14 @@ namespace Spartan
memset(buffer->GetMappedData(), 0, buffer->GetObjectSize());
}

// deduce if the update can be done via vkCmdUpdateBuffer and synchronized with a barrier
bool vkCmdUpdateBuffer_compliant = true;
vkCmdUpdateBuffer_compliant &= (offset % 4 == 0); // offset must be a multiple of 4
vkCmdUpdateBuffer_compliant &= (size % 4 == 0); // size must be a multiple of 4
vkCmdUpdateBuffer_compliant &= (size <= 65536); // size must not exceed 65536 bytes

if (vkCmdUpdateBuffer_compliant)
// check for vkCmdUpdateBuffer compliance to deduce if this is a small and synchronized update
// non-compliant updates are done via a memcpy, and they are there for the big bindless arrays
bool synchronized_update = true;
synchronized_update &= (offset % 4 == 0); // offset must be a multiple of 4
synchronized_update &= (size % 4 == 0); // size must be a multiple of 4
synchronized_update &= (size <= 65536); // size must not exceed 65536 bytes

if (synchronized_update)
{
RenderPassEnd();

Expand Down Expand Up @@ -1651,9 +1652,8 @@ namespace Spartan
vkCmdPipelineBarrier2(static_cast<VkCommandBuffer>(m_rhi_resource), &dependency_info);
Profiler::m_rhi_pipeline_barriers++;
}
else
else // big bindless arrays (update rarely and don't require synchronization)
{
// big bindless arrays will fall into this category, it's okay if they are done asynchronously like that
void* mapped_data = static_cast<char*>(buffer->GetMappedData()) + offset;
memcpy(mapped_data, data, size);
}
Expand Down

0 comments on commit 5a6be43

Please sign in to comment.