mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-12-02 00:43:29 +00:00
- wait for space if the stream buffers are exhausted
This commit is contained in:
parent
240a32f4c8
commit
d31dbf14e4
2 changed files with 19 additions and 5 deletions
|
@ -327,6 +327,9 @@ void VkRenderState::ApplyStreamData()
|
||||||
{
|
{
|
||||||
mDataIndex = 0;
|
mDataIndex = 0;
|
||||||
mStreamDataOffset += sizeof(StreamUBO);
|
mStreamDataOffset += sizeof(StreamUBO);
|
||||||
|
|
||||||
|
if (mStreamDataOffset + sizeof(StreamUBO) >= fb->StreamUBO->Size())
|
||||||
|
WaitForStreamBuffers();
|
||||||
}
|
}
|
||||||
uint8_t *ptr = (uint8_t*)fb->StreamUBO->Memory();
|
uint8_t *ptr = (uint8_t*)fb->StreamUBO->Memory();
|
||||||
memcpy(ptr + mStreamDataOffset + sizeof(StreamData) * mDataIndex, &mStreamData, sizeof(StreamData));
|
memcpy(ptr + mStreamDataOffset + sizeof(StreamData) * mDataIndex, &mStreamData, sizeof(StreamData));
|
||||||
|
@ -420,12 +423,12 @@ void VkRenderState::ApplyMatrices()
|
||||||
{
|
{
|
||||||
auto fb = GetVulkanFrameBuffer();
|
auto fb = GetVulkanFrameBuffer();
|
||||||
|
|
||||||
if (mMatricesOffset + (fb->UniformBufferAlignedSize<MatricesUBO>() << 1) < fb->MatricesUBO->Size())
|
if (mMatricesOffset + (fb->UniformBufferAlignedSize<MatricesUBO>() << 1) >= fb->MatricesUBO->Size())
|
||||||
{
|
WaitForStreamBuffers();
|
||||||
|
|
||||||
mMatricesOffset += fb->UniformBufferAlignedSize<MatricesUBO>();
|
mMatricesOffset += fb->UniformBufferAlignedSize<MatricesUBO>();
|
||||||
memcpy(static_cast<uint8_t*>(fb->MatricesUBO->Memory()) + mMatricesOffset, &mMatrices, sizeof(MatricesUBO));
|
memcpy(static_cast<uint8_t*>(fb->MatricesUBO->Memory()) + mMatricesOffset, &mMatrices, sizeof(MatricesUBO));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VkRenderState::ApplyVertexBuffers()
|
void VkRenderState::ApplyVertexBuffers()
|
||||||
|
@ -481,6 +484,16 @@ void VkRenderState::ApplyDynamicSet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VkRenderState::WaitForStreamBuffers()
|
||||||
|
{
|
||||||
|
EndRenderPass();
|
||||||
|
GetVulkanFrameBuffer()->WaitForCommands(false);
|
||||||
|
mApplyCount = 0;
|
||||||
|
mStreamDataOffset = 0;
|
||||||
|
mDataIndex = 0;
|
||||||
|
mMatricesOffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void VkRenderState::Bind(int bindingpoint, uint32_t offset)
|
void VkRenderState::Bind(int bindingpoint, uint32_t offset)
|
||||||
{
|
{
|
||||||
if (bindingpoint == VIEWPOINT_BINDINGPOINT)
|
if (bindingpoint == VIEWPOINT_BINDINGPOINT)
|
||||||
|
|
|
@ -63,6 +63,7 @@ protected:
|
||||||
void ApplyVertexBuffers();
|
void ApplyVertexBuffers();
|
||||||
void ApplyMaterial();
|
void ApplyMaterial();
|
||||||
|
|
||||||
|
void WaitForStreamBuffers();
|
||||||
void BeginRenderPass(VulkanCommandBuffer *cmdbuffer);
|
void BeginRenderPass(VulkanCommandBuffer *cmdbuffer);
|
||||||
|
|
||||||
bool mDepthClamp = true;
|
bool mDepthClamp = true;
|
||||||
|
|
Loading…
Reference in a new issue