- fix dynamic buffer offset not getting updated

- fix lightbuffer blocksize being hardcoded
This commit is contained in:
Magnus Norddahl 2019-03-05 02:06:20 +01:00
parent c137e868de
commit 95116e8580
5 changed files with 13 additions and 2 deletions

View file

@ -161,7 +161,7 @@ void VkRenderPassManager::CreateDynamicSet()
auto fb = GetVulkanFrameBuffer();
WriteDescriptors update;
update.addBuffer(DynamicSet.get(), 0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, fb->ViewpointUBO->mBuffer.get(), 0, sizeof(HWViewpointUniforms));
update.addBuffer(DynamicSet.get(), 1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, fb->LightBufferSSO->mBuffer.get(), 0, 4096);
update.addBuffer(DynamicSet.get(), 1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, fb->LightBufferSSO->mBuffer.get(), 0, fb->GetLightBufferBlockSize());
update.addBuffer(DynamicSet.get(), 2, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, fb->MatricesUBO->mBuffer.get(), 0, sizeof(MatricesUBO));
update.addBuffer(DynamicSet.get(), 3, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, fb->StreamUBO->mBuffer.get(), 0, sizeof(StreamUBO));
update.updateSets(fb->device);

View file

@ -572,7 +572,7 @@ void VkRenderState::ApplyMaterial()
void VkRenderState::ApplyDynamicSet()
{
if (mViewpointOffset != mLastViewpointOffset || mLightBufferOffset != mLastLightBufferOffset)
if (mViewpointOffset != mLastViewpointOffset || mLightBufferOffset != mLastLightBufferOffset || mMatricesOffset != mLastMatricesOffset || mStreamDataOffset != mLastStreamDataOffset)
{
auto fb = GetVulkanFrameBuffer();
auto passManager = fb->GetRenderPassManager();
@ -582,6 +582,8 @@ void VkRenderState::ApplyDynamicSet()
mLastViewpointOffset = mViewpointOffset;
mLastLightBufferOffset = mLightBufferOffset;
mLastMatricesOffset = mMatricesOffset;
mLastStreamDataOffset = mStreamDataOffset;
}
}

View file

@ -86,6 +86,8 @@ private:
uint32_t mLastViewpointOffset = 0xffffffff;
uint32_t mLastLightBufferOffset = 0xffffffff;
uint32_t mLastMatricesOffset = 0xffffffff;
uint32_t mLastStreamDataOffset = 0xffffffff;
uint32_t mViewpointOffset = 0;
uint32_t mLightBufferOffset = 0;
uint32_t mMatricesOffset = 0;

View file

@ -583,6 +583,11 @@ VulkanCommandBuffer *VulkanFrameBuffer::GetDrawCommands()
return mDrawCommands.get();
}
unsigned int VulkanFrameBuffer::GetLightBufferBlockSize() const
{
return mLights->GetBlockSize();
}
void VulkanFrameBuffer::PrintStartupLog()
{
FString deviceType;

View file

@ -28,6 +28,8 @@ public:
VkRenderPassManager *GetRenderPassManager() { return mRenderPassManager.get(); }
VkRenderState *GetRenderState() { return mRenderState.get(); }
unsigned int GetLightBufferBlockSize() const;
VKDataBuffer *ViewpointUBO = nullptr;
VKDataBuffer *LightBufferSSO = nullptr;
VKDataBuffer *MatricesUBO = nullptr;