FMoviePipelineSurfaceReader

Copyright Epic Games, Inc. All Rights Reserved.

Windows
MacOS
Linux

References

Module

MovieRenderPipelineCore

Header

/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Public/MoviePipelineSurfaceReader.h

Include

#include "MoviePipelineSurfaceReader.h"

Syntax

struct FMoviePipelineSurfaceReader

Remarks

When the GPU finishes rendering a view we can copy the resulting data back to the CPU. Because the buffer is still in use this requires flushing the RHI and stalling the GPU from doing any additional work while the copy is in progress. To resolve this issue, when the data is returned we schedule a copy to a surface that isn't in use which allows the GPU to resume work. Then when the surface is written to, we can copy it to the CPU without blocking the GPU. This requires ensuring that the surface is available, so this SurfaceReader implements a trigger system to ensure we don't try to access the surface until it has been written to, combined with a round-robin of surfaces to avoid stalls.

Variables

Name Description

Protected variable

FEvent *

 

AvailableEvent

Optional event that is triggered when the surface is no longer in use

Protected variable

bool

 

bQueuedForCapture

Protected variable

EPixelFormat

 

PixelFormat

The desired pixel format of the resolved textures

Protected variable

FTexture2DRHIRe...

 

ReadbackTexture

Texture used to store the resolved render target

Constructors

Name Description

Public function

FMoviePipelineSurfaceReader

(
    EPixelFormat InPixelFormat,
    FIntPoint InSurfaceSize
)

Construct a surface reader with the given pixel format and size.

Destructors

Functions

Name Description

Public function

void

 

BlockUntilAvailable()

Wait until this surface is available for reuse.

Public function

void

 

CopyReadbackTexture_RenderThread

(
    const FMoviePipelineRenderPassMetri...,
    const FMoviePipelineSampleReady& I...
)

Maps the ReadbackTexture to the CPU (which should have been resolved to before this point) and copies the data over.

Public function

void

 

Initialize()

Initialize this reader so that it can be waited on.

Public function Const

bool

 

IsAvailable()

Public function

void

 

Reset()

Safely resets the state of the wait event.

Protected function

void

 

Resize

(
    uint32 Width,
    uint32 Height
)

Set up this surface to the specified width/height

Public function

void

 

ResolveSampleToReadbackTexture_RenderThread

(
    const FTexture2DRHIRef& SourceSurf...
)

Issues a command to the GPU to copy the given SourceSurfaceSample to our local ReadbackTexture for this surface.

Public function Const

bool

 

WasEverQueued()

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss