RenderTargetHandle GetRenderTarget( string name, ImageFormat format, int numMips, int sizeFactor )
RenderTargetHandle GetRenderTarget( string name, int sizeFactor, ImageFormat colorFormat, ImageFormat depthFormat, MultisampleAmount msaa, int numMips )
RenderTargetHandle GetRenderTarget( string name, int width, int height, ImageFormat colorFormat, ImageFormat depthFormat, MultisampleAmount msaa, int numMips )

robot_2Generated
code_blocksInput

Description

The GetRenderTarget method in the CommandList class is used to retrieve a render target handle based on specified parameters. This method is essential for managing render targets within the rendering pipeline, allowing for the creation and reuse of render targets with specific configurations.

Usage

To use the GetRenderTarget method, you need to provide the following parameters:

  • name (string): A unique identifier for the render target. This is used to reference the render target within the rendering system.
  • format (ImageFormat): Specifies the image format of the render target, determining how the data is stored and processed.
  • numMips (int): The number of mipmap levels to generate for the render target. Mipmaps are used to improve rendering performance and quality at different distances.
  • sizeFactor (int): A factor that determines the size of the render target relative to the viewport or another reference size. This allows for dynamic scaling of the render target size.

Once called, the method returns a RenderTargetHandle that can be used to manage the render target within the rendering pipeline.

Example

// Example of using GetRenderTarget
var commandList = new CommandList();
var renderTargetHandle = commandList.GetRenderTarget(
    "MyRenderTarget", 
    ImageFormat.RGBA8, 
    1, 
    2
);

// Use the renderTargetHandle for rendering operations
commandList.SetRenderTarget(renderTargetHandle);
// Perform rendering operations here
commandList.ReleaseRenderTarget(renderTargetHandle);