simvx.graphics.renderer.render_target

Offscreen render target with colour + depth attachments.

Module Contents

Classes

RenderTarget

Manages an offscreen render target for render-to-texture.

Data

API

simvx.graphics.renderer.render_target.log

‘getLogger(…)’

simvx.graphics.renderer.render_target.__all__

[‘RenderTarget’, ‘GBUFFER_FORMAT’]

simvx.graphics.renderer.render_target.GBUFFER_FORMAT

None

class simvx.graphics.renderer.render_target.RenderTarget(device: Any, physical_device: Any, width: int, height: int, colour_format: int = vk.VK_FORMAT_R8G8B8A8_UNORM, use_depth: bool = True, samplable_depth: bool = False, *, initial_layout: int = vk.VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, queue: Any = None, command_pool: Any = None, reload_pass: bool = False, gbuffer: bool = False)[source]

Manages an offscreen render target for render-to-texture.

The colour image is transitioned to initial_layout at construction so it is safe to sample (or bind to a descriptor) before the first render pass writes to it. The default :data:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL matches the offscreen render pass’s finalLayout: the render pass itself uses initialLayout=UNDEFINED with LOAD_OP_CLEAR, so the pre-transition is discarded harmlessly on the first frame.

Initialization

begin_frame_barrier(cmd: Any) None[source]

Order this frame’s attachment writes after the previous frame’s accesses.

This target is a single shared instance reused across FRAMES_IN_FLIGHT, so frame N’s colour/depth clear races frame N-1’s accesses to the same image. The offscreen pass’s incoming EXTERNAL dependency (which does chain across submits via submission order) only reaches prior attachment writes at the attachment-output/fragment-test stages; it does not cover two hazards this barrier adds:

  • WAW visibility of frame N-1’s storeOp write (its srcAccessMask is 0, and an oldLayout=UNDEFINED image barrier would discard), and

  • WAR against frame N-1’s fragment-shader reads of this target (a later pass sampling it, or a TAA-style resolve reading it as history) – FRAGMENT_SHADER is absent from the render pass’s source scope entirely, so frame N’s clear could overtake those reads.

A global memory barrier carries both with no layout change and near-zero cost (usually a no-op execution dependency); it is the render-graph alternative to per-frame target duplication. Record it immediately before vkCmdBeginRenderPass.

destroy() None[source]

Clean up all resources.