Class RenderTargetManager

java.lang.Object
dev.engine.graphics.common.RenderTargetManager

public class RenderTargetManager extends Object
Manages render target lifecycle: creation, resize, and pooling.

Supports color-only, color+depth, and multiple render target (MRT) configurations. Named render targets can be resized as a group (e.g., on window resize). Transient render targets are pooled for reuse by the render graph.

  • Constructor Details

  • Method Details

    • getOrCreate

      public Handle<RenderTargetResource> getOrCreate(String name, int width, int height, TextureFormat colorFormat)
      Creates or retrieves a named render target with a single color attachment.
    • getOrCreate

      public Handle<RenderTargetResource> getOrCreate(String name, int width, int height, TextureFormat colorFormat, TextureFormat depthFormat)
      Creates or retrieves a named render target with color + depth.
    • getOrCreate

      public Handle<RenderTargetResource> getOrCreate(String name, RenderTargetDescriptor descriptor)
      Creates or retrieves a named render target with a full descriptor (MRT, custom formats).
    • getColorTexture

      public Handle<TextureResource> getColorTexture(String name, int index)
      Gets the color texture attachment of a named render target.
    • getColorTexture

      public Handle<TextureResource> getColorTexture(String name)
      Gets the color texture attachment (index 0) of a named render target.
    • resize

      public void resize(Vec2i newSize)
      Resizes all named render targets that match the old size to the new size.
    • destroy

      public void destroy(String name)
      Destroys a named render target.
    • acquireTransient

      public Handle<RenderTargetResource> acquireTransient(RenderTargetDescriptor descriptor)
      Acquires a transient render target from the pool, or creates one.
    • releaseTransient

      public void releaseTransient(Handle<RenderTargetResource> handle)
      Releases a transient render target back to the pool.
    • releaseAllTransient

      public void releaseAllTransient()
      Releases all transient render targets (call at frame end).
    • close

      public void close()