hear add some debug code,
MetalFX FrameInterpolator calling code like this:
void MetalFXFrameInterpolator::MTLFXInterpolateFrame(const FrameInterpolatorRenderContextInternal& context, id frameInterpolator, id cmdBuffer)
{
id mtlTexOutput = context.idOutputTexture.IsValid() ? QueryMTLTexturePointer(context.idOutputTexture) : GetBackBufferColorMTLTexture();
id mtlTexPrevColor = QueryMTLTexturePointer(context.idPrevColorTexture);
id mtlTexMotion = QueryMTLTexturePointer(context.idMotionTexture);
id mtlTexColor = QueryMTLTexturePointer(context.idColorTexture);
id mtlTexDepth = QueryMTLTexturePointer(context.idDepthTexture);
id mtlTexUI = QueryMTLTexturePointer(context.idUiTexture);
if (mtlTexColor.width != frameInterpolator.inputWidth
|| mtlTexColor.height != frameInterpolator.inputHeight
|| mtlTexPrevColor.width != frameInterpolator.inputWidth
|| mtlTexPrevColor.height != frameInterpolator.inputHeight
|| mtlTexOutput.width != frameInterpolator.outputWidth
|| mtlTexOutput.height != frameInterpolator.outputHeight
|| mtlTexUI.width != frameInterpolator.outputWidth
|| mtlTexUI.height != frameInterpolator.outputHeight)
{
NSLog(@"ERR tex width mismatch: %lu x %lu ~ %lu x %lu ", (unsigned long)mtlTexColor.width , (unsigned long)mtlTexColor.height, (unsigned long)frameInterpolator.inputWidth, (unsigned long)frameInterpolator.inputHeight);
// return;
}
if (mtlTexColor.parentTexture != nil)
{
NSLog(@"mtlTexColor parentTex %lu x %lu", mtlTexColor.parentTexture.width, mtlTexColor.parentTexture.height);
}
if (mtlTexPrevColor.parentTexture != nil)
{
NSLog(@"mtlTexPrevColor parentTex %lu x %lu", mtlTexPrevColor.parentTexture.width, mtlTexPrevColor.parentTexture.height);
}
if (mtlTexUI.parentTexture != nil)
{
NSLog(@"mtlTexUI parentTex %lu x %lu", mtlTexUI.parentTexture.width, mtlTexUI.parentTexture.height);
}
if (mtlTexOutput.parentTexture != nil)
{
NSLog(@"mtlTexUI parentTex %lu x %lu", mtlTexOutput.parentTexture.width, mtlTexOutput.parentTexture.height);
}
NSLog(@"ERR mtlTexColor gfxFormat: %lu, size: %lu x %lu ~ %lu x %lu ", (unsigned long)mtlTexColor.pixelFormat , (unsigned long)mtlTexColor.width , (unsigned long)mtlTexColor.height, (unsigned long)frameInterpolator.inputWidth, (unsigned long)frameInterpolator.inputHeight);
NSLog(@"ERR mtlTexPrevColor gfxFormat: %lu, size: %lu x %lu ~ %lu x %lu ", (unsigned long)mtlTexPrevColor.pixelFormat , (unsigned long)mtlTexPrevColor.width , (unsigned long)mtlTexPrevColor.height, (unsigned long)frameInterpolator.inputWidth, (unsigned long)frameInterpolator.inputHeight);
NSLog(@"ERR mtlTexMotion gfxFormat: %lu, size: %lu x %lu ~ %lu x %lu ", (unsigned long)mtlTexMotion.pixelFormat , (unsigned long)mtlTexMotion.width , (unsigned long)mtlTexMotion.height, (unsigned long)frameInterpolator.inputWidth, (unsigned long)frameInterpolator.inputHeight);
NSLog(@"ERR mtlTexDepth gfxFormat: %lu, size: %lu x %lu ~ %lu x %lu ", (unsigned long)mtlTexDepth.pixelFormat , (unsigned long)mtlTexDepth.width , (unsigned long)mtlTexDepth.height, (unsigned long)frameInterpolator.inputWidth, (unsigned long)frameInterpolator.inputHeight);
NSLog(@"ERR mtlTexUI gfxFormat: %lu, size: %lu x %lu ~ %lu x %lu ", (unsigned long)mtlTexUI.pixelFormat , (unsigned long)mtlTexUI.width , (unsigned long)mtlTexUI.height, (unsigned long)frameInterpolator.outputWidth, (unsigned long)frameInterpolator.outputHeight);
NSLog(@"ERR mtlTexOutput gfxFormat: %lu, size: %lu x %lu ~ %lu x %lu ", (unsigned long)mtlTexOutput.pixelFormat , (unsigned long)mtlTexOutput.width , (unsigned long)mtlTexOutput.height, (unsigned long)frameInterpolator.outputWidth, (unsigned long)frameInterpolator.outputHeight);
NSLog(@"ERR m_MTLFXTemporalScaler inputSize: %lu x %lu outputSize: %lu x %lu ", (unsigned long) m_MTLFXTemporalScaler.inputWidth , (unsigned long)m_MTLFXTemporalScaler.inputHeight, (unsigned long) m_MTLFXTemporalScaler.outputWidth , (unsigned long)m_MTLFXTemporalScaler.outputHeight);
NSLog(@"ERR m_MTLFXTemporalScaler colorFormat- %lu depthFormat- %lu motionFormat- %lu outputFormat- %lu ", m_MTLFXTemporalScaler.colorTextureFormat , m_MTLFXTemporalScaler.depthTextureFormat, m_MTLFXTemporalScaler.motionTextureFormat , m_MTLFXTemporalScaler.outputTextureFormat);
NSLog(@"ERR FrameInterpolator colorFormat- %lu depthFormat- %lu motionFormat- %lu outputFormat- %lu uiFormat- %lu", frameInterpolator.colorTextureFormat , frameInterpolator.depthTextureFormat, frameInterpolator.motionTextureFormat , frameInterpolator.outputTextureFormat, frameInterpolator.uiTextureFormat);
frameInterpolator.uiTexture = mtlTexUI;
frameInterpolator.colorTexture = mtlTexColor;
frameInterpolator.depthTexture = mtlTexDepth;
frameInterpolator.motionTexture = mtlTexMotion;
frameInterpolator.outputTexture = mtlTexOutput;
frameInterpolator.prevColorTexture = mtlTexPrevColor;
frameInterpolator.deltaTime = context.deltaTime;
frameInterpolator.nearPlane = context.nearPlane;
frameInterpolator.farPlane = context.farPlane;
frameInterpolator.fieldOfView = context.fieldOfView;
frameInterpolator.aspectRatio = context.aspectRatio;
frameInterpolator.jitterOffsetX = context.jitterOffsetX;
frameInterpolator.jitterOffsetY = context.jitterOffsetY;
frameInterpolator.motionVectorScaleX = context.motionVectorScaleX;
frameInterpolator.motionVectorScaleY = context.motionVectorScaleY;
frameInterpolator.depthReversed = context.depthReversed;
frameInterpolator.shouldResetHistory = context.shouldResetHistory;
frameInterpolator.uiTextureComposited = context.uiTextureComposited;
m_MTLFXTemporalScaler.reset = context.shouldResetHistory;
m_MTLFXTemporalScaler.colorTexture = mtlTexColor;
m_MTLFXTemporalScaler.outputTexture = m_ScalerOutputTexture;
m_MTLFXTemporalScaler.motionTexture = mtlTexMotion;
m_MTLFXTemporalScaler.depthTexture = mtlTexDepth;
m_MTLFXTemporalScaler.depthReversed = context.depthReversed;
m_MTLFXTemporalScaler.jitterOffsetX = context.jitterOffsetX;
m_MTLFXTemporalScaler.jitterOffsetY = context.jitterOffsetY;
m_MTLFXTemporalScaler.inputContentWidth = mtlTexColor.width;
m_MTLFXTemporalScaler.inputContentHeight = mtlTexColor.height;
m_MTLFXTemporalScaler.motionVectorScaleX = context.motionVectorScaleX;
m_MTLFXTemporalScaler.motionVectorScaleY = context.motionVectorScaleY;
[frameInterpolator encodeToCommandBuffer: cmdBuffer];
frameInterpolator.colorTexture = nil;
frameInterpolator.depthTexture = nil;
frameInterpolator.motionTexture = nil;
frameInterpolator.outputTexture = nil;
frameInterpolator.prevColorTexture = nil;
}