MCPcopy Create free account
hub / github.com/defold/defold / VulkanSetRenderTarget

Function VulkanSetRenderTarget

engine/graphics/src/vulkan/graphics_vulkan.cpp:4444–4471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4442 }
4443
4444 static void VulkanSetRenderTarget(HContext _context, HRenderTarget render_target, uint32_t transient_buffer_types)
4445 {
4446 (void) transient_buffer_types;
4447 VulkanContext* context = (VulkanContext*) _context;
4448 HRenderTarget new_rt = render_target != 0x0 ? render_target : context->m_MainRenderTarget;
4449
4450 if (context->m_CurrentRenderTarget == new_rt)
4451 {
4452 // Same target: nothing to do. If a pass is already open on it we keep it open;
4453 // if not, the next Clear/DrawSetup will open it lazily.
4454 return;
4455 }
4456
4457 FlushPendingRenderTargetClear(context, context->m_CurrentRenderTarget);
4458
4459 // End the currently open render pass (if any) without eagerly beginning the new one.
4460 // The new pass is opened on demand by VulkanClear / DrawSetup, which both call
4461 // BeginRenderPass as their first step. Deferring the begin avoids emitting empty
4462 // begin/end render-pass pairs when scripts rebind targets without issuing any work
4463 // on every intermediate target (very common in post-process chains).
4464 if (context->m_RenderTargetBound)
4465 {
4466 EndRenderPass(context);
4467 }
4468
4469 context->m_CurrentRenderTarget = new_rt;
4470 context->m_ViewportChanged = 1;
4471 }
4472
4473 static void VulkanSetRenderTargetSize(HContext _context, HRenderTarget render_target, uint32_t width, uint32_t height)
4474 {

Callers

nothing calls this directly

Calls 2

EndRenderPassFunction · 0.70

Tested by

no test coverage detected