Update light level in level mesh

This commit is contained in:
Magnus Norddahl 2024-09-11 01:39:26 +02:00
commit f0c018fdc6
11 changed files with 216 additions and 63 deletions

View file

@ -941,21 +941,19 @@ void VkRenderState::ApplyLevelMeshPipeline(VulkanCommandBuffer* cmdbuffer, VkPip
mPipelineKey = pipelineKey;
PushConstants pushConstants = {};
pushConstants.uDataIndex = 0;
pushConstants.uLightIndex = -1;
pushConstants.uBoneIndexBase = -1;
pushConstants.uFogballIndex = -1;
VulkanPipelineLayout* layout = fb->GetRenderPassManager()->GetPipelineLayout(pipelineKey.ShaderKey.UseLevelMesh);
uint32_t viewpointOffset = mViewpointOffset;
uint32_t matrixOffset = mRSBuffers->MatrixBuffer->Offset();
uint32_t lightsOffset = 0;
uint32_t fogballsOffset = 0;
uint32_t offsets[] = { viewpointOffset, matrixOffset, lightsOffset, fogballsOffset };
uint32_t offsets[] = { viewpointOffset, matrixOffset, fogballsOffset };
auto descriptors = fb->GetDescriptorSetManager();
cmdbuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mPassSetup->GetPipeline(pipelineKey));
cmdbuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptors->GetFixedSet());
cmdbuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 1, descriptors->GetLevelMeshSet(), 4, offsets);
cmdbuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 1, descriptors->GetLevelMeshSet(), 3, offsets);
cmdbuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 2, descriptors->GetBindlessSet());
cmdbuffer->pushConstants(layout, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0, (uint32_t)sizeof(PushConstants), &pushConstants);
}