| 312 | } |
| 313 | |
| 314 | void SetLightBufferCount(HRenderContext render_context, uint32_t max_lights) |
| 315 | { |
| 316 | assert(render_context); |
| 317 | assert(render_context->m_RenderLightsIndices.Size() == 0); |
| 318 | |
| 319 | if (render_context->m_LightUniformBuffer) |
| 320 | { |
| 321 | dmGraphics::DeleteUniformBuffer(render_context->m_GraphicsContext, render_context->m_LightUniformBuffer); |
| 322 | render_context->m_LightUniformBuffer = 0; |
| 323 | } |
| 324 | |
| 325 | render_context->m_MaxLightCount = (uint16_t) max_lights; |
| 326 | render_context->m_LightBufferDirtyStart = 0; |
| 327 | render_context->m_LightBufferDirtyEnd = 0; |
| 328 | render_context->m_LightBufferDirtyCount = 0; |
| 329 | render_context->m_LightBufferDataWriteStart = 0; |
| 330 | render_context->m_LightBufferLastWrittenCount = 0; |
| 331 | |
| 332 | if (render_context->m_RenderLightsIndices.Capacity() < max_lights) |
| 333 | { |
| 334 | render_context->m_RenderLightsIndices.SetCapacity(max_lights); |
| 335 | } |
| 336 | render_context->m_LightBufferScratch.SetCapacity(max_lights); |
| 337 | render_context->m_LightBufferScratch.SetSize(0); |
| 338 | GenerateUniformBuffer(render_context, (int) max_lights); |
| 339 | } |
| 340 | |
| 341 | void FinalizeLightData(HRenderContext render_context) |
| 342 | { |