mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +00:00
Fix offset bug when using more than 1024 lights in a scene
This commit is contained in:
parent
e4578a7626
commit
2c9a1cbab7
1 changed files with 2 additions and 2 deletions
|
@ -468,7 +468,7 @@ void VkRenderState::ApplyHWBufferSet()
|
|||
{
|
||||
uint32_t matrixOffset = mMatrixBufferWriter.Offset();
|
||||
uint32_t streamDataOffset = mStreamBufferWriter.StreamDataOffset();
|
||||
uint32_t lightsOffset = mLightIndex >= 0 ? (uint32_t)(mLightIndex / MAX_LIGHT_DATA) * sizeof(FVector4) : mLastLightsOffset;
|
||||
uint32_t lightsOffset = mLightIndex >= 0 ? (uint32_t)(mLightIndex / MAX_LIGHT_DATA) * sizeof(LightBufferUBO) : mLastLightsOffset;
|
||||
if (mViewpointOffset != mLastViewpointOffset || matrixOffset != mLastMatricesOffset || streamDataOffset != mLastStreamDataOffset || lightsOffset != mLastLightsOffset)
|
||||
{
|
||||
auto passManager = fb->GetRenderPassManager();
|
||||
|
@ -563,7 +563,7 @@ int VkRenderState::UploadLights(const FDynLightData& data)
|
|||
|
||||
// Make sure the light list doesn't cross a page boundary
|
||||
if (buffers->Lightbuffer.UploadIndex % MAX_LIGHT_DATA + totalsize > MAX_LIGHT_DATA)
|
||||
buffers->Lightbuffer.UploadIndex = buffers->Lightbuffer.UploadIndex / MAX_LIGHT_DATA * MAX_LIGHT_DATA + 1;
|
||||
buffers->Lightbuffer.UploadIndex = (buffers->Lightbuffer.UploadIndex / MAX_LIGHT_DATA + 1) * MAX_LIGHT_DATA;
|
||||
|
||||
int thisindex = buffers->Lightbuffer.UploadIndex;
|
||||
if (thisindex + totalsize <= buffers->Lightbuffer.Count)
|
||||
|
|
Loading…
Reference in a new issue